Skip to content

Commit

Permalink
Little code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardomurri committed Apr 27, 2018
1 parent 0066ed3 commit fff6526
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions gc3libs/workflow.py
Expand Up @@ -210,7 +210,7 @@ def fetch_output(self, output_dir=None,
task_output_dir = task.output_dir
else:
task_output_dir = task.persistent_id
# XXX: uses a feature from `os.path.join`: if the second
# NOTE: uses a feature from `os.path.join`: if the second
# path is absolute, the first path is discarded and the
# second one is returned unchanged
task_output_dir = os.path.join(coll_output_dir, task_output_dir)
Expand All @@ -220,14 +220,13 @@ def fetch_output(self, output_dir=None,
overwrite,
changed_only,
**extra_args)
# if any sub-task is not yet TERMINATED, return the base
# output directory for the collection...
for task in self.tasks:
if task.execution.state != Run.State.TERMINATED:
return coll_output_dir
# ...otherwise set the state to TERMINATED
self.execution.state = Run.State.TERMINATED
self.changed = True
# NOTE: `all()` of an empty list comprehension is ``True``
all_tasks_terminated = all(
task.execution.state == Run.State.TERMINATED
for task in self.tasks
)
if all_tasks_terminated:
self.execution.state = Run.State.TERMINATED
return coll_output_dir

def free(self):
Expand Down

0 comments on commit fff6526

Please sign in to comment.