Author: justi9
Date: 2010-07-11 16:58:49 -0400 (Sun, 11 Jul 2010)
New Revision: 4098
Modified:
mgmt/newdata/cumin/model/cumin.xml
mgmt/newdata/cumin/model/qmf.xml
mgmt/newdata/mint/python/mint/expire.py
mgmt/newdata/mint/python/mint/update.py
mgmt/newdata/mint/python/mint/vacuum.py
mgmt/newdata/rosemary/python/rosemary/model.py
Log:
* Add support in rosemary for multiple Packages in one schema file
* Add a storage parameter to Class; this is meant to replace the
transient flag and to support future in-memory storage alternatives
* Add a proposed replacement for the GetJobSummaries class to
cumin.xml: com.redhat.cumin.grid.JobSummary; it's just a rename and
a relocation
Modified: mgmt/newdata/cumin/model/cumin.xml
===================================================================
--- mgmt/newdata/cumin/model/cumin.xml 2010-07-09 20:56:48 UTC (rev 4097)
+++ mgmt/newdata/cumin/model/cumin.xml 2010-07-11 20:58:49 UTC (rev 4098)
@@ -1,25 +1,41 @@
-<schema package="com.redhat.cumin">
- <class name="BrokerGroup">
- <property name="name" type="sstr"/>
- <property name="description" type="lstr"
optional="y"/>
- </class>
+<model>
+ <package name="com.redhat.cumin">
+ <class name="BrokerGroup">
+ <property name="name" type="sstr"/>
+ <property name="description" type="lstr"
optional="y"/>
+ </class>
- <class name="BrokerGroupMapping">
- <property name="broker" type="objId"
references="org.apache.qpid.broker:Broker"/>
- <property name="group" type="objId"
references="BrokerGroup"/>
- </class>
+ <class name="BrokerGroupMapping">
+ <property name="broker" type="objId"
references="org.apache.qpid.broker:Broker"/>
+ <property name="group" type="objId"
references="BrokerGroup"/>
+ </class>
- <class name="User">
- <property name="name" type="sstr" index="y"/>
- <property name="password" type="sstr"
index="y"/>
- </class>
+ <class name="User">
+ <property name="name" type="sstr" index="y"/>
+ <property name="password" type="sstr"
index="y"/>
+ </class>
- <class name="Role">
- <property name="name" type="sstr" index="y"/>
- </class>
+ <class name="Role">
+ <property name="name" type="sstr" index="y"/>
+ </class>
- <class name="UserRoleMapping">
- <property name="user" references="User"
index="y"/>
- <property name="role" references="Role"
index="y"/>
- </class>
-</schema>
+ <class name="UserRoleMapping">
+ <property name="user" references="User"
index="y"/>
+ <property name="role" references="Role"
index="y"/>
+ </class>
+ </package>
+
+ <package name="com.redhat.cumin.grid">
+ <class name="JobSummary" storage="none">
+ <property name="ProcId" type="sstr"/>
+ <property name="Args" type="sstr"/>
+ <property name="QDate" type="absTime"/>
+ <property name="Cmd" type="sstr"/>
+ <property name="ClusterId" type="sstr"/>
+ <property name="JobStatus" type="sstr"/>
+ <property name="EnteredCurrentStatus" type="absTime"/>
+ <property name="GlobalJobId" type="sstr"/>
+ <property name="JobId" type="sstr"/>
+ </class>
+ </package>
+</model>
Modified: mgmt/newdata/cumin/model/qmf.xml
===================================================================
--- mgmt/newdata/cumin/model/qmf.xml 2010-07-09 20:56:48 UTC (rev 4097)
+++ mgmt/newdata/cumin/model/qmf.xml 2010-07-11 20:58:49 UTC (rev 4098)
@@ -1,5 +1,5 @@
<schema package="qmf.response" type="transient">
- <class name="GetJobSummaries">
+ <class name="GetJobSummaries" storage="none">
<property name="ProcId" type="sstr"/>
<property name="Args" type="sstr"/>
<property name="QDate" type="absTime"/>
@@ -10,5 +10,4 @@
<property name="GlobalJobId" type="sstr"/>
<property name="JobId" type="sstr"/>
</class>
-
</schema>
Modified: mgmt/newdata/mint/python/mint/expire.py
===================================================================
--- mgmt/newdata/mint/python/mint/expire.py 2010-07-09 20:56:48 UTC (rev 4097)
+++ mgmt/newdata/mint/python/mint/expire.py 2010-07-11 20:58:49 UTC (rev 4098)
@@ -41,10 +41,12 @@
count = 0
for pkg in self.model._packages:
- if pkg.sql_schema.type != "transient":
- for cls in pkg._classes:
- count += self.delete_samples(cursor, cls, seconds)
+ for cls in pkg._classes:
+ if cls._storage == "none":
+ continue
+ count += self.delete_samples(cursor, cls, seconds)
+
log.info("Expired %i samples", count)
def delete_samples(self, cursor, cls, seconds):
Modified: mgmt/newdata/mint/python/mint/update.py
===================================================================
--- mgmt/newdata/mint/python/mint/update.py 2010-07-09 20:56:48 UTC (rev 4097)
+++ mgmt/newdata/mint/python/mint/update.py 2010-07-11 20:58:49 UTC (rev 4098)
@@ -480,6 +480,9 @@
for pkg in self.model._packages:
for cls in pkg._classes:
+ if cls._storage == "none":
+ continue
+
for obj in cls.get_selection(cursor, _qmf_agent_id=id):
obj.delete(cursor)
Modified: mgmt/newdata/mint/python/mint/vacuum.py
===================================================================
--- mgmt/newdata/mint/python/mint/vacuum.py 2010-07-09 20:56:48 UTC (rev 4097)
+++ mgmt/newdata/mint/python/mint/vacuum.py 2010-07-11 20:58:49 UTC (rev 4098)
@@ -24,10 +24,12 @@
conn.set_isolation_level(0)
for pkg in self.model._packages:
- if pkg.sql_schema.type != "transient":
- for cls in pkg._classes:
- self.vacuum(cursor, cls)
+ for cls in pkg._classes:
+ if cls._storage == "none":
+ continue
+ self.vacuum(cursor, cls)
+
conn.set_isolation_level(level)
log.info("Vacuumed tables")
Modified: mgmt/newdata/rosemary/python/rosemary/model.py
===================================================================
--- mgmt/newdata/rosemary/python/rosemary/model.py 2010-07-09 20:56:48 UTC (rev 4097)
+++ mgmt/newdata/rosemary/python/rosemary/model.py 2010-07-11 20:58:49 UTC (rev 4098)
@@ -55,11 +55,17 @@
finally:
file.close()
- # XXX Change to load_elem, load_extended_elem
def load(self, elem):
- pkg = RosemaryPackage(self, elem.get("package"),
elem.get("type"))
- pkg.load(elem)
+ attr = elem.get("package")
+ if attr:
+ pkg = RosemaryPackage(self, attr, elem.get("type"))
+ pkg.load(elem)
+
+ for child in elem.findall("package"):
+ pkg = RosemaryPackage(self, child.get("name"), None)
+ pkg.load(child)
+
def extend(self, elem):
for child in elem.findall("package"):
pkg = self._packages_by_name[child.get("name")]
@@ -80,7 +86,7 @@
mangled = self._name.replace(".", "_")
if hasattr(self._model, mangled):
- raise Exception("Collision")
+ raise Exception("Collision: %s" % mangled)
setattr(self._model, mangled, self)
@@ -130,6 +136,8 @@
setattr(self._package, self._name, self)
+ self._storage = "database"
+
self._title = None
self._object_title = None
@@ -239,6 +247,10 @@
def load(self, elem, groups_by_name):
log.debug("Loading %s", self)
+ self._storage = elem.get("storage", "database")
+
+ assert self._storage in ("database", "none")
+
for child in elem.findall("group"):
name = child.get("name")