rhmessaging commits: r2582 - mgmt/trunk/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2008-10-02 18:58:09 -0400 (Thu, 02 Oct 2008)
New Revision: 2582
Modified:
mgmt/trunk/mint/python/mint/__init__.py
mgmt/trunk/mint/python/mint/update.py
Log:
handle orphan updates -- ie, child objects whose parents' info hasn't been received yet -- by deferring their insertion/creation until the parent's info is received; also, datetime hack to temporarily deal with condor absTime attribs
Modified: mgmt/trunk/mint/python/mint/__init__.py
===================================================================
--- mgmt/trunk/mint/python/mint/__init__.py 2008-10-02 18:16:42 UTC (rev 2581)
+++ mgmt/trunk/mint/python/mint/__init__.py 2008-10-02 22:58:09 UTC (rev 2582)
@@ -301,6 +301,10 @@
self.connCloseListener = None
self.__lock = RLock()
+ # map containing updateObjects that have a missing parent dependency, for deferred insertion
+ # (missing_class, missing_id.first, missing_id.second) -> [updateObject, ..., updateObject]
+ self.orphanObjectMap = dict()
+
self.updateThread = update.ModelUpdateThread(self)
assert MintModel.staticInstance is None
Modified: mgmt/trunk/mint/python/mint/update.py
===================================================================
--- mgmt/trunk/mint/python/mint/update.py 2008-10-02 18:16:42 UTC (rev 2581)
+++ mgmt/trunk/mint/python/mint/update.py 2008-10-02 22:58:09 UTC (rev 2582)
@@ -6,7 +6,9 @@
from qpid.management import managementClient
from struct import unpack
from schema import schemaReservedWordsMap
+from sqlobject import DateTimeCol, TimestampCol, Col
+import types
import mint
log = logging.getLogger("mint.update")
@@ -67,12 +69,13 @@
return package, cls
-def processAttributes(conn, attrs, cls):
+def processAttributes(conn, attrs, cls, model, updateObj):
attrs.pop("id")
if "connectionRef" in attrs:
attrs["clientConnectionRef"] = attrs.pop("connectionRef")
+ orphan = False
for name in attrs.keys():
rename = schemaReservedWordsMap.get(name)
@@ -94,19 +97,35 @@
try:
attrs[attrname] = conn.getObject(othercls, id)
except KeyError:
- log.info("Referenced object %s '%s' not found" % \
- (clsname, id))
+ log.info("Referenced object %s '%s' not found by key '%s'" % (clsname, id, attrname))
+ except mint.ObjectNotFound:
+ if not orphan:
+ log.info("Referenced object %s '%s' not found, deferring creation of orphan object" % (clsname, id))
+ # store object in orphan map, will be picked up later when parent info is received
+ if (clsname, id.first, id.second) not in model.orphanObjectMap:
+ model.orphanObjectMap[(clsname, id.first, id.second)] = set()
+ model.orphanObjectMap[(clsname, id.first, id.second)].add(updateObj)
+ orphan = True
else:
log.error("Class '%s' not found" % clsname)
elif not hasattr(cls, name):
# Remove attrs that we don't have in our schema
-
log.debug("Class '%s' has no field '%s'" % (cls.__name__, name))
-
del attrs[name]
+ #XXX FIX -- TODO when converting to new API, will lookup attribute type in schema representation
+ elif name in ("DaemonStartTime", "EnteredCurrentActivity", "EnteredCurrentState", "JobStart",
+ "LastBenchmark", "LastFetchWorkCompleted", "LastFetchWorkSpawned", "LastPeriodicCheckpoint",
+ "MyCurrentTime", "QDate", "JobQueueBirthdate", "MonitorSelfTime") \
+ and (type(attrs[name]) is types.LongType or type(attrs[name]) is types.IntType or attrs[name] == 0):
+ attrs[name] = datetime.fromtimestamp(attrs[name]/1000000000)
+ elif name.endswith("Time") and type(attrs[name]) is types.IntType and attrs[name] == 0:
+ attrs[name] = datetime.fromtimestamp(attrs[name])
+ #XXX FIX -- TODO when converting to new API, will lookup attribute type in schema representation
+ if orphan:
+ return None
+ else:
+ return attrs
- return attrs
-
def getStatsClass(cls):
return getattr(mint, cls.__name__ + "Stats")
@@ -153,7 +172,10 @@
attrs = dict(self.props)
id = attrs["id"]
- processAttributes(self.conn, attrs, cls)
+ if processAttributes(self.conn, attrs, cls, model, self) == None:
+ # object is orphan, a parent dependency was not found;
+ # insertion in db is deferred until parent info is received
+ return
# XXX move these down to the try/except
@@ -186,6 +208,13 @@
if obj.deletionTime:
log.debug("%s(%i) marked deleted", cls.__name__, obj.id)
+ if (cls.__name__, id.first, id.second) in model.orphanObjectMap:
+ # this object is the parent of orphan objects in the map, re-enqueue for insertion
+ orphanObjects = model.orphanObjectMap.pop((cls.__name__, id.first, id.second))
+ for orphanObj in orphanObjects:
+ model.updateThread.enqueue(orphanObj)
+ log.info("Inserted %d orphan objects whose creation had been deferred" % (len(orphanObjects)))
+
# XXX refactor this to take advantage of the get/create logic
# above
if isinstance(obj, mint.Broker) and obj.managedBroker:
@@ -217,10 +246,6 @@
args = ("stats", self.conn.id, cls, len(self.stats))
log.info("Processing %-8s %-16s %-16s %3i" % args)
- # XXX temporary work around for absTime type size problem
- if cls == "mrggrid.slot":
- return
-
try:
pkg, cls = unmarshalClassInfo(self.classInfo)
except UnknownClassException, e:
@@ -233,7 +258,10 @@
obj = self.conn.getObject(cls, id)
statscls = getStatsClass(cls)
- processAttributes(self.conn, attrs, statscls)
+ if processAttributes(self.conn, attrs, statscls, model, self) == None:
+ # object is orphan, a parent dependency was not found;
+ # insertion in db is deferred until parent info is received
+ return
attrs["recTime"] = datetime.fromtimestamp(self.timestamps[0]/1000000000)
16 years, 2 months
rhmessaging commits: r2581 - mgmt/trunk/etc.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-10-02 14:16:42 -0400 (Thu, 02 Oct 2008)
New Revision: 2581
Modified:
mgmt/trunk/etc/devel.profile
Log:
Make the bash devel.profile a little more bashy
Modified: mgmt/trunk/etc/devel.profile
===================================================================
--- mgmt/trunk/etc/devel.profile 2008-10-02 18:16:14 UTC (rev 2580)
+++ mgmt/trunk/etc/devel.profile 2008-10-02 18:16:42 UTC (rev 2581)
@@ -3,11 +3,11 @@
# PYTHONPATH
-if test -z "$DEVEL_ORIGINAL_PYTHONPATH"; then
+test -z "$DEVEL_ORIGINAL_PYTHONPATH" && {
export DEVEL_ORIGINAL_PYTHONPATH="$PYTHONPATH"
-fi
+}
-pypath="$DEVEL_HOME"/lib/python:"$HOME"/lib/python:"$DEVEL_ORIGINAL_PYTHONPATH"
+pypath="${DEVEL_HOME}/lib/python:${HOME}/lib/python:${DEVEL_ORIGINAL_PYTHONPATH}"
for module in $DEVEL_MODULES; do
pypath="$DEVEL_HOME"/"$module"/python:"$pypath"
@@ -17,17 +17,17 @@
# PATH
-if test -z "$DEVEL_ORIGINAL_PATH"; then
+test -z "$DEVEL_ORIGINAL_PATH" && {
export DEVEL_ORIGINAL_PATH="$PATH"
-fi
+}
-path="$DEVEL_HOME"/bin:"$DEVEL_ORIGINAL_PATH"
+path="${DEVEL_HOME}/bin:${DEVEL_ORIGINAL_PATH}"
for module in $DEVEL_MODULES; do
- path="$DEVEL_HOME"/"$module"/bin:"$path"
+ path="$DEVEL_HOME/${module}/bin:${path}"
done
export PATH="$path"
# cumin test instance
-export CUMIN_HOME="$DEVEL_HOME"/cumin-test-0
+export CUMIN_HOME="${DEVEL_HOME}/cumin-test-0"
16 years, 2 months
rhmessaging commits: r2580 - mgmt/trunk/etc.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-10-02 14:16:14 -0400 (Thu, 02 Oct 2008)
New Revision: 2580
Added:
mgmt/trunk/etc/devel.profile.zsh
Log:
Add a zsh devel profile from mattf
Added: mgmt/trunk/etc/devel.profile.zsh
===================================================================
--- mgmt/trunk/etc/devel.profile.zsh (rev 0)
+++ mgmt/trunk/etc/devel.profile.zsh 2008-10-02 18:16:14 UTC (rev 2580)
@@ -0,0 +1,33 @@
+export DEVEL_HOME="$PWD"
+export DEVEL_MODULES="mint cumin basil parsley"
+
+# PYTHONPATH
+
+if [[ -z "$DEVEL_ORIGINAL_PYTHONPATH" ]] {
+ export DEVEL_ORIGINAL_PYTHONPATH="$PYTHONPATH"
+}
+
+pypath="$DEVEL_HOME/lib/python:$HOME/lib/python:$DEVEL_ORIGINAL_PYTHONPATH"
+
+foreach module in `echo $DEVEL_MODULES`
+ pypath="$DEVEL_HOME/$module/python:$pypath"
+end
+
+export PYTHONPATH="$pypath"
+
+# PATH
+
+if [[ -z "$DEVEL_ORIGINAL_PATH" ]] {
+ export DEVEL_ORIGINAL_PATH="$PATH"
+}
+
+path="$DEVEL_HOME/bin:$DEVEL_ORIGINAL_PATH"
+
+foreach module in `echo $DEVEL_MODULES`
+ path="$DEVEL_HOME/$module/bin:$path"
+end
+
+export PATH="$path"
+
+# cumin test instance
+export CUMIN_HOME="$DEVEL_HOME/cumin-test-0"
16 years, 2 months
rhmessaging commits: r2579 - mgmt/trunk/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-10-02 13:57:41 -0400 (Thu, 02 Oct 2008)
New Revision: 2579
Modified:
mgmt/trunk/mint/python/mint/schemaparser.py
Log:
Add int32 to the types
Modified: mgmt/trunk/mint/python/mint/schemaparser.py
===================================================================
--- mgmt/trunk/mint/python/mint/schemaparser.py 2008-10-02 15:07:59 UTC (rev 2578)
+++ mgmt/trunk/mint/python/mint/schemaparser.py 2008-10-02 17:57:41 UTC (rev 2579)
@@ -19,6 +19,7 @@
self.dataTypesMap = dict()
self.dataTypesMap["objId"] = "ForeignKey"
self.dataTypesMap["uuid"] = "BLOBCol"
+ self.dataTypesMap["int32"] = "IntCol"
self.dataTypesMap["uint8"] = self.dataTypesMap["hilo8"] = self.dataTypesMap["count8"] = self.dataTypesMap["mma8"] = "SmallIntCol"
self.dataTypesMap["uint16"] = self.dataTypesMap["hilo16"] = self.dataTypesMap["count16"] = self.dataTypesMap["mma16"] = "SmallIntCol"
self.dataTypesMap["uint32"] = self.dataTypesMap["hilo32"] = self.dataTypesMap["count32"] = self.dataTypesMap["mma32"] = self.dataTypesMap["atomic32"] = "IntCol"
16 years, 2 months
rhmessaging commits: r2578 - store/trunk/cpp/lib/jrnl.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-10-02 11:07:59 -0400 (Thu, 02 Oct 2008)
New Revision: 2578
Modified:
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/rfc.cpp
store/trunk/cpp/lib/jrnl/rfc.hpp
store/trunk/cpp/lib/jrnl/rrfc.cpp
store/trunk/cpp/lib/jrnl/rrfc.hpp
Log:
Bugfix for intermittent RHEL4 segfault in test _st_read.increasing_interval_delayed_read; also removed unnecessary virtual declarators in class rfc for functions that are not subclassed.
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-10-02 14:36:02 UTC (rev 2577)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-10-02 15:07:59 UTC (rev 2578)
@@ -419,7 +419,7 @@
_stop_flag = true;
if (!_readonly_flag)
flush(block_till_aio_cmpl);
- _rrfc.reset();
+ _rrfc.finalize();
}
u_int16_t
@@ -567,7 +567,7 @@
}
::usleep(AIO_CMPL_SLEEP);
}
- _wrfc.reset();
+ _wrfc.wr_reset();
resout = RHM_IORES_SUCCESS;
data_tok::write_state ws = dtp->wstate();
return ws == data_tok::ENQ_PART || ws == data_tok::DEQ_PART || ws == data_tok::ABORT_PART ||
Modified: store/trunk/cpp/lib/jrnl/rfc.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rfc.cpp 2008-10-02 14:36:02 UTC (rev 2577)
+++ store/trunk/cpp/lib/jrnl/rfc.cpp 2008-10-02 15:07:59 UTC (rev 2578)
@@ -51,7 +51,7 @@
}
void
-rfc::reset()
+rfc::finalize()
{
unset_findex();
_nfiles = 0;
Modified: store/trunk/cpp/lib/jrnl/rfc.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rfc.hpp 2008-10-02 14:36:02 UTC (rev 2577)
+++ store/trunk/cpp/lib/jrnl/rfc.hpp 2008-10-02 15:07:59 UTC (rev 2578)
@@ -63,11 +63,11 @@
* | +-->+===+ --+ _curr_fc == 0
* | | |
* | | |
- * | reset() initialize()
+ * | finalize() initialize()
* | | |
* | | |
* | +-- +===+<--+ _nfiles > 0
- * reset() | | Inactive: _fc_arr != 0 T F
+ * finalize() | | Inactive: _fc_arr != 0 T F
* | +-->+===+ --+ _curr_fc == 0
* | | |
* | | |
@@ -114,7 +114,7 @@
* \brief Reset the controller to Uninitialized state, usually called when the journal is stopped. Once called,
* initialize() must be called to reuse an instance.
*/
- virtual void reset();
+ virtual void finalize();
/**
* /brief Check initialization state: true = Not Uninitialized, ie Initialized or Active; false = Uninitialized.
@@ -165,13 +165,13 @@
// Convenience access methods to current file controller
// Note: Do not call when not in active state
- virtual inline u_int32_t enqcnt() const { return _curr_fc->enqcnt(); }
- virtual inline u_int32_t incr_enqcnt() { return _curr_fc->incr_enqcnt(); }
- virtual inline u_int32_t incr_enqcnt(u_int16_t fid) { return _fc_arr[fid]->incr_enqcnt(); }
- virtual inline u_int32_t add_enqcnt(u_int32_t a) { return _curr_fc->add_enqcnt(a); }
- virtual inline u_int32_t add_enqcnt(u_int16_t fid, u_int32_t a) { return _fc_arr[fid]->add_enqcnt(a); }
- virtual inline u_int32_t decr_enqcnt(u_int16_t fid) { return _fc_arr[fid]->decr_enqcnt(); }
- virtual inline u_int32_t subtr_enqcnt(u_int16_t fid, u_int32_t s) { return _fc_arr[fid]->subtr_enqcnt(s); }
+ inline u_int32_t enqcnt() const { return _curr_fc->enqcnt(); }
+ inline u_int32_t incr_enqcnt() { return _curr_fc->incr_enqcnt(); }
+ inline u_int32_t incr_enqcnt(u_int16_t fid) { return _fc_arr[fid]->incr_enqcnt(); }
+ inline u_int32_t add_enqcnt(u_int32_t a) { return _curr_fc->add_enqcnt(a); }
+ inline u_int32_t add_enqcnt(u_int16_t fid, u_int32_t a) { return _fc_arr[fid]->add_enqcnt(a); }
+ inline u_int32_t decr_enqcnt(u_int16_t fid) { return _fc_arr[fid]->decr_enqcnt(); }
+ inline u_int32_t subtr_enqcnt(u_int16_t fid, u_int32_t s) { return _fc_arr[fid]->subtr_enqcnt(s); }
virtual inline u_int32_t subm_cnt_dblks() const = 0;
virtual inline std::size_t subm_offs() const = 0;
Modified: store/trunk/cpp/lib/jrnl/rrfc.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rrfc.cpp 2008-10-02 14:36:02 UTC (rev 2577)
+++ store/trunk/cpp/lib/jrnl/rrfc.cpp 2008-10-02 15:07:59 UTC (rev 2578)
@@ -57,10 +57,10 @@
}
void
-rrfc::reset()
+rrfc::finalize()
{
unset_findex();
- rfc::reset();
+ rfc::finalize();
}
void
Modified: store/trunk/cpp/lib/jrnl/rrfc.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rrfc.hpp 2008-10-02 14:36:02 UTC (rev 2577)
+++ store/trunk/cpp/lib/jrnl/rrfc.hpp 2008-10-02 15:07:59 UTC (rev 2578)
@@ -65,11 +65,11 @@
* | +-->+===+ --+ _curr_fc == 0
* | | | _fh == -1
* | | |
- * | reset() initialize()
+ * | finalize() initialize()
* | | |
* | | |
* | +-- +===+<--+ _nfiles > 0
- * reset() | | Inactive: _fc_arr != 0 T F
+ * finalize() | | Inactive: _fc_arr != 0 T F
* | +-->+===+ --+ _curr_fc == 0
* | | | _fh == -1
* | | |
@@ -110,7 +110,7 @@
* \brief Reset the controller to Uninitialized state, usually called when the journal is stopped. Once called,
* initialize() must be called to reuse an instance.
*/
- void reset();
+ void finalize();
/**
* /brief Opens the file handle for reading a particular fid. Moves to state open.
16 years, 2 months
rhmessaging commits: r2577 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-10-02 10:36:02 -0400 (Thu, 02 Oct 2008)
New Revision: 2577
Modified:
mgmt/trunk/cumin/python/cumin/__init__.py
Log:
Fix reference to logger
Modified: mgmt/trunk/cumin/python/cumin/__init__.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/__init__.py 2008-10-02 12:45:59 UTC (rev 2576)
+++ mgmt/trunk/cumin/python/cumin/__init__.py 2008-10-02 14:36:02 UTC (rev 2577)
@@ -226,8 +226,7 @@
log.addHandler(handler)
mlog.addHandler(handler)
except IOError, e:
- clog.warn("Can't write to log file '%s': %s" % \
- (self.log_file, e))
+ log.warn("Can't write to log file '%s': %s" % (self.log_file, e))
if self.debug:
level = logging.DEBUG
16 years, 2 months
rhmessaging commits: r2576 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-10-02 08:45:59 -0400 (Thu, 02 Oct 2008)
New Revision: 2576
Modified:
mgmt/trunk/cumin/python/cumin/job.py
Log:
Remove print debug
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2008-10-02 12:45:25 UTC (rev 2575)
+++ mgmt/trunk/cumin/python/cumin/job.py 2008-10-02 12:45:59 UTC (rev 2576)
@@ -1040,7 +1040,6 @@
self.is_group = GroupSwitch(app, "group")
self.add_child(self.is_group)
- print "XXX"
self.job_tab = JobTab(app, "jobtab")
self.add_child(self.job_tab)
16 years, 2 months
rhmessaging commits: r2575 - mgmt/trunk/cumin/bin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-10-02 08:45:25 -0400 (Thu, 02 Oct 2008)
New Revision: 2575
Modified:
mgmt/trunk/cumin/bin/cumin-load-demo-data
Log:
Also fix the demo data loader for the changed Cumin ctor
Modified: mgmt/trunk/cumin/bin/cumin-load-demo-data
===================================================================
--- mgmt/trunk/cumin/bin/cumin-load-demo-data 2008-10-02 12:30:32 UTC (rev 2574)
+++ mgmt/trunk/cumin/bin/cumin-load-demo-data 2008-10-02 12:45:25 UTC (rev 2575)
@@ -25,7 +25,7 @@
if config.debug:
config.prt()
- cumin = Cumin(config.home, config.data, config.spec)
+ cumin = Cumin(config)
cumin.check()
cumin.init()
16 years, 2 months
rhmessaging commits: r2574 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-10-02 08:30:32 -0400 (Thu, 02 Oct 2008)
New Revision: 2574
Added:
mgmt/trunk/cumin/python/cumin/slot.py
mgmt/trunk/cumin/python/cumin/slot.strings
Modified:
mgmt/trunk/cumin/python/cumin/job.py
mgmt/trunk/cumin/python/cumin/system.py
Log:
Add a SlotSet, and stub in system jobs and slots; the data isn't properly hooked up yet
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2008-10-02 11:57:19 UTC (rev 2573)
+++ mgmt/trunk/cumin/python/cumin/job.py 2008-10-02 12:30:32 UTC (rev 2574)
@@ -11,7 +11,6 @@
from parameters import *
from formats import *
from util import *
-from system import *
strings = StringCatalog(__file__)
log = logging.getLogger("cumin.job")
@@ -233,6 +232,7 @@
def show_jobs_remove(self, session):
return self.frame.show_jobs_remove(session)
+from system import SystemFrame, SystemSet
class JobGroupFrame(CuminFrame):
def __init__(self, app, name):
@@ -1040,6 +1040,7 @@
self.is_group = GroupSwitch(app, "group")
self.add_child(self.is_group)
+ print "XXX"
self.job_tab = JobTab(app, "jobtab")
self.add_child(self.job_tab)
Added: mgmt/trunk/cumin/python/cumin/slot.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/slot.py (rev 0)
+++ mgmt/trunk/cumin/python/cumin/slot.py 2008-10-02 12:30:32 UTC (rev 2574)
@@ -0,0 +1,23 @@
+import logging
+
+from wooly import *
+from wooly.widgets import *
+from wooly.forms import *
+from wooly.resources import *
+from wooly.tables import *
+
+from widgets import *
+
+strings = StringCatalog(__file__)
+log = logging.getLogger("cumin.job")
+
+class SlotSet(CuminTable):
+ def __init__(self, app, name):
+ super(SlotSet, self).__init__(app, name)
+
+ col = self.Name(app, "name")
+ self.add_column(col)
+
+ class Name(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Name"
Added: mgmt/trunk/cumin/python/cumin/slot.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/slot.strings (rev 0)
+++ mgmt/trunk/cumin/python/cumin/slot.strings 2008-10-02 12:30:32 UTC (rev 2574)
@@ -0,0 +1,15 @@
+[SlotSet.sql]
+select
+ s.id,
+ s.name
+from slot as s
+left outer join slot_stats as c on c.id = s.stats_curr_id
+left outer join slot_stats as p on p.id = s.stats_prev_id
+{sql_where}
+{sql_orderby}
+{sql_limit}
+
+[SlotSet.count_sql]
+select count(*)
+from slot as s
+{sql_where}
Modified: mgmt/trunk/cumin/python/cumin/system.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.py 2008-10-02 11:57:19 UTC (rev 2573)
+++ mgmt/trunk/cumin/python/cumin/system.py 2008-10-02 12:30:32 UTC (rev 2574)
@@ -1,65 +1,90 @@
-from mint import *
-from wooly import *
-from wooly.widgets import *
-
-from widgets import *
-from parameters import *
-from formats import *
-from util import *
-
-strings = StringCatalog(__file__)
-
-class SystemSet(CuminTable, Form):
- def __init__(self, app, name):
- super(SystemSet, self).__init__(app, name)
-
- self.ids = CheckboxIdColumn(app, "id", self)
- self.add_column(self.ids)
- self.add_form_parameter(self.ids)
-
- col = self.NameColumn(app, "name")
- self.add_column(col)
- self.set_default_column(col)
-
- def render_title(self, session, *args):
- count = System.select().count()
- return "Systems %s" % fmt_count(count)
-
- class NameColumn(SqlTableColumn):
- def render_title(self, session, data):
- return "Name"
-
- def render_content(self, session, data):
- system = Identifiable(data["id"])
- branch = session.branch()
- self.frame.show_system(branch, system).show_view(branch)
- return fmt_olink(branch, system, name=data["name"])
-
-class SystemFrame(CuminFrame):
- def __init__(self, app, name):
- super(SystemFrame, self).__init__(app, name)
-
- self.object = SystemParameter(app, "id")
- self.add_parameter(self.object)
-
- view = SystemView(app, "view")
- self.add_mode(view)
- self.set_view_mode(view)
-
-class SystemStatus(CuminStatus):
- pass
-
-class SystemView(CuminView):
- def __init__(self, app, name):
- super(SystemView, self).__init__(app, name)
-
- summary = CuminSummary(app, "summary")
- self.add_child(summary)
-
- status = SystemStatus(app, "status")
- self.add_child(status)
-
- self.__tabs = TabbedModeSet(app, "tabs")
- self.add_child(self.__tabs)
-
- self.__tabs.add_tab(CuminDetails(app, "details"))
+from mint import *
+from wooly import *
+from wooly.widgets import *
+
+from widgets import *
+from parameters import *
+from formats import *
+from util import *
+
+strings = StringCatalog(__file__)
+
+class SystemSet(CuminTable, Form):
+ def __init__(self, app, name):
+ super(SystemSet, self).__init__(app, name)
+
+ self.ids = CheckboxIdColumn(app, "id", self)
+ self.add_column(self.ids)
+ self.add_form_parameter(self.ids)
+
+ col = self.NameColumn(app, "name")
+ self.add_column(col)
+ self.set_default_column(col)
+
+ def render_title(self, session, *args):
+ count = System.select().count()
+ return "Systems %s" % fmt_count(count)
+
+ class NameColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Name"
+
+ def render_content(self, session, data):
+ system = Identifiable(data["id"])
+ branch = session.branch()
+ self.frame.show_system(branch, system).show_view(branch)
+ return fmt_olink(branch, system, name=data["name"])
+
+class SystemFrame(CuminFrame):
+ def __init__(self, app, name):
+ super(SystemFrame, self).__init__(app, name)
+
+ self.object = SystemParameter(app, "id")
+ self.add_parameter(self.object)
+
+ view = SystemView(app, "view")
+ self.add_mode(view)
+ self.set_view_mode(view)
+
+class SystemStatus(CuminStatus):
+ pass
+
+class SystemView(CuminView):
+ def __init__(self, app, name):
+ super(SystemView, self).__init__(app, name)
+
+ summary = CuminSummary(app, "summary")
+ self.add_child(summary)
+
+ status = SystemStatus(app, "status")
+ self.add_child(status)
+
+ self.__tabs = TabbedModeSet(app, "tabs")
+ self.add_child(self.__tabs)
+
+ self.__tabs.add_tab(SystemJobSet(app, "jobs"))
+ self.__tabs.add_tab(SystemSlotSet(app, "slots"))
+ self.__tabs.add_tab(CuminDetails(app, "details"))
+
+from job import JobSet
+
+class SystemJobSet(JobSet):
+ def render_title(self, session, *args):
+ sql = "1 = 1" # XXX
+ return "Grid Jobs %s" % fmt_count(Job.select(sql).count())
+
+ def render_sql_where(self, session, *args):
+ phase_sql = self.get_phase_sql(session)
+ sql = "1 = 1" # XXX
+ return "where %s" % " and ".join([phase_sql, sql])
+
+from slot import SlotSet
+
+class SystemSlotSet(SlotSet):
+ def render_title(self, session, *args):
+ sql = "1 = 1" # XXX
+ return "Grid Slots %s" % fmt_count(Slot.select(sql).count())
+
+ def render_sql_where(self, session, *args):
+ sql = "1 = 1" # XXX
+ return "where %s" % sql
16 years, 2 months
rhmessaging commits: r2573 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-10-02 07:57:19 -0400 (Thu, 02 Oct 2008)
New Revision: 2573
Modified:
mgmt/trunk/cumin/python/cumin/__init__.py
mgmt/trunk/cumin/python/cumin/tools.py
Log:
Pass CuminConfig directly to Cumin
Modified: mgmt/trunk/cumin/python/cumin/__init__.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/__init__.py 2008-10-02 10:43:31 UTC (rev 2572)
+++ mgmt/trunk/cumin/python/cumin/__init__.py 2008-10-02 11:57:19 UTC (rev 2573)
@@ -24,13 +24,20 @@
log = logging.getLogger("cumin")
class Cumin(Application):
- def __init__(self, home, data_uri, spec_path):
+ def __init__(self, config):
super(Cumin, self).__init__()
- self.home = home
+ self.config = config
+
+ if self.config.debug:
+ self.enable_debug()
+
+ #home, data_uri, spec_path):
+
+ self.home = self.config.home
self.add_resource_dir(os.path.join(self.home, "resources"))
- self.model = CuminModel(self, data_uri, spec_path)
+ self.model = CuminModel(self, self.config.data, self.config.spec)
self.broker_connect_thread = BrokerConnectThread(self.model)
def closeListener(*args):
Modified: mgmt/trunk/cumin/python/cumin/tools.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/tools.py 2008-10-02 10:43:31 UTC (rev 2572)
+++ mgmt/trunk/cumin/python/cumin/tools.py 2008-10-02 11:57:19 UTC (rev 2573)
@@ -374,7 +374,7 @@
if self.config.debug:
self.config.prt()
- app = Cumin(self.config.home, self.config.data, self.config.spec)
+ app = Cumin(self.config)
try:
app.check()
@@ -439,11 +439,8 @@
if self.config.debug:
self.config.prt()
- app = Cumin(self.config.home, self.config.data, self.config.spec)
+ app = Cumin(self.config)
- if self.config.debug:
- app.enable_debug()
-
try:
app.check()
except Exception, e:
@@ -510,11 +507,8 @@
if self.config.debug:
self.config.prt()
- app = Cumin(self.config.home, self.config.data, self.config.spec)
+ app = Cumin(self.config)
- if self.config.debug:
- app.enable_debug()
-
try:
app.check()
except Exception, e:
16 years, 2 months