From e8912ae17b63ae1e8c0d1ad07fbeb4ec786215dc Mon Sep 17 00:00:00 2001 From: Yves Bastide Date: Sat, 28 Apr 2018 17:36:31 +0200 Subject: [PATCH] Post-rebase fixes Signed-off-by: Yves Bastide --- simpleflow/history.py | 1 + simpleflow/swf/executor.py | 27 +++++---------------------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/simpleflow/history.py b/simpleflow/history.py index d92860ef0..252405ceb 100644 --- a/simpleflow/history.py +++ b/simpleflow/history.py @@ -130,6 +130,7 @@ def lambda_functions(self): """ return self._lambda_functions + @property def signaled_workflows(self): """ :return: signaled workflows diff --git a/simpleflow/swf/executor.py b/simpleflow/swf/executor.py index 9c0c2634f..56acdd666 100644 --- a/simpleflow/swf/executor.py +++ b/simpleflow/swf/executor.py @@ -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'], @@ -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 @@ -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: