Implement start to close timeout on SWF workflow executions
This commit is contained in:
parent
86973f2b87
commit
f38d23e483
5 changed files with 71 additions and 2 deletions
|
|
@ -394,3 +394,15 @@ def test_terminate():
|
|||
last_event.event_type.should.equal("WorkflowExecutionTerminated")
|
||||
# take default child_policy if not provided (as here)
|
||||
last_event.child_policy.should.equal("ABANDON")
|
||||
|
||||
def test_has_timedout():
|
||||
wfe = make_workflow_execution()
|
||||
wfe.has_timedout().should.equal(False)
|
||||
|
||||
with freeze_time("2015-01-01 12:00:00"):
|
||||
wfe.start()
|
||||
wfe.has_timedout().should.equal(False)
|
||||
|
||||
with freeze_time("2015-01-01 14:01"):
|
||||
# 2 hours timeout reached
|
||||
wfe.has_timedout().should.equal(True)
|
||||
|
|
|
|||
|
|
@ -63,3 +63,32 @@ def test_decision_task_start_to_close_timeout():
|
|||
attrs.should.equal({
|
||||
"scheduledEventId": 2, "startedEventId": 3, "timeoutType": "START_TO_CLOSE"
|
||||
})
|
||||
|
||||
# Workflow Execution Start to Close timeout
|
||||
# Default value in workflow helpers: 2 hours
|
||||
@mock_swf
|
||||
def test_workflow_execution_start_to_close_timeout():
|
||||
pass
|
||||
with freeze_time("2015-01-01 12:00:00"):
|
||||
conn = setup_workflow()
|
||||
|
||||
with freeze_time("2015-01-01 13:59:30"):
|
||||
resp = conn.get_workflow_execution_history("test-domain", conn.run_id, "uid-abcd1234")
|
||||
|
||||
event_types = [evt["eventType"] for evt in resp["events"]]
|
||||
event_types.should.equal(
|
||||
["WorkflowExecutionStarted", "DecisionTaskScheduled"]
|
||||
)
|
||||
|
||||
with freeze_time("2015-01-01 14:00:30"):
|
||||
# => Workflow Execution Start to Close timeout reached!!
|
||||
resp = conn.get_workflow_execution_history("test-domain", conn.run_id, "uid-abcd1234")
|
||||
|
||||
event_types = [evt["eventType"] for evt in resp["events"]]
|
||||
event_types.should.equal(
|
||||
["WorkflowExecutionStarted", "DecisionTaskScheduled", "WorkflowExecutionTimedOut"]
|
||||
)
|
||||
attrs = resp["events"][-1]["workflowExecutionTimedOutEventAttributes"]
|
||||
attrs.should.equal({
|
||||
"childPolicy": "ABANDON", "timeoutType": "START_TO_CLOSE"
|
||||
})
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ def _generic_workflow_type_attributes():
|
|||
], {
|
||||
"task_list": "queue",
|
||||
"default_child_policy": "ABANDON",
|
||||
"default_execution_start_to_close_timeout": "300",
|
||||
"default_execution_start_to_close_timeout": "7200",
|
||||
"default_task_start_to_close_timeout": "300",
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue