Skip to content

Commit

Permalink
Update swf.executor: ensure to schedule again activities that failed …
Browse files Browse the repository at this point in the history
…to be scheduled
  • Loading branch information
Greg Leclercq committed Mar 20, 2015
1 parent 205441f commit 61b6970
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions simpleflow/swf/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ def _get_future_from_activity_event(self, event):
activity_type.name,
self.domain.name))
return None
logger.info('failed to schedule {}: {}'.format(
event['activity_type']['name'],
event['cause'],
))
return None
elif state == 'started':
future._state = futures.RUNNING
elif state == 'completed':
Expand Down Expand Up @@ -239,6 +244,8 @@ def resume(self, task, *args, **kwargs):
future = futures.Future() # return a pending future.

if self._open_activity_count == constants.MAX_OPEN_ACTIVITY_COUNT:
logger.warning('limit of {} open activities reached'.format(
constants.MAX_OPEN_ACTIVITY_COUNT))
raise exceptions.ExecutionBlocked

return future
Expand Down Expand Up @@ -303,6 +310,10 @@ def replay(self, history):
try:
result = self.run_workflow(*args, **kwargs)
except exceptions.ExecutionBlocked:
logger.info('{} open activities ({} decisions)'.format(
self._open_activity_count,
len(self._decisions),
))
return self._decisions, {}
except exceptions.TaskException, err:
reason = 'Workflow execution error in task {}: "{}"'.format(
Expand Down

0 comments on commit 61b6970

Please sign in to comment.