Skip to content

Commit

Permalink
Throw CalledProcessError -> STATE_QUEUE_ERROR on bad return values
Browse files Browse the repository at this point in the history
  • Loading branch information
Icemole committed Aug 19, 2024
1 parent 0631454 commit 4bd112f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
5 changes: 4 additions & 1 deletion sisyphus/aws_batch_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,10 @@ def task_state(self, task, task_id):
"""Return task state:"""
name = task.task_name()
task_name = escape_name(name, task_id)
queue_state = self.queue_state()
try:
queue_state = self.queue_state()
except subprocess.CalledProcessError:
return STATE_QUEUE_ERROR
qs = queue_state.get(task_name)

# task name should be uniq
Expand Down
9 changes: 5 additions & 4 deletions sisyphus/load_sharing_facility_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,7 @@ def queue_state(self):
try:
out, err, retval = self.system_call(system_command)
if retval != 0:
logging.warning(self._system_call_error_warn_msg(system_command))
time.sleep(gs.WAIT_PERIOD_QSTAT_PARSING)
continue
raise subprocess.CalledProcessError(self._system_call_error_warn_msg(system_command))
except subprocess.TimeoutExpired:
logging.warning(self._system_call_timeout_warn_msg(system_command))
time.sleep(gs.WAIT_PERIOD_SSH_TIMEOUT)
Expand Down Expand Up @@ -292,7 +290,10 @@ def task_state(self, task, task_id):
name = task.task_name()
name = escape_name(name).encode()
task_name = (name, task_id)
queue_state = self.queue_state()
try:
queue_state = self.queue_state()
except subprocess.CalledProcessError:
return STATE_QUEUE_ERROR
qs = queue_state[task_name]

# task name should be uniq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,7 @@ def queue_state(self):
try:
out, err, retval = self.system_call(system_command)
if retval != 0:
logging.warning(self._system_call_error_warn_msg(system_command))
time.sleep(gs.WAIT_PERIOD_QSTAT_PARSING)
continue
raise subprocess.CalledProcessError(self._system_call_error_warn_msg(system_command))
except subprocess.TimeoutExpired:
logging.warning(self._system_call_timeout_warn_msg(system_command))
time.sleep(gs.WAIT_PERIOD_SSH_TIMEOUT)
Expand Down Expand Up @@ -350,7 +348,10 @@ def task_state(self, task, task_id):
name = task.task_name()
name = self.process_task_name(name)
task_name = (name, task_id)
queue_state = self.queue_state()
try:
queue_state = self.queue_state()
except subprocess.CalledProcessError:
return STATE_QUEUE_ERROR
qs = queue_state[task_name]

# task name should be uniq
Expand Down
9 changes: 5 additions & 4 deletions sisyphus/son_of_grid_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,7 @@ def queue_state(self):
try:
out, err, retval = self.system_call(system_command)
if retval != 0:
logging.warning(self._system_call_error_warn_msg(system_command))
time.sleep(gs.WAIT_PERIOD_QSTAT_PARSING)
continue
raise subprocess.CalledProcessError(self._system_call_error_warn_msg(system_command))
except subprocess.TimeoutExpired:
logging.warning(self._system_call_timeout_warn_msg(system_command))
time.sleep(gs.WAIT_PERIOD_SSH_TIMEOUT)
Expand Down Expand Up @@ -416,7 +414,10 @@ def task_state(self, task, task_id):
name = task.task_name()
name = escape_name(name)
task_name = (name, task_id)
queue_state = self.queue_state()
try:
queue_state = self.queue_state()
except subprocess.CalledProcessError:
return STATE_QUEUE_ERROR
qs = queue_state[task_name]

# task name should be uniq
Expand Down

0 comments on commit 4bd112f

Please sign in to comment.