Skip to content

Commit e9f00e3

Browse files
committed
check the task_dictionary before calling qstat and check qstat if it comes up pending.
this avoids calling qstat (and qacct) over and over again when we have alread populated it into the task dictionary.
1 parent bffaef4 commit e9f00e3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

nipype/pipeline/plugins/sge.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,14 @@ def print_dictionary(self):
276276

277277
def is_job_pending(self, task_id):
278278
task_id = int(task_id) # Ensure that it is an integer
279-
self._run_qstat("checking job pending status {0}".format(task_id), False)
280279
# Check if the task is in the dictionary first (before running qstat)
281280
if task_id in self._task_dictionary:
282281
# Trust the cache, only False if state='zombie'
283282
job_is_pending = self._task_dictionary[task_id].is_job_state_pending()
283+
# Double check pending jobs in case of change (since we don't check at the beginning)
284+
if job_is_pending:
285+
self._run_qstat("checking job pending status {0}".format(task_id), False)
286+
job_is_pending = self._task_dictionary[task_id].is_job_state_pending()
284287
else:
285288
self._run_qstat("checking job pending status {0}".format(task_id), True)
286289
if task_id in self._task_dictionary:

0 commit comments

Comments
 (0)