Author: tmckay
Date: 2012-02-03 14:18:49 +0000 (Fri, 03 Feb 2012)
New Revision: 5202
Modified:
trunk/cumin/python/cumin/grid/job.py
Log:
Compare the set of running jobs in a submission and the selection list on a
"remove" operation.
If all of the running jobs are targeted for removal, return to the submission list.
(tweak to change originally made in 4679)
BZ783139
Modified: trunk/cumin/python/cumin/grid/job.py
===================================================================
--- trunk/cumin/python/cumin/grid/job.py 2012-02-02 22:05:32 UTC (rev 5201)
+++ trunk/cumin/python/cumin/grid/job.py 2012-02-03 14:18:49 UTC (rev 5202)
@@ -342,19 +342,27 @@
def get_title(self, session):
return "Remove"
+ def _get_running_jobs(self, osession):
+ running = []
+ records = self.selector.get_qmf_results(osession)
+ if records and hasattr(records, "data"):
+ for rec in records.data:
+ if "JobStatus" in rec and rec["JobStatus"] ==
"RUNNING":
+ running.append("%s.%s" %
(rec["ClusterId"],rec["ProcId"]))
+ return running
+
def do_enter(self, session, osession):
super(JobSelectionRemove, self).do_enter(session, osession)
- # if all the jobs in this submission are to be removed
- # return to the submission list instead of this submission page
- selected_count = len(self.selector.table.ids.get(osession))
- total = self.selector.table.get_count(osession)
- if selected_count == total:
+ # if all the running jobs in this submission are to be removed
+ # return to the submission list instead of this submission page.
+ running = self._get_running_jobs(osession)
+ selected = self.selector.table.ids.get(osession)
+ if len(set(running) - set(selected)) == 0:
nsession = osession.branch()
frame = self.selector.frame.parent
frame.view.show(nsession)
submission_list_url = nsession.marshal()
-
self.form.return_url.set(session, submission_list_url)
class JobObjectSelectorTaskForm(ObjectSelectorTaskForm):
Show replies by date