Skip to content

Commit

Permalink
SessionBasedDaemon: make redo command reload task from persistent s…
Browse files Browse the repository at this point in the history
…torage.

This ensures we pick up any changes done externally before resubmission.
  • Loading branch information
riccardomurri committed Jun 6, 2018
1 parent 88ea1d7 commit b4a5fa7
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions gc3libs/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2211,15 +2211,21 @@ def redo(self, jobid=None, from_stage=None):
"Daemon requested to redo job %s from stage %s",
jobid, from_stage)

# ensure we re-read task from the DB to pick up updates
try:
task = self._parent._controller.find_task_by_id(jobid)
gc3libs.log.debug(
"Daemon unloading job %s (will re-load soon)", jobid)
self._parent._controller.remove(task)
except KeyError:
try:
task = self._parent.session.load(jobid, add=True)
except Exception as err:
return (
"ERROR: Could not load task `%s` from session: %s"
% (jobid, err))
pass

try:
task = self._parent.session.load(jobid, add=True)
except Exception as err:
return (
"ERROR: Could not load task `%s` from session: %s"
% (jobid, err))

try:
self._parent._controller.redo(task, *args)
Expand Down

0 comments on commit b4a5fa7

Please sign in to comment.