Skip to content

Commit

Permalink
Raise error or give warning if update_job_state() is called on empt…
Browse files Browse the repository at this point in the history
…y task collection.
  • Loading branch information
riccardomurri committed Jan 22, 2018
1 parent 89f489e commit c0c94de
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions gc3libs/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,15 @@ def _state(self):
]:
if stats[state] > 0:
return state
if self.tasks:
gc3libs.log.error(
"BUG! Non-empty task collection %r,"
" yet `self.stats()` returned zero...", self)
else:
gc3libs.log.warning(
"update_state() called on empty task collection %s"
" -- this operation makes no sense,"
" setting collection state to `UNKNOWN`", self)
return Run.State.UNKNOWN

def add(self, task):
Expand Down

0 comments on commit c0c94de

Please sign in to comment.