rhmessaging commits: r4065 - in mgmt/newdata/cumin: python/cumin and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-07-02 09:14:36 -0400 (Fri, 02 Jul 2010)
New Revision: 4065
Modified:
mgmt/newdata/cumin/model/qmf.xml
mgmt/newdata/cumin/python/cumin/grid/job.py
mgmt/newdata/cumin/python/cumin/model.py
mgmt/newdata/cumin/python/cumin/objectselector.py
mgmt/newdata/cumin/python/cumin/objecttask.py
Log:
Add Hold/Release/Remove selection tasks for Jobs
Modified: mgmt/newdata/cumin/model/qmf.xml
===================================================================
--- mgmt/newdata/cumin/model/qmf.xml 2010-07-02 13:12:54 UTC (rev 4064)
+++ mgmt/newdata/cumin/model/qmf.xml 2010-07-02 13:14:36 UTC (rev 4065)
@@ -8,6 +8,7 @@
<property name="JobStatus" type="sstr"/>
<property name="EnteredCurrentStatus" type="absTime"/>
<property name="GlobalJobId" type="sstr"/>
+ <property name="JobId" type="sstr"/>
</class>
</schema>
Modified: mgmt/newdata/cumin/python/cumin/grid/job.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/job.py 2010-07-02 13:12:54 UTC (rev 4064)
+++ mgmt/newdata/cumin/python/cumin/grid/job.py 2010-07-02 13:14:36 UTC (rev 4065)
@@ -82,6 +82,19 @@
return branch.marshal()
+class JobAdModes(ModeSet):
+ def __init__(self, app, name):
+ super(JobAdModes, self).__init__(app, name)
+
+ self.viewer = JobAdsViewer(app, "viewer")
+ self.add_mode(self.viewer)
+
+ self.editor = JobAdsEditor(app, "editor")
+ self.add_mode(self.editor)
+
+ def render_title(self, session):
+ return "Attributes"
+
class JobView(ObjectView):
def add_details_tab(self):
pass
@@ -96,6 +109,19 @@
rows = self.process_results(results)
return rows
+ def process_record(self, record):
+ field_data = list()
+ for column in self.columns:
+ try:
+ val = record[column.name]
+ except KeyError:
+ if column.name == "JobId":
+ val = "%d.%d" % (record['ClusterId'], record['ProcId'])
+ else:
+ val = 0
+ field_data.append(val)
+ return field_data
+
def get_count(self, values):
submission = values["obj"]
results = self.app.model.get_submission_job_summaries(submission)
@@ -109,7 +135,7 @@
self.submission = submission
frame = "main.grid.pool.submission.job"
- self.job_id_col = self.JobIdColumn(app, "job", cls.GlobalJobId, cls._id, frame)
+ self.job_id_col = self.JobIdColumn(app, "job", cls.GlobalJobId, cls.JobId, frame)
self.add_column(self.job_id_col)
status_column = self.Status(app, "status", cls.JobStatus)
@@ -117,15 +143,24 @@
self.add_attribute_column(cls.Cmd)
- # CluserId.ProdId is the string needed to get the job ad from the jobserver
- self.proc_id_column = ObjectAttributeColumn(app, cls.ProcId.name, cls.ProcId)
- self.proc_id_column.visible = False
- self.add_column(self.proc_id_column)
+ self.job_id_column = ObjectAttributeColumn(app, cls.JobId.name, cls.JobId)
+ self.job_id_column.visible = False
+ self.add_column(self.job_id_column)
- self.cluster_id_column = ObjectAttributeColumn(app, cls.ClusterId.name, cls.ClusterId)
- self.cluster_id_column.visible = False
- self.add_column(self.cluster_id_column)
+ JobSelectionHold(app, self, "held")
+ JobSelectionRelease(app, self, "released")
+ JobSelectionRemove(app, self, "removed")
+ def init_ids(self, app, cls):
+ item = Parameter(app, "item")
+
+ self.ids = ListParameter(app, "selection", item)
+ self.add_parameter(self.ids)
+
+ self.checkbox_column = ObjectCheckboxColumn \
+ (app, "id", cls.JobId, self.ids)
+ self.add_column(self.checkbox_column)
+
def render_title(self, session):
return "Jobs"
@@ -141,11 +176,7 @@
class JobIdColumn(ObjectLinkColumn):
def render_cell_href(self, session, record):
- index = self.parent.cluster_id_column.field.index
- cluster_id = record[index]
- index = self.parent.proc_id_column.field.index
- proc_id = record[index]
- job_id = "%d.%d" % (cluster_id, proc_id)
+ job_id = record[self.parent.job_id_column.field.index]
frame = self.page.page_widgets_by_path[self.frame_path]
submission = self.parent.submission.get(session)
@@ -156,19 +187,108 @@
status = self.field.get_content(session, record)
return JobStatusInfo.get_status_string(status)
-class JobAdModes(ModeSet):
- def __init__(self, app, name):
- super(JobAdModes, self).__init__(app, name)
+class JobSelectionTask(SelectionTask):
+ def __init__(self, app, selector, verb):
+ super(JobSelectionTask, self).__init__(app, selector)
- self.viewer = JobAdsViewer(app, "viewer")
- self.add_mode(self.viewer)
+ self.form = JobSelectionTaskForm(app, self.name, self, verb)
+ self.method = None
- self.editor = JobAdsEditor(app, "editor")
- self.add_mode(self.editor)
+ def do_invoke(self, invoc, job_id, scheduler, reason):
+ assert self.method
- def render_title(self, session):
- return "Attributes"
+ action = QmfCall(self.app)
+ results = action.execute(scheduler, self.method, job_id, reason)
+ if results.error:
+ raise results.error
+
+ invoc.status_code = results.status
+ invoc.end()
+
+ def do_enter(self, session, osession):
+ submission = self.selector.submission.get(osession)
+ self.form.submission_id.set(session, submission._id)
+
+class JobSelectionHold(JobSelectionTask):
+ def __init__(self, app, selector, verb):
+ super(JobSelectionHold, self).__init__(app, selector, verb)
+
+ self.method = "HoldJob"
+
+ def get_title(self, session):
+ return "Hold"
+
+class JobSelectionRelease(JobSelectionTask):
+ def __init__(self, app, selector, verb):
+ super(JobSelectionRelease, self).__init__(app, selector, verb)
+
+ self.method = "ReleaseJob"
+
+ def get_title(self, session):
+ return "Release"
+
+class JobSelectionRemove(JobSelectionTask):
+ def __init__(self, app, selector, verb):
+ super(JobSelectionRemove, self).__init__(app, selector, verb)
+
+ self.method = "RemoveJob"
+
+ def get_title(self, session):
+ return "Remove"
+
+class JobSelectionTaskForm(SelectionTaskForm):
+ def __init__(self, app, name, task, verb):
+ super(JobSelectionTaskForm, self).__init__(app, name, task)
+
+ self.submission_id = IntegerParameter(app, "sub")
+ self.add_parameter(self.submission_id)
+
+ self.content = ReasonField(app, "fields")
+ self.replace_child(self.content)
+
+ self.verb = verb
+
+ def get_selection(self, session):
+ ids = self.ids.get(session)
+
+ selection = list(ids)
+ self.selection.set(session, selection)
+
+ def get_reason(self, session, verb):
+ """ returns <verb> by username[: <user input reason>] """
+ reason = self.content.get(session)
+ if reason:
+ reason = [reason]
+ user = session.client_session.attributes["login_session"].user
+
+ verb_by = "%s by %s" % (verb, user.name)
+ reason.insert(0, verb_by)
+ return ": ".join(reason)
+
+ def process_submit(self, session):
+ selection = self.selection.get(session)
+ reason = self.get_reason(session, self.verb)
+
+ scheduler = self.get_scheduler(session)
+
+ self.task.invoke(session, selection, scheduler, reason)
+ self.task.exit_with_redirect(session)
+
+ def get_scheduler(self, session):
+ submission_id = self.submission_id.get(session)
+ cls = self.app.model.com_redhat_grid.Submission
+ submission = cls.get_object_by_id(session.cursor, submission_id)
+
+ cls = self.app.model.com_redhat_grid.JobServer
+ job_server = cls.get_object(session.cursor, _id=submission._jobserverRef_id)
+
+ pool = job_server.Pool
+ machine = job_server.Machine
+
+ cls = self.app.model.com_redhat_grid.Scheduler
+ return cls.get_object(session.cursor, Pool=pool, Machine=machine)
+
class JobAdsSet(PropertySet):
types = {0: "expression",
1: "integer",
@@ -618,7 +738,7 @@
def __init__(self, app, name, task, verb):
super(JobActionForm, self).__init__(app, name, task)
- self.reason = self.ReasonField(app, "reason")
+ self.reason = ReasonField(app, "reason")
self.add_field(self.reason)
self.job_id = Parameter(app, "job_id")
@@ -649,9 +769,9 @@
self.task.invoke(session, scheduler, job_id, reason)
self.task.exit_with_redirect(session)
- class ReasonField(StringField):
- def render_title(self, session):
- return "Reason"
+class ReasonField(StringField):
+ def render_title(self, session):
+ return "Reason"
class JobHold(JobAction):
def __init__(self, app, frame):
Modified: mgmt/newdata/cumin/python/cumin/model.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/model.py 2010-07-02 13:12:54 UTC (rev 4064)
+++ mgmt/newdata/cumin/python/cumin/model.py 2010-07-02 13:14:36 UTC (rev 4065)
@@ -75,12 +75,12 @@
try:
try:
- store = self.limits_by_negotiator[negotiator]
+ store = self.limits_by_negotiator[negotiator._qmf_agent_id]
except KeyError:
store = NegotiatorLimitStore(self, negotiator)
store.start_updates()
- self.limits_by_negotiator[negotiator] = store
+ self.limits_by_negotiator[negotiator._qmf_agent_id] = store
sleep(1)
Modified: mgmt/newdata/cumin/python/cumin/objectselector.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/objectselector.py 2010-07-02 13:12:54 UTC (rev 4064)
+++ mgmt/newdata/cumin/python/cumin/objectselector.py 2010-07-02 13:14:36 UTC (rev 4065)
@@ -78,15 +78,8 @@
def __init__(self, app, name, cls, adapter=None):
super(ObjectSelector, self).__init__(app, name, cls, adapter)
- item = IntegerParameter(app, "item")
+ self.init_ids(app, cls)
- self.ids = ListParameter(app, "selection", item)
- self.add_parameter(self.ids)
-
- self.checkbox_column = ObjectCheckboxColumn \
- (app, "id", cls._id, self.ids)
- self.add_column(self.checkbox_column)
-
self.switches = ObjectSelectorSwitches(app, "switches")
self.add_child(self.switches)
@@ -109,6 +102,16 @@
self.buttons.add_child(button)
button.init()
+ def init_ids(self, app, cls):
+ item = IntegerParameter(app, "item")
+
+ self.ids = ListParameter(app, "selection", item)
+ self.add_parameter(self.ids)
+
+ self.checkbox_column = ObjectCheckboxColumn \
+ (app, "id", cls._id, self.ids)
+ self.add_column(self.checkbox_column)
+
class ObjectAttributeColumn(DataTableColumn):
def __init__(self, app, name, attr):
super(ObjectAttributeColumn, self).__init__(app, name, None)
Modified: mgmt/newdata/cumin/python/cumin/objecttask.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/objecttask.py 2010-07-02 13:12:54 UTC (rev 4064)
+++ mgmt/newdata/cumin/python/cumin/objecttask.py 2010-07-02 13:14:36 UTC (rev 4065)
@@ -337,6 +337,10 @@
self.replace_child(self.content)
def do_process(self, session):
+ self.get_selection(session)
+ super(SelectionTaskForm, self).do_process(session)
+
+ def get_selection(self, session):
selection = list()
self.selection.set(session, selection)
@@ -345,8 +349,6 @@
item = self.cls.get_object_by_id(session.cursor, id)
selection.append(item)
- super(SelectionTaskForm, self).do_process(session)
-
def process_submit(self, session):
selection = self.selection.get(session)
14 years
rhmessaging commits: r4064 - mgmt/newdata/cumin/python/cumin/grid.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-07-02 09:12:54 -0400 (Fri, 02 Jul 2010)
New Revision: 4064
Modified:
mgmt/newdata/cumin/python/cumin/grid/negotiator.py
Log:
Fix argument count to do_enter
Modified: mgmt/newdata/cumin/python/cumin/grid/negotiator.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/negotiator.py 2010-07-01 19:39:08 UTC (rev 4063)
+++ mgmt/newdata/cumin/python/cumin/grid/negotiator.py 2010-07-02 13:12:54 UTC (rev 4064)
@@ -94,7 +94,7 @@
# is user
if "." in data[0] and self.user_task:
href = "%s" % self.user_task.get_href \
- (session, (self.negotiator.get(session), data[0]))
+ (session, (self.negotiator.get(session)))
else:
href = self.task.get_href(session)
content = data[2][2] and str(data[1]) or "NOT SET"
@@ -883,7 +883,7 @@
self.form = NegotiatorLimitSetForm(module.app, self.name, self)
- def do_enter(self, session):
+ def do_enter(self, session, osession):
pass
#self.form.negotiator.set(session, limit[0])
#self.form.limit_name.set(session, limit[1])
@@ -895,11 +895,13 @@
action = SetLimit(self.app)
result = action.execute(negotiator, name, max)
if result.error:
- invoc.exception(invod, result.error)
- else:
- action = QmfCall(self.app)
- action.execute(negotiator, "Reconfig")
+ raise result.error
+ invoc.status_code = invoc.status
+
+ action = QmfCall(self.app)
+ action.execute(negotiator, "Reconfig")
+
invoc.end()
class NegotiatorGroupTask(ObjectTask):
@@ -910,8 +912,13 @@
# don't call self.qmf_call here since we need to
# wait for the response before making the next QMF call
action = QmfCall(self.app)
- action.execute(negotiator, "SetRawConfig", group, value)
+ result = action.execute(negotiator, "SetRawConfig", group, value)
+ if result.error:
+ raise result.error
+ invoc.status_code = invoc.status
+ invoc.end()
+
def reconfig(self, negotiator):
action = QmfCall(self.app)
action.execute(negotiator, "Reconfig")
@@ -962,12 +969,12 @@
return "Edit static quota"
class NegotiatorUserTask(NegotiatorGroupTask):
- def do_enter(self, session):
+ def do_enter(self, session, osession):
#try:
# negotiator, group = ng
#except:
# raise Exception("Must supply group for user forms")
- super(NegotiatorUserTask, self).do_enter(session)
+ super(NegotiatorUserTask, self).do_enter(session, osession)
#self.form.group.set(session, group)
class NegotiatorUserPrioFactor(NegotiatorUserTask):
14 years
rhmessaging commits: r4063 - store/trunk/cpp/lib/jrnl.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2010-07-01 15:39:08 -0400 (Thu, 01 Jul 2010)
New Revision: 4063
Modified:
store/trunk/cpp/lib/jrnl/jcntl.cpp
Log:
Corrected ::usleep() constants which were reversed in loop
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2010-07-01 17:13:04 UTC (rev 4062)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2010-07-01 19:39:08 UTC (rev 4063)
@@ -440,9 +440,9 @@
get_wr_events();
while (fcntlp->wr_fhdr_aio_outstanding())
{
- if (++cnt > AIO_CMPL_SLEEP)
+ if (++cnt > MAX_AIO_CMPL_SLEEPS)
throw jexception(jerrno::JERR_JCNTL_AIOCMPLWAIT, "jcntl", "fhdr_wr_sync");
- ::usleep(MAX_AIO_CMPL_SLEEPS);
+ ::usleep(AIO_CMPL_SLEEP);
get_wr_events();
}
}
14 years
rhmessaging commits: r4062 - mgmt/newdata/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-07-01 13:13:04 -0400 (Thu, 01 Jul 2010)
New Revision: 4062
Modified:
mgmt/newdata/mint/python/mint/model.py
mgmt/newdata/mint/python/mint/update.py
Log:
Defer adding objects to the cache until after the update completes; this fixes several data exceptions (the 'unexpectedly null columns')
Modified: mgmt/newdata/mint/python/mint/model.py
===================================================================
--- mgmt/newdata/mint/python/mint/model.py 2010-06-30 20:32:30 UTC (rev 4061)
+++ mgmt/newdata/mint/python/mint/model.py 2010-07-01 17:13:04 UTC (rev 4062)
@@ -93,10 +93,11 @@
except RosemaryNotFound:
obj._id = cls.get_new_id(cursor)
- self.objects_by_id[object_id] = obj
-
return obj
+ def add_object(self, obj):
+ self.objects_by_id[obj._qmf_object_id] = obj
+
def delete_object(self, object_id):
try:
del self.objects_by_id[object_id]
Modified: mgmt/newdata/mint/python/mint/update.py
===================================================================
--- mgmt/newdata/mint/python/mint/update.py 2010-06-30 20:32:30 UTC (rev 4061)
+++ mgmt/newdata/mint/python/mint/update.py 2010-07-01 17:13:04 UTC (rev 4062)
@@ -274,6 +274,8 @@
raise
obj._sync_time = now
+
+ self.add_object(obj)
else:
stats.dropped += 1
@@ -300,6 +302,9 @@
return cls, obj
+ def add_object(self, obj):
+ self.agent.add_object(obj)
+
def process_headers(self, obj, columns):
table = obj._class.sql_table
14 years