rhmessaging commits: r4226 - mgmt/newdata/cumin/python/cumin/inventory.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-08-26 09:32:59 -0400 (Thu, 26 Aug 2010)
New Revision: 4226
Modified:
mgmt/newdata/cumin/python/cumin/inventory/system.py
Log:
Fix for BZ 625060: Fixed sql for png slot vis mouseover popup
Modified: mgmt/newdata/cumin/python/cumin/inventory/system.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/inventory/system.py 2010-08-25 22:16:37 UTC (rev 4225)
+++ mgmt/newdata/cumin/python/cumin/inventory/system.py 2010-08-26 13:32:59 UTC (rev 4226)
@@ -89,9 +89,8 @@
super(SystemSlotMap, self).do_process(session)
system = self.system.get(session)
+ self.slots.add_where_expr(session, "\"System\" = '%s'", system.nodeName)
- self.slots.add_where_expr(session, "s.system = '%s'", system.nodeName)
-
def render_image_href(self, session):
system = self.system.get(session)
14 years, 4 months
rhmessaging commits: r4225 - in mgmt/newdata: cumin/etc and 2 other directories.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-08-25 18:16:37 -0400 (Wed, 25 Aug 2010)
New Revision: 4225
Modified:
mgmt/newdata/cumin/bin/cumin-web
mgmt/newdata/cumin/etc/cumin.conf
mgmt/newdata/cumin/python/cumin/config.py
mgmt/newdata/cumin/python/cumin/main.py
mgmt/newdata/wooly/python/wooly/pages.py
Log:
Fixed BZ 627350: Page update interval set to 10 seconds.
- added new [web] config value in cumin.conf of update_interval (in seconds)
Modified: mgmt/newdata/cumin/bin/cumin-web
===================================================================
--- mgmt/newdata/cumin/bin/cumin-web 2010-08-25 20:22:56 UTC (rev 4224)
+++ mgmt/newdata/cumin/bin/cumin-web 2010-08-25 22:16:37 UTC (rev 4225)
@@ -30,6 +30,7 @@
cumin.debug = opts.debug
cumin.user = values.web.user
+ cumin.update_interval = values.web.update_interval
cumin.check()
cumin.init()
Modified: mgmt/newdata/cumin/etc/cumin.conf
===================================================================
--- mgmt/newdata/cumin/etc/cumin.conf 2010-08-25 20:22:56 UTC (rev 4224)
+++ mgmt/newdata/cumin/etc/cumin.conf 2010-08-25 22:16:37 UTC (rev 4225)
@@ -10,6 +10,7 @@
# host: localhost
# port: 45672
# operator-email: [none]
+# update-interval: 10
[data]
# log-file: $CUMIN_HOME/log/data.log
Modified: mgmt/newdata/cumin/python/cumin/config.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/config.py 2010-08-25 20:22:56 UTC (rev 4224)
+++ mgmt/newdata/cumin/python/cumin/config.py 2010-08-25 22:16:37 UTC (rev 4225)
@@ -20,6 +20,9 @@
web = CuminConfigSection(self, "web")
web.log_file.default = os.path.join(self.home, "log", "web.log")
+ param = ConfigParameter(web, "update_interval", int)
+ param.default = 10
+
param = ConfigParameter(web, "host", str)
param.default = "localhost"
Modified: mgmt/newdata/cumin/python/cumin/main.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/main.py 2010-08-25 20:22:56 UTC (rev 4224)
+++ mgmt/newdata/cumin/python/cumin/main.py 2010-08-25 22:16:37 UTC (rev 4225)
@@ -52,6 +52,7 @@
self.user = None
self.operator_email = None
+ self.update_interval = 10
def check(self):
log.info("Checking %s", self)
Modified: mgmt/newdata/wooly/python/wooly/pages.py
===================================================================
--- mgmt/newdata/wooly/python/wooly/pages.py 2010-08-25 20:22:56 UTC (rev 4224)
+++ mgmt/newdata/wooly/python/wooly/pages.py 2010-08-25 22:16:37 UTC (rev 4225)
@@ -154,7 +154,10 @@
super(AjaxScript, self).__init__(app, name)
self.html_page = html_page
- self.interval = 3000
+ try:
+ self.interval = app.update_interval * 1000
+ except AttributeError:
+ self.interval = 10000
def do_render(self, session):
if self.get_widget_list(session):
14 years, 4 months
rhmessaging commits: r4224 - mgmt/newdata/cumin/model.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-08-25 16:22:56 -0400 (Wed, 25 Aug 2010)
New Revision: 4224
Modified:
mgmt/newdata/cumin/model/rosemary.xml
Log:
Adding index on System for slot vis
Modified: mgmt/newdata/cumin/model/rosemary.xml
===================================================================
--- mgmt/newdata/cumin/model/rosemary.xml 2010-08-25 17:40:38 UTC (rev 4223)
+++ mgmt/newdata/cumin/model/rosemary.xml 2010-08-25 20:22:56 UTC (rev 4224)
@@ -288,6 +288,7 @@
<class name="Slot">
<index name="Pool" attributes="Pool"/>
<index name="Name" attributes="Name"/>
+ <index name="System" attributes="System"/>
<property name="JobId">
<title>Job ID</title>
14 years, 4 months
rhmessaging commits: r4223 - mgmt/newdata/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-08-25 13:40:38 -0400 (Wed, 25 Aug 2010)
New Revision: 4223
Modified:
mgmt/newdata/mint/python/mint/session.py
Log:
Reenable user bindings
Modified: mgmt/newdata/mint/python/mint/session.py
===================================================================
--- mgmt/newdata/mint/python/mint/session.py 2010-08-25 17:34:41 UTC (rev 4222)
+++ mgmt/newdata/mint/python/mint/session.py 2010-08-25 17:40:38 UTC (rev 4223)
@@ -38,14 +38,11 @@
rcvObjects=self.app.update_enabled,
rcvEvents=False,
rcvHeartbeats=True,
- userBindings=False)
+ userBindings=True)
- # XXX temporarily disabled
- # userBindings=True)
+ for pkg in self.app.model._packages:
+ self.qmf_session.bindPackage(pkg._name)
- #for pkg in self.app.model._packages:
- # self.qmf_session.bindPackage(pkg._name)
-
for uri in self.broker_uris:
self.add_broker(uri)
14 years, 4 months
rhmessaging commits: r4222 - in mgmt/newdata/cumin/python/cumin: grid and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-08-25 13:34:41 -0400 (Wed, 25 Aug 2010)
New Revision: 4222
Modified:
mgmt/newdata/cumin/python/cumin/grid/job.py
mgmt/newdata/cumin/python/cumin/qmfadapter.py
Log:
Fix BZ 626972: Implement paging for qmf based tables.
Modified: mgmt/newdata/cumin/python/cumin/grid/job.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/job.py 2010-08-24 20:26:12 UTC (rev 4221)
+++ mgmt/newdata/cumin/python/cumin/grid/job.py 2010-08-25 17:34:41 UTC (rev 4222)
@@ -102,10 +102,14 @@
class JobSummariesAdapter(ObjectQmfAdapter):
def get_data(self, values, options):
+ first_index = options.offset
+ last_index = options.offset + options.limit
+
submission = values["obj"]
results = self.app.model.get_submission_job_summaries(submission)
rows = self.process_results(results)
- return rows
+ page = rows[first_index:last_index]
+ return page
def process_record(self, key, record):
field_data = list()
Modified: mgmt/newdata/cumin/python/cumin/qmfadapter.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/qmfadapter.py 2010-08-24 20:26:12 UTC (rev 4221)
+++ mgmt/newdata/cumin/python/cumin/qmfadapter.py 2010-08-25 17:34:41 UTC (rev 4222)
@@ -32,7 +32,7 @@
results.data = self.default
rows = self.process_results(results)
- return rows
+ return rows[options.offset:options.offset + options.limit]
def process_results(self, results):
""" take the dict response from the qmf call and return a list of lists """
14 years, 4 months
rhmessaging commits: r4221 - in mgmt/newdata/cumin: python/cumin and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-08-24 16:26:12 -0400 (Tue, 24 Aug 2010)
New Revision: 4221
Modified:
mgmt/newdata/cumin/bin/cumin-smoke-test
mgmt/newdata/cumin/python/cumin/model.py
Log:
For bz 626999, scope job summaries by the right id; repair cumin-smoke-test
Modified: mgmt/newdata/cumin/bin/cumin-smoke-test
===================================================================
--- mgmt/newdata/cumin/bin/cumin-smoke-test 2010-08-24 20:18:14 UTC (rev 4220)
+++ mgmt/newdata/cumin/bin/cumin-smoke-test 2010-08-24 20:26:12 UTC (rev 4221)
@@ -25,7 +25,7 @@
setup_logging(opts)
- cumin = Cumin(config.home, opts.broker, opts.database,
+ cumin = Cumin(config.home, opts.brokers, opts.database,
opts.host, opts.port)
cumin.user = values.web.user
@@ -106,8 +106,12 @@
print "Getting job summaries for", obj,
+ assert obj
+
summs = cumin.model.get_submission_job_summaries(obj)
+ assert summs is not None
+
print "-> [%i job summaries]" % len(summs)
#pprint(summs)
Modified: mgmt/newdata/cumin/python/cumin/model.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/model.py 2010-08-24 20:18:14 UTC (rev 4220)
+++ mgmt/newdata/cumin/python/cumin/model.py 2010-08-24 20:26:12 UTC (rev 4221)
@@ -96,12 +96,12 @@
try:
try:
- store = self.job_summaries_by_submission[submission._qmf_agent_id]
+ store = self.job_summaries_by_submission[submission._id]
except KeyError:
store = SubmissionJobSummaryStore(self, submission)
store.start_updates()
- self.job_summaries_by_submission[submission._qmf_agent_id] = store
+ self.job_summaries_by_submission[submission._id] = store
for i in range(5):
if store.data:
@@ -1974,6 +1974,6 @@
(completion, self.submission, "GetJobSummaries", ())
def delete(self):
- del self.model.job_summaries_by_submission[self.submission._qmf_agent_id]
+ del self.model.job_summaries_by_submission[self.submission._id]
super(SubmissionJobSummaryStore, self).delete()
14 years, 4 months
rhmessaging commits: r4220 - mgmt/newdata/cumin/python/cumin/grid.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-08-24 16:18:14 -0400 (Tue, 24 Aug 2010)
New Revision: 4220
Modified:
mgmt/newdata/cumin/python/cumin/grid/slot.py
Log:
Fix for BZ 626926: Set png slot vis order to System, Name.
Modified: mgmt/newdata/cumin/python/cumin/grid/slot.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/slot.py 2010-08-23 21:03:20 UTC (rev 4219)
+++ mgmt/newdata/cumin/python/cumin/grid/slot.py 2010-08-24 20:18:14 UTC (rev 4220)
@@ -48,6 +48,9 @@
self.where_exprs.default = exprs
+ def render_sql_order_by(self, session):
+ return "Order by \"System\",\"Name\""
+
class SlotView(CuminView):
def __init__(self, app, name, slot):
super(SlotView, self).__init__(app, name, slot)
14 years, 4 months
rhmessaging commits: r4219 - in mgmt/newdata/cumin/python/cumin: usergrid and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-08-23 17:03:20 -0400 (Mon, 23 Aug 2010)
New Revision: 4219
Modified:
mgmt/newdata/cumin/python/cumin/grid/main.py
mgmt/newdata/cumin/python/cumin/grid/submission.py
mgmt/newdata/cumin/python/cumin/usergrid/widgets.py
mgmt/newdata/cumin/python/cumin/usergrid/widgets.strings
Log:
For bz 618251
* Isolate the dag-specific submit logic in its own task
* Use a more narrowly focused dag submit form
* Correct some ad attributes for dag submit
Modified: mgmt/newdata/cumin/python/cumin/grid/main.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/main.py 2010-08-23 18:32:08 UTC (rev 4218)
+++ mgmt/newdata/cumin/python/cumin/grid/main.py 2010-08-23 21:03:20 UTC (rev 4219)
@@ -17,6 +17,7 @@
super(Module, self).__init__(app, name)
self.job_submit = JobSubmit(app)
+ self.dag_job_submit = DagJobSubmit(app)
self.vm_job_submit = VmJobSubmit(app)
# cls = app.model.com_redhat_grid.Job
Modified: mgmt/newdata/cumin/python/cumin/grid/submission.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/submission.py 2010-08-23 18:32:08 UTC (rev 4218)
+++ mgmt/newdata/cumin/python/cumin/grid/submission.py 2010-08-23 21:03:20 UTC (rev 4219)
@@ -89,6 +89,10 @@
self.links.add_child(link)
link = self.PoolSubmitLink \
+ (app, "dag_job_submit", app.grid.dag_job_submit)
+ self.links.add_child(link)
+
+ link = self.PoolSubmitLink \
(app, "vm_job_submit", app.grid.vm_job_submit)
self.links.add_child(link)
@@ -549,106 +553,104 @@
def render_title(self, session):
return "Memory"
-# class SubmissionDagAdd(SubmissionAdd):
-# def __init__(self, app, frame):
-# super(SubmissionDagAdd, self).__init__(app, frame)
+class DagJobSubmit(Task):
+ def __init__(self, app):
+ super(DagJobSubmit, self).__init__(app)
-# def get_add_form(self, app):
-# return SubmissionAddDagForm(app, self.name, self)
+ self.form = DagJobSubmitForm(app, self.name, self)
-# def get_title(self, session):
-# return "Create DAG submission"
+ def get_title(self, session, scheduler):
+ return "Submit DAG job"
-# class SubmissionAddDagForm(SubmissionAddForm):
-# def add_fields(self, app):
-# self.dag = self.DagField(app, "dag")
-# self.dag.input.size = 50
-# self.dag.required = True
-# self.dag.help = "DAG descriptor file location"
-# self.add_field(self.dag)
+ def do_invoke(self, session, scheduler, invoc,
+ description, dag_location, attrs={}):
+ ad = dict()
+
+ dag_dir, dag_file = os.path.split(dag_location)
-# self.requirements = self.RequirementsField(app, "requirements")
-# self.requirements.input.columns = 50
-# self.requirements.required = True
-# self.requirements.help = "Attributes controlling where and when " + \
-# "this submission will run"
-# self.add_field(self.requirements)
+ ad["Submission"] = description
+ ad["Owner"] = invoc.user.name
+ ad["Cmd"] = "/usr/bin/condor_dagman"
+ ad["Iwd"] = dag_dir
+ ad["JobUniverse"] = 7 # Scheduler
+ ad["Out"] = "%s.out" % dag_file
+ ad["Err"] = "%s.err" % dag_file
+ ad["UserLog"] = "%s.log" % dag_file
+ ad["Requirements"] = "True"
+ ad["RemoveKillSig"] = "SIGUSR1"
+ ad["OnExitRemove"] = "ExitSignal =?= 11 || " + \
+ "(ExitCode =!= UNDEFINED && ExitCode >= 0 && ExitCode <= 2)"
-# self.universe = Attribute(app, "universe")
-# self.universe.default = self.task.UNIVERSE["SCHEDULER"]
-# self.add_attribute(self.universe)
+ args = list()
+ args.append("-f")
+ args.append("-l .")
+ args.append("-Debug 3")
+ args.append("-Lockfile %s.lock" % dag_file)
+ args.append("-AutoRescue 1")
+ args.append("-DoRescueFrom 0")
+ args.append("-Dag %s" % dag_location)
-# self.attributes_ = self.DagAttributes(app, "attributes")
-# self.add_attribute(self.attributes_)
+ ad["Arguments"] = " ".join(args)
-# self.directory = self.Iwd(app, "directory")
-# self.add_attribute(self.directory)
+ vars = list()
+ vars.append("_CONDOR_DAGMAN_LOG=%s.out" % dag_file)
+ vars.append("_CONDOR_MAX_DAGMAN_LOG=0")
-# self.stdin = Attribute(app, "stdin")
-# self.add_attribute(self.stdin)
+ ad["Environment"] = " ".join(vars)
-# self.command = self.DagCommand(app, "command")
-# self.add_attribute(self.command)
+ descriptors = dict()
+ descriptors["Requirements"] = "com.redhat.grid.Expression"
+ descriptors["OnExitRemove"] = "com.redhat.grid.Expression"
-# self.stdout = self.StdoutField(app, "stdout")
-# self.stdout.input.size = 50
-# self.stdout.help = "Send process output to this file"
-# self.stdout.input.param.default = "diamond.dag.lib.out"
-# self.add_extra_field(self.stdout)
+ ad["!!descriptors"] = descriptors
-# self.stderr = self.StderrField(app, "stderr")
-# self.stderr.input.size = 50
-# self.stderr.help = "Send error output to this file"
-# self.stderr.input.param.default = "diamond.dag.lib.err"
-# self.add_extra_field(self.stderr)
+ invoc.description = "Submit DAG job '%s'" % description
-# self.usrlog = self.UsrLogField(app, "usrlog")
-# self.usrlog.input.size = 50
-# self.usrlog.help = "User Log File"
-# self.usrlog.input.param.default = "diamond.dag.dagman.log"
-# self.add_extra_field(self.usrlog)
+ self.qmf_call(invoc, scheduler, "SubmitJob", ad)
-# self.condor = self.CondorVersionField(app, "cv")
-# self.condor.required = True
-# self.condor.input.size = 50
-# self.condor.help = "Condor Version"
-# self.condor.input.param.default = "'7.4.3' 'Mar' '16' '2010' 'BuildID:' 'RH-7.4.3-0.5.el5' 'PRE-RELEASE'"
-# self.add_extra_field(self.condor)
+class DagJobSubmitForm(ObjectTaskForm):
+ def __init__(self, app, name, task):
+ cls = app.model.com_redhat_grid.Scheduler
+ super(DagJobSubmitForm, self).__init__(app, name, task, cls)
-# class DagField(StringField):
-# def render_title(self, session):
-# return "DAG"
+ self.pool_name = Attribute(app, "pool")
+ self.add_attribute(self.pool_name)
-# def get_base_path(self, session):
-# dag = self.get(session)
-# base, sep, file = rpartition(dag, "/")
-# return base
+ self.description = JobDescriptionField(app, "description")
+ self.add_field(self.description)
-# class Iwd(Attribute):
-# def get(self, session):
-# return self.widget.dag.get_base_path(session)
+ self.location = self.LocationField(app, "location")
+ self.location.help = "Path to the DAG job file"
+ self.location.required = True
+ self.location.input.size = 50
+ self.add_field(self.location)
-# class CondorVersionField(StringField):
-# def render_title(self, session):
-# return "Condor Version"
+ from scheduler import SchedulerSelectField # XXX
-# class DagCommand(Attribute):
-# def get(self, session):
-# dag = self.widget.dag.get(session)
-# condor = self.widget.condor.get(session)
-# args = """-f -l . -Debug 3 -Lockfile diamond.dag.lock -AutoRescue 1
-# -DoRescueFrom 0 -Dag diamond.dag -CsdVersion $CondorVersion:' %s ' %s"""
+ self.scheduler = SchedulerSelectField(app, "scheduler", self.pool_name)
+ self.add_extra_field(self.scheduler)
-# cmd = "/usr/bin/condor_dagman"
-# return "%s %s" % (cmd, args % (condor, dag))
+ self.attrs = JobAttributesField(app, "attrs")
+ self.add_extra_field(self.attrs)
-# class DagAttributes(Attribute):
-# def get(self, session):
+ def process_submit(self, session):
+ self.validate(session)
-# ads = list()
-# ads.append("getenv=True")
-# ads.append("remove_kill_sig=SIGUSR1")
-# ads.append("on_exit_remove=( ExitSignal =?= 11 || (ExitCode =!= UNDEFINED && ExitCode>=0 && ExitCode <= 2))")
-# ads.append("environment=_CONDOR_DAGMAN_LOG=diamond.dag.dagman.out;_CONDOR_MAX_DAGMAN_LOG=0")
+ attrs = self.attrs.parse_attributes(session)
-# return "\n".join(ads)
+ if not self.errors.get(session):
+ scheduler = self.scheduler.get(session)
+ description = self.description.get(session)
+ location = self.location.get(session)
+
+ self.task.invoke(session,
+ scheduler,
+ description,
+ location,
+ attrs=attrs)
+
+ self.task.exit_with_redirect(session, scheduler)
+
+ class LocationField(StringField):
+ def render_title(self, session):
+ return "DAG file location"
Modified: mgmt/newdata/cumin/python/cumin/usergrid/widgets.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/usergrid/widgets.py 2010-08-23 18:32:08 UTC (rev 4218)
+++ mgmt/newdata/cumin/python/cumin/usergrid/widgets.py 2010-08-23 21:03:20 UTC (rev 4219)
@@ -73,6 +73,9 @@
link = TaskLink(app, "job_submit", app.grid.job_submit)
self.add_child(link)
+ link = TaskLink(app, "dag_job_submit", app.grid.dag_job_submit)
+ self.add_child(link)
+
link = TaskLink(app, "vm_job_submit", app.grid.vm_job_submit)
self.add_child(link)
@@ -115,6 +118,9 @@
link = TaskLink(app, "job_submit", app.grid.job_submit)
self.links.add_child(link)
+ link = TaskLink(app, "dag_job_submit", app.grid.dag_job_submit)
+ self.links.add_child(link)
+
link = TaskLink(app, "vm_job_submit", app.grid.vm_job_submit)
self.links.add_child(link)
Modified: mgmt/newdata/cumin/python/cumin/usergrid/widgets.strings
===================================================================
--- mgmt/newdata/cumin/python/cumin/usergrid/widgets.strings 2010-08-23 18:32:08 UTC (rev 4218)
+++ mgmt/newdata/cumin/python/cumin/usergrid/widgets.strings 2010-08-23 21:03:20 UTC (rev 4219)
@@ -36,6 +36,7 @@
<ul style="list-style-type: none; margin: 1 0; padding: 0;">
<li>{job_submit}</li>
+ <li>{dag_job_submit}</li>
<li>{vm_job_submit}</li>
</ul>
</td>
14 years, 4 months
rhmessaging commits: r4218 - mgmt/newdata/cumin/python/cumin/grid.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-08-23 14:32:08 -0400 (Mon, 23 Aug 2010)
New Revision: 4218
Modified:
mgmt/newdata/cumin/python/cumin/grid/submission.py
Log:
* Added two new optional fields to vm submit: memory and extra
attributes
* Now that we're reusing the extra attrs field, moved its parsing
logic onto a common field class
Modified: mgmt/newdata/cumin/python/cumin/grid/submission.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/submission.py 2010-08-23 16:02:10 UTC (rev 4217)
+++ mgmt/newdata/cumin/python/cumin/grid/submission.py 2010-08-23 18:32:08 UTC (rev 4218)
@@ -108,6 +108,66 @@
def render_title(self, session):
return "Description"
+class JobAttributesField(MultilineStringField):
+ def __init__(self, app, name):
+ super(JobAttributesField, self).__init__(app, name)
+
+ self.input.columns = 50
+
+ def render_title(self, session):
+ return "Extra attributes"
+
+ def parse_attributes(self, session):
+ attrs = dict()
+
+ text = self.get(session)
+ text = text.strip()
+
+ for line in text.split("\n"):
+ line = line.strip()
+
+ if not line:
+ continue
+
+ try:
+ name, value = self.parse_attribute(line)
+ except:
+ error = FormError("Failed parsing attribute: %s" % line)
+ self.form.errors.get(session).append(error)
+
+ continue
+
+ attrs[name] = value
+
+ return attrs
+
+ def parse_attribute(self, line):
+ name, value = line.split("=", 1)
+
+ name = name.strip()
+ value = self.unmarshal_value(value.strip())
+
+ return name, value
+
+ def unmarshal_value(self, value):
+ if value.lower() == "true":
+ return True
+
+ if value.lower() == "false":
+ return False
+
+ try:
+ return int(value)
+ except ValueError:
+ pass
+
+ try:
+ return float(value)
+ except ValueError:
+ pass
+
+ return value
+
class JobSubmit(Task):
def __init__(self, app):
super(JobSubmit, self).__init__(app)
@@ -222,14 +282,13 @@
#self.options = self.OptionsField(app, "options")
#self.add_extra_field(self.options)
- self.attributes_ = self.AttributesField(app, "attributes")
- self.attributes_.input.columns = 50
- self.add_extra_field(self.attributes_)
+ self.attrs = JobAttributesField(app, "attrs")
+ self.add_extra_field(self.attrs)
def process_submit(self, session):
self.validate(session)
- attrs = self.parse_attributes(session)
+ attrs = self.attrs.parse_attributes(session)
if not self.errors.get(session):
scheduler = self.scheduler.get(session)
@@ -264,57 +323,6 @@
self.task.exit_with_redirect(session, scheduler)
- def parse_attributes(self, session):
- attrs = dict()
-
- text = self.attributes_.get(session)
- text = text.strip()
-
- for line in text.split("\n"):
- line = line.strip()
-
- if not line:
- continue
-
- try:
- name, value = self.parse_attribute(line)
- except:
- error = FormError("Failed parsing attribute: %s" % line)
- self.errors.get(session).append(error)
-
- continue
-
- attrs[name] = value
-
- return attrs
-
- def parse_attribute(self, line):
- name, value = line.split("=", 1)
-
- name = name.strip()
- value = self.unmarshal_value(value.strip())
-
- return name, value
-
- def unmarshal_value(self, value):
- if value.lower() == "true":
- return True
-
- if value.lower() == "false":
- return False
-
- try:
- return int(value)
- except ValueError:
- pass
-
- try:
- return float(value)
- except ValueError:
- pass
-
- return value
-
class TemplateField(FormField):
def __init__(self, app, name):
super(JobSubmitForm.TemplateField, self).__init__(app, name)
@@ -415,10 +423,6 @@
# def render_title(self, session):
# return "Use cloud"
- class AttributesField(MultilineStringField):
- def render_title(self, session):
- return "Extra attributes"
-
class VmJobSubmit(Task):
def __init__(self, app):
super(VmJobSubmit, self).__init__(app)
@@ -429,7 +433,7 @@
return "Submit VM job"
def do_invoke(self, session, scheduler, invoc,
- description, image, memory):
+ description, image, memory, attrs={}):
ad = dict()
# General
@@ -444,6 +448,9 @@
"JobVMMemory, " + \
"ImageSize / 1024.000000))"
+ for name, value in attrs.items():
+ ad[name] = value
+
# VM
ad["VMPARAM_Kvm_Disk"] = "%s:vda:w" % image
@@ -499,25 +506,38 @@
self.image.required = True
self.add_field(self.image)
+ self.memory = self.MemoryField(app, "memory")
+ self.memory.help = "In megabytes"
+ self.memory.required = True
+ self.memory.input.param.default = 512
+ self.add_extra_field(self.memory)
+
from scheduler import SchedulerSelectField # XXX
self.scheduler = SchedulerSelectField(app, "scheduler", self.pool_name)
self.scheduler.help = "Submit job to this schedd"
self.add_extra_field(self.scheduler)
+ self.attrs = JobAttributesField(app, "attrs")
+ self.add_extra_field(self.attrs)
+
def process_submit(self, session):
self.validate(session)
+ attrs = self.attrs.parse_attributes(session)
+
if not self.errors.get(session):
scheduler = self.scheduler.get(session)
description = self.description.get(session)
image = self.image.get(session)
+ memory = self.memory.get(session)
self.task.invoke(session,
scheduler,
description,
image,
- 512)
+ memory,
+ attrs=attrs)
self.task.exit_with_redirect(session, scheduler)
@@ -525,6 +545,10 @@
def render_title(self, session):
return "Image location"
+ class MemoryField(IntegerField):
+ def render_title(self, session):
+ return "Memory"
+
# class SubmissionDagAdd(SubmissionAdd):
# def __init__(self, app, frame):
# super(SubmissionDagAdd, self).__init__(app, frame)
14 years, 4 months
rhmessaging commits: r4217 - in mgmt/newdata/cumin: python/cumin/grid and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-08-23 12:02:10 -0400 (Mon, 23 Aug 2010)
New Revision: 4217
Modified:
mgmt/newdata/cumin/python/cumin/charts.py
mgmt/newdata/cumin/python/cumin/grid/pool.strings
mgmt/newdata/cumin/python/cumin/grid/slot.py
mgmt/newdata/cumin/python/cumin/grid/slot.strings
mgmt/newdata/cumin/resources/slots.swf
Log:
Changes for BZ 625213:
- Remove treemap and replace with State / Activity legend
- Highlight slots when State / Activity is moused over in legend
- Start with no systems / accounting groups expanded
- Add a back button when a system / accounting group is expanded
Modified: mgmt/newdata/cumin/python/cumin/charts.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/charts.py 2010-08-23 15:24:21 UTC (rev 4216)
+++ mgmt/newdata/cumin/python/cumin/charts.py 2010-08-23 16:02:10 UTC (rev 4217)
@@ -25,16 +25,45 @@
self.min_shadow = 14
self.surface = None
- def plot_dot(self, interior, width, height):
+ def plot_colored_rect(self, interior, width, height):
surface = ImageSurface(FORMAT_ARGB32, int(width), int(height))
cr = Context(surface)
cr.set_line_width(1)
cr.set_source_rgb(*interior)
- cr.rectangle(0, 0, width - 1, width - 1)
+ cr.rectangle(0, 0, width - 1, height - 1)
cr.fill()
return surface
+ def plot_state(self, state, width, height):
+ surface = ImageSurface(FORMAT_ARGB32, int(width), int(height))
+ cr = Context(surface)
+ cr.set_line_width(2)
+
+ self._plot_square(cr, (0.7, 0.7, 0.7), state, 0, 0, width, height)
+ return surface
+
+ def _plot_square(self, cr, colors, state, x, y, width, height):
+ cr.set_source_rgb(*colors)
+ #cr.move_to(x, y)
+ cr.rectangle(x, y, width - 1, height - 1)
+
+ if state == "Unclaimed": # leave empty
+ cr.stroke()
+ elif state == "Claimed": # solid fill
+ cr.fill()
+ elif state == "Owner": # diagonal line
+ cr.move_to(x, y)
+ cr.line_to(x + width - 1, y + height - 1)
+ cr.stroke()
+ elif state in ("Matched", "Preempting", "Preempting/Matched"): # triangle
+ cr.stroke()
+ cr.move_to(x + width - 1, y)
+ cr.line_to(x, y + height - 1)
+ cr.line_to(x + width - 1, y + height - 1)
+ cr.close_path()
+ cr.fill()
+
def plot_slots(self, slots, zl):
count = len(slots)
slot_size = self.slot_size(count, zl)
@@ -46,36 +75,18 @@
self.surface = ImageSurface(FORMAT_ARGB32, int(self.width), int(self.height))
cr = Context(self.surface)
cr.set_line_width(1)
- i = 0
+
for slot in slots:
- i = i + 1
interior, state = slot[:2]
- #if x + slot_size >= self.width:
if col >= self.cols:
x = 0
y = y + slot_size
col = 0
self.rows = self.rows + 1
- cr.set_source_rgb(*interior)
- cr.rectangle(x, y, slot_size - 1, slot_size - 1)
- cr.fill()
+ self._plot_square(cr, interior, state, x, y, slot_size, slot_size)
- # draw the state if the slots are big enough
- if state and slot_size >= self.min_font:
- cr.set_source_rgb(interior[0]/10, interior[1]/10, interior[2]/10)
- cr.select_font_face("verdana", FONT_SLANT_NORMAL, FONT_WEIGHT_BOLD)
- cr.set_font_size(slot_size/3)
- width, height = cr.text_extents(state[0])[2:4]
- dx = (slot_size / 2) - (width / 2)
- dy = (slot_size / 2) + (height / 2)
-
- if slot_size < self.min_sphere_size:
- cr.set_source_rgb(1,1,1)
- cr.move_to(x + dx, y + dy)
- cr.show_text(state[0])
-
x = x + slot_size
col = col + 1
return slot_size
Modified: mgmt/newdata/cumin/python/cumin/grid/pool.strings
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/pool.strings 2010-08-23 15:24:21 UTC (rev 4216)
+++ mgmt/newdata/cumin/python/cumin/grid/pool.strings 2010-08-23 16:02:10 UTC (rev 4217)
@@ -45,7 +45,7 @@
<h2>{title}</h2>
<div class="duration">{group_by}</div>
<div id="{id}_chart"></div>
- <div id="{id}ctrl_chart"></div>
+ {slot_legend}
</div>
</div>
<script type="text/javascript">
@@ -81,6 +81,9 @@
}
}
function vis_expand(parent) {
+ if (parent == null) {
+ parent = "None";
+ }
var chart = cumin.getFlashChart("{id}");
var src = chart.src;
var branch = wooly.session.branch(src);
@@ -88,13 +91,20 @@
chart.src = branch.marshal();
updatePoolSlotVis("{id}", "reload");
}
+ function vis_back() {
+ var chart = cumin.getFlashChart("{id}");
+ var src = chart.src;
+ var branch = wooly.session.branch(src);
+ if (typeof branch.expanded != "undefined")
+ delete branch.expanded;
+ chart.src = branch.marshal();
+ updatePoolSlotVis("{id}", "reload");
+ }
function vis_treemap_over(type, value) {
var chart = cumin.getFlashChart("{id}");
if (chart) {
if (typeof chart.highlight != "undefined")
chart.highlight(type, value);
- else
- wooly.log("highlight not definded for " + id);
}
}
function vis_treemap_out(type, value) {
@@ -102,8 +112,6 @@
if (chart) {
if (typeof chart.lowlight != "undefined")
chart.lowlight(type, value);
- else
- wooly.log("lowlight not definded for " + id);
}
}
function slot_vis(state, a, id, href) {
Modified: mgmt/newdata/cumin/python/cumin/grid/slot.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/slot.py 2010-08-23 15:24:21 UTC (rev 4216)
+++ mgmt/newdata/cumin/python/cumin/grid/slot.py 2010-08-23 16:02:10 UTC (rev 4217)
@@ -131,14 +131,18 @@
self.zoom_level.default = 1
self.add_parameter(self.zoom_level)
- self.dot = Parameter(app, "dot")
- self.add_parameter(self.dot)
+ self.activity = Parameter(app, "act")
+ self.add_parameter(self.activity)
+ self.state = Parameter(app, "state")
+ self.add_parameter(self.state)
+
self.json = Parameter(app, "json")
self.add_parameter(self.json)
self.expanded = Parameter(app, "expanded")
- self.expanded.default = "all"
+ self.expanded.default = ""
+ self.expanded.all = "all"
self.add_parameter(self.expanded)
group = Parameter(app, "agroup")
@@ -154,18 +158,29 @@
def get_cache_control(self, session):
return "no-cache"
- def render_dot(self, session, dot):
+ def render_activity(self, session, activity):
map = HeatMapChart()
- surface = map.plot_dot(self.interiors[dot], 12, 12)
+ surface = map.plot_colored_rect(self.interiors[activity], 12, 12)
writer = Writer()
surface.write_to_png(writer)
return writer.to_string()
+ def render_state(self, session, state):
+ map = HeatMapChart()
+ surface = map.plot_state(state, 12, 12)
+ writer = Writer()
+ surface.write_to_png(writer)
+ return writer.to_string()
+
def do_render(self, session):
- dot = self.dot.get(session)
- if dot:
- return self.render_dot(session, dot)
+ activity = self.activity.get(session)
+ if activity:
+ return self.render_activity(session, activity)
+ state = self.state.get(session)
+ if state:
+ return self.render_state(session, state)
+
if self.json.get(session):
return self.render_json(session)
@@ -242,7 +257,7 @@
expanded = self.expanded.get(session)
json = self.json.get(session)
leaves = True
- root.tree = self.treeify(records, range(slot_count), groups, 0,
+ (root.tree, root.back) = self.treeify(records, range(slot_count), groups, 0,
expanded, leaves, slot_count, json)
return "[%s]" % root.create()
@@ -252,9 +267,9 @@
# leaf
if level == len(groups):
if leaves:
- #for i in sorted(plist, key=lambda x:records[x]["name"]):
- for i in sorted(plist, key=lambda x:"%s%s%s" %
- (records[x]["Activity"], records[x]["State"], records[x]["Name"])):
+ #for i in sorted(plist, key=lambda x:"%s%s%s" %
+ # (records[x]["Activity"], records[x]["State"], records[x]["Name"])):
+ for i in sorted(plist, key=lambda x: records[x]["Name"]):
el = Element()
el.job_id = records[i]["JobId"] and records[i]["JobId"] or ""
el.activity = records[i]["Activity"] and records[i]["Activity"] or "Unknown"
@@ -264,17 +279,19 @@
el.name = "slot"
el.slot_id = records[i]["_id"]
level_list.append(el)
+ return (level_list, True)
else:
- # display summary info for all the slots under this grouping
- activityStates = self.get_activityStates(records, plist)
- for activityState in activityStates:
- el = Element()
- el.name = "slot_info"
- el.a_s = activityState
- el.count = activityStates[activityState]
- el.value = "%s.%s" % (records[plist[0]][groups[level-1]], activityState) # uid
- level_list.append(el)
- return level_list
+ if not expanded:
+ # display summary info for all the slots under this grouping
+ activityStates = self.get_activityStates(records, plist)
+ for activityState in activityStates:
+ el = Element()
+ el.name = "slot_info"
+ el.a_s = activityState
+ el.count = activityStates[activityState]
+ el.value = "%s.%s" % (records[plist[0]][groups[level-1]], activityState) # uid
+ level_list.append(el)
+ return (level_list, False)
# not a leaf
group = groups[level]
@@ -288,25 +305,19 @@
el.level = level
if level < len(groups):
if json == "slots":
- if expanded == self.expanded.default:
- # expand the 1st group if there are too many slots
- if slot_count >= self.max_visible_slots:
- if first:
- leaves = True
- first = False
- else:
- leaves = False
- else:
- leaves = True
- elif expanded == key:
+ if expanded == key:
leaves = True
+ elif expanded == "None" and key is None:
+ leaves = True
else:
leaves = False
- el.tree = self.treeify(records, level_dict[key], groups, level + 1,
+ (el.tree, el.back) = self.treeify(records, level_dict[key], groups, level + 1,
expanded, leaves, slot_count, json)
- level_list.append(el)
+
+ if len(el.tree):
+ level_list.append(el)
- return level_list
+ return (level_list, False)
def get_cached(self, session, zl):
filename = self.gen_filename(session)
@@ -364,24 +375,12 @@
def __init__(self, app, name):
super(SlotMap.SlotLegend, self).__init__(app, name)
- self.states = self.SlotStates(app, "slot_states")
+ self.states = SlotStates(app, "slot_states")
self.add_child(self.states)
self.activities = SlotActivities(app, "slot_activities")
self.add_child(self.activities)
- class SlotStates(ItemSet):
- states = ("Unclaimed", "Claimed", "Owner", "Matched", "Preempting")
-
- def do_get_items(self, session):
- return self.states
-
- def render_item_initial(self, session, state):
- return state[0]
-
- def render_item_title(self, session, state):
- return state
-
class SlotInfo(ItemSet):
display_names = {"JobId": ("Job ID", "", ""),
"System": ("System", "", ""),
@@ -450,6 +449,24 @@
def render_item_row_class(self, session, item):
return item[0][2] and "class='%s'" % item[0][2] or ""
+class SlotStates(ItemSet):
+ states = ("Unclaimed", "Claimed", "Owner", "Matched", "Preempting")
+
+ def do_get_items(self, session):
+ return self.states
+
+ def render_item_size(self, session, activity):
+ return 12
+
+ def render_item_title(self, session, state):
+ return state
+
+ def render_item_href(self, session, state):
+ params = list()
+ params.append("state=%s" % state)
+
+ return "poolslots.vis?" + ";".join(params)
+
class SlotActivities(ItemSet):
activities = (("Idle", "clear"),
("Busy", "green"),
@@ -460,18 +477,18 @@
("Retiring", "purple"),
("Unknown", "grey"))
+ def do_get_items(self, session):
+ return self.activities
+
def render_item_size(self, session, activity):
return 12
- def do_get_items(self, session):
- return self.activities
-
def render_item_title(self, session, activity):
return activity[0]
def render_item_href(self, session, activity):
params = list()
- params.append("dot=%s" % activity[0])
+ params.append("act=%s" % activity[0])
return "poolslots.vis?" + ";".join(params)
Modified: mgmt/newdata/cumin/python/cumin/grid/slot.strings
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/slot.strings 2010-08-23 15:24:21 UTC (rev 4216)
+++ mgmt/newdata/cumin/python/cumin/grid/slot.strings 2010-08-23 16:02:10 UTC (rev 4217)
@@ -1204,14 +1204,18 @@
div.slot_states ul, div.slot_activities ul {
padding: 0;
margin: 0;
- font-size: 0.8em;
+ font-size: 0.9em;
list-style: none;
}
-div.slot_states ul li span {
- font-weight: bold;
+div.slot_states li, div.slot_activities li {
+ padding-bottom: 0.25em;
}
+div.slot_states li:hover, div.slot_activities li:hover {
+ color: red;
+}
+
[SlotLegend.html]
<div class="slot_legend">
{slot_states}
@@ -1236,15 +1240,14 @@
</div>
[SlotStates.item_html]
-<li>
- <span>{item_initial}</span>
-
+<li onmouseover="vis_treemap_over('state', '{item_title}')" onmouseout="vis_treemap_out('state', '{item_title}')">
+ <img src="{item_href}" width="{item_size}" height="{item_size}" title="{item_title}" alt="{item_title}"/>
{item_title}
</li>
[SlotActivities.item_html]
-<li>
- <img src="{item_href}" width="{item_size}" height="{item_size}" alt="{item_title}"/>
+<li onmouseover="vis_treemap_over('activity', '{item_title}')" onmouseout="vis_treemap_out('activity', '{item_title}')">
+ <img src="{item_href}" width="{item_size}" height="{item_size}" title="{item_title}" alt="{item_title}"/>
{item_title}
</li>
Modified: mgmt/newdata/cumin/resources/slots.swf
===================================================================
(Binary files differ)
14 years, 4 months