Skip to content

Commit aa25d37

Browse files
committed
Post-rebase fixes
Signed-off-by: Yves Bastide <yves@botify.com>
1 parent 089642f commit aa25d37

File tree

2 files changed

+10
-25
lines changed

2 files changed

+10
-25
lines changed

simpleflow/history.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ def lambda_functions(self):
129129
"""
130130
return self._lambda_functions
131131

132+
@property
132133
def signaled_workflows(self):
133134
"""
134135
:return: signaled workflows

simpleflow/swf/executor.py

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ def _get_future_from_lambda_function_event(self, event):
382382
elif state == 'started':
383383
future.set_running()
384384
elif state == 'completed':
385-
future.set_finished(json_loads_or_raw(event['result']))
385+
future.set_finished(format.decode(event['result']))
386386
elif state == 'failed':
387387
future.set_exception(exceptions.TaskFailed(
388388
name=event['id'],
@@ -721,30 +721,12 @@ def resume_lambda_function(self, a_task, event):
721721

722722
return future
723723

724-
def resume_lambda_function(self, a_task, event):
725-
"""
726-
Resume a child workflow.
727-
728-
:param a_task:
729-
:type a_task: LambdaTask
730-
:param event:
731-
:type event: dict
732-
:return:
733-
:rtype: simpleflow.futures.Future
734-
"""
735-
future = self._get_future_from_lambda_function_event(event)
736-
737-
if future.finished and future.exception:
738-
raise future.exception
739-
740-
return future
741-
742724
def schedule_task(self, a_task, task_list=None):
743725
"""
744726
Let a task schedule itself.
745727
If too many decisions are in flight, add a timer decision and raise ExecutionBlocked.
746728
:param a_task:
747-
:type a_task: SwfTask
729+
:type a_task: ActivityTask | WorkflowTask | SignalTask [ MarkerTask [ TimerTask | CancelTimerTask | LambdaFunctionTask # noqa
748730
:param task_list:
749731
:type task_list: Optional[str]
750732
:raise: exceptions.ExecutionBlocked if too many decisions waiting
@@ -1301,17 +1283,19 @@ def get_event_details(self, event_type, event_name):
13011283

13021284
def handle_cancel_requested(self):
13031285
decision = swf.models.decision.WorkflowExecutionDecision()
1304-
is_current_decision = self._history.completed_decision_id < self._history.cancel_requested_id
1305-
should_cancel = self._workflow.should_cancel(self._history)
1286+
history = self._history
1287+
is_current_decision = history.completed_decision_id < history.cancel_requested_id
1288+
should_cancel = self._workflow.should_cancel(history)
13061289
if not should_cancel:
13071290
return None # ignore cancel
13081291
if is_current_decision:
13091292
self.on_canceled()
13101293
decision.cancel()
13111294
return [decision]
1312-
if self._history.cancel_failed:
1313-
logger.warning('failed: %s', self._history.cancel_failed)
1314-
if self._history.cancel_failed and self._history.cancel_failed_decision_task_completed_event_id == self._history.completed_decision_id:
1295+
if history.cancel_failed:
1296+
logger.warning('failed: %s', history.cancel_failed)
1297+
if (history.cancel_failed
1298+
and history.cancel_failed_decision_task_completed_event_id == history.completed_decision_id):
13151299
# Per http://docs.aws.amazon.com/amazonswf/latest/apireference/API_Decision.html,
13161300
# we should call RespondDecisionTaskCompleted without any decisions; however this hangs the workflow...
13171301

0 commit comments

Comments
 (0)