Skip to content

Commit

Permalink
Post-rebase fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Yves Bastide <[email protected]>
  • Loading branch information
ybastide committed Jun 30, 2018
1 parent bb62f67 commit e8912ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
1 change: 1 addition & 0 deletions simpleflow/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def lambda_functions(self):
"""
return self._lambda_functions

@property
def signaled_workflows(self):
"""
:return: signaled workflows
Expand Down
27 changes: 5 additions & 22 deletions simpleflow/swf/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ def _get_future_from_lambda_function_event(self, event):
elif state == 'started':
future.set_running()
elif state == 'completed':
future.set_finished(json_loads_or_raw(event['result']))
future.set_finished(format.decode(event['result']))
elif state == 'failed':
future.set_exception(exceptions.TaskFailed(
name=event['id'],
Expand Down Expand Up @@ -872,30 +872,12 @@ def resume_lambda_function(self, a_task, event):

return future

def resume_lambda_function(self, a_task, event):
"""
Resume a child workflow.
:param a_task:
:type a_task: LambdaTask
:param event:
:type event: dict
:return:
:rtype: simpleflow.futures.Future
"""
future = self._get_future_from_lambda_function_event(event)

if future.finished and future.exception:
raise future.exception

return future

def schedule_task(self, a_task, task_list=None):
"""
Let a task schedule itself.
If too many decisions are in flight, add a timer decision and raise ExecutionBlocked.
:param a_task:
:type a_task: SwfTask
:type a_task: ActivityTask | WorkflowTask | SignalTask [ MarkerTask [ TimerTask | CancelTimerTask | LambdaFunctionTask # noqa
:param task_list:
:type task_list: Optional[str]
:raise: exceptions.ExecutionBlocked if too many decisions waiting
Expand Down Expand Up @@ -1488,8 +1470,9 @@ def get_event_details(self, event_type, event_name):

def handle_cancel_requested(self):
decision = swf.models.decision.WorkflowExecutionDecision()
is_current_decision = self._history.completed_decision_id < self._history.cancel_requested_id
should_cancel = self._workflow.should_cancel(self._history)
history = self._history
is_current_decision = history.completed_decision_id < history.cancel_requested_id
should_cancel = self._workflow.should_cancel(history)
if not should_cancel:
return None # ignore cancel
if is_current_decision:
Expand Down

0 comments on commit e8912ae

Please sign in to comment.