Skip to content

Commit 7c397ca

Browse files
committed
PR feedback
1 parent 70c7bee commit 7c397ca

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

src/stepfunctions/steps/service.py

+44
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ def __init__(self, state_id, **kwargs):
2626
Args:
2727
state_id (str): State name whose length **must be** less than or equal to 128 unicode characters. State names **must be** unique within the scope of the whole state machine.
2828
comment (str, optional): Human-readable comment or description. (default: None)
29+
timeout_seconds (int, optional): Positive integer specifying timeout for the state in seconds. If the state runs longer than the specified timeout, then the interpreter fails the state with a `States.Timeout` Error Name. (default: 60)
30+
timeout_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for timeout seconds duration.
31+
heartbeat_seconds (int, optional): Positive integer specifying heartbeat timeout for the state in seconds. This value should be lower than the one specified for `timeout_seconds`. If more time than the specified heartbeat elapses between heartbeats from the task, then the interpreter fails the state with a `States.Timeout` Error Name.
32+
heartbeat_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for heartbeat seconds duration.
2933
input_path (str, optional): Path applied to the state’s raw input to select some or all of it; that selection is used by the state. (default: '$')
3034
parameters (dict, optional): The value of this field becomes the effective input for the state.
3135
result_path (str, optional): Path specifying the raw input’s combination with or replacement by the state’s result. (default: '$')
@@ -46,6 +50,10 @@ def __init__(self, state_id, **kwargs):
4650
Args:
4751
state_id (str): State name whose length **must be** less than or equal to 128 unicode characters. State names **must be** unique within the scope of the whole state machine.
4852
comment (str, optional): Human-readable comment or description. (default: None)
53+
timeout_seconds (int, optional): Positive integer specifying timeout for the state in seconds. If the state runs longer than the specified timeout, then the interpreter fails the state with a `States.Timeout` Error Name. (default: 60)
54+
timeout_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for timeout seconds duration.
55+
heartbeat_seconds (int, optional): Positive integer specifying heartbeat timeout for the state in seconds. This value should be lower than the one specified for `timeout_seconds`. If more time than the specified heartbeat elapses between heartbeats from the task, then the interpreter fails the state with a `States.Timeout` Error Name.
56+
heartbeat_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for heartbeat seconds duration.
4957
input_path (str, optional): Path applied to the state’s raw input to select some or all of it; that selection is used by the state. (default: '$')
5058
parameters (dict, optional): The value of this field becomes the effective input for the state.
5159
result_path (str, optional): Path specifying the raw input’s combination with or replacement by the state’s result. (default: '$')
@@ -66,6 +74,10 @@ def __init__(self, state_id, **kwargs):
6674
Args:
6775
state_id (str): State name whose length **must be** less than or equal to 128 unicode characters. State names **must be** unique within the scope of the whole state machine.
6876
comment (str, optional): Human-readable comment or description. (default: None)
77+
timeout_seconds (int, optional): Positive integer specifying timeout for the state in seconds. If the state runs longer than the specified timeout, then the interpreter fails the state with a `States.Timeout` Error Name. (default: 60)
78+
timeout_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for timeout seconds duration.
79+
heartbeat_seconds (int, optional): Positive integer specifying heartbeat timeout for the state in seconds. This value should be lower than the one specified for `timeout_seconds`. If more time than the specified heartbeat elapses between heartbeats from the task, then the interpreter fails the state with a `States.Timeout` Error Name.
80+
heartbeat_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for heartbeat seconds duration.
6981
input_path (str, optional): Path applied to the state’s raw input to select some or all of it; that selection is used by the state. (default: '$')
7082
parameters (dict, optional): The value of this field becomes the effective input for the state.
7183
result_path (str, optional): Path specifying the raw input’s combination with or replacement by the state’s result. (default: '$')
@@ -86,6 +98,10 @@ def __init__(self, state_id, **kwargs):
8698
Args:
8799
state_id (str): State name whose length **must be** less than or equal to 128 unicode characters. State names **must be** unique within the scope of the whole state machine.
88100
comment (str, optional): Human-readable comment or description. (default: None)
101+
timeout_seconds (int, optional): Positive integer specifying timeout for the state in seconds. If the state runs longer than the specified timeout, then the interpreter fails the state with a `States.Timeout` Error Name. (default: 60)
102+
timeout_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for timeout seconds duration.
103+
heartbeat_seconds (int, optional): Positive integer specifying heartbeat timeout for the state in seconds. This value should be lower than the one specified for `timeout_seconds`. If more time than the specified heartbeat elapses between heartbeats from the task, then the interpreter fails the state with a `States.Timeout` Error Name.
104+
heartbeat_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for heartbeat seconds duration.
89105
input_path (str, optional): Path applied to the state’s raw input to select some or all of it; that selection is used by the state. (default: '$')
90106
parameters (dict, optional): The value of this field becomes the effective input for the state.
91107
result_path (str, optional): Path specifying the raw input’s combination with or replacement by the state’s result. (default: '$')
@@ -163,6 +179,10 @@ def __init__(self, state_id, wait_for_completion=True, **kwargs):
163179
Args:
164180
state_id (str): State name whose length **must be** less than or equal to 128 unicode characters. State names **must be** unique within the scope of the whole state machine.
165181
comment (str, optional): Human-readable comment or description. (default: None)
182+
timeout_seconds (int, optional): Positive integer specifying timeout for the state in seconds. If the state runs longer than the specified timeout, then the interpreter fails the state with a `States.Timeout` Error Name. (default: 60)
183+
timeout_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for timeout seconds duration.
184+
heartbeat_seconds (int, optional): Positive integer specifying heartbeat timeout for the state in seconds. This value should be lower than the one specified for `timeout_seconds`. If more time than the specified heartbeat elapses between heartbeats from the task, then the interpreter fails the state with a `States.Timeout` Error Name.
185+
heartbeat_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for heartbeat seconds duration.
166186
input_path (str, optional): Path applied to the state’s raw input to select some or all of it; that selection is used by the state. (default: '$')
167187
parameters (dict, optional): The value of this field becomes the effective input for the state.
168188
result_path (str, optional): Path specifying the raw input’s combination with or replacement by the state’s result. (default: '$')
@@ -187,6 +207,10 @@ def __init__(self, state_id, wait_for_completion=True, **kwargs):
187207
Args:
188208
state_id (str): State name whose length **must be** less than or equal to 128 unicode characters. State names **must be** unique within the scope of the whole state machine.
189209
comment (str, optional): Human-readable comment or description. (default: None)
210+
timeout_seconds (int, optional): Positive integer specifying timeout for the state in seconds. If the state runs longer than the specified timeout, then the interpreter fails the state with a `States.Timeout` Error Name. (default: 60)
211+
timeout_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for timeout seconds duration.
212+
heartbeat_seconds (int, optional): Positive integer specifying heartbeat timeout for the state in seconds. This value should be lower than the one specified for `timeout_seconds`. If more time than the specified heartbeat elapses between heartbeats from the task, then the interpreter fails the state with a `States.Timeout` Error Name.
213+
heartbeat_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for heartbeat seconds duration.
190214
input_path (str, optional): Path applied to the state’s raw input to select some or all of it; that selection is used by the state. (default: '$')
191215
parameters (dict, optional): The value of this field becomes the effective input for the state.
192216
result_path (str, optional): Path specifying the raw input’s combination with or replacement by the state’s result. (default: '$')
@@ -211,6 +235,10 @@ def __init__(self, state_id, wait_for_completion=True, **kwargs):
211235
Args:
212236
state_id (str): State name whose length **must be** less than or equal to 128 unicode characters. State names **must be** unique within the scope of the whole state machine.
213237
comment (str, optional): Human-readable comment or description. (default: None)
238+
timeout_seconds (int, optional): Positive integer specifying timeout for the state in seconds. If the state runs longer than the specified timeout, then the interpreter fails the state with a `States.Timeout` Error Name. (default: 60)
239+
timeout_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for timeout seconds duration.
240+
heartbeat_seconds (int, optional): Positive integer specifying heartbeat timeout for the state in seconds. This value should be lower than the one specified for `timeout_seconds`. If more time than the specified heartbeat elapses between heartbeats from the task, then the interpreter fails the state with a `States.Timeout` Error Name.
241+
heartbeat_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for heartbeat seconds duration.
214242
input_path (str, optional): Path applied to the state’s raw input to select some or all of it; that selection is used by the state. (default: '$')
215243
parameters (dict, optional): The value of this field becomes the effective input for the state.
216244
result_path (str, optional): Path specifying the raw input’s combination with or replacement by the state’s result. (default: '$')
@@ -235,6 +263,10 @@ def __init__(self, state_id, **kwargs):
235263
Args:
236264
state_id (str): State name whose length **must be** less than or equal to 128 unicode characters. State names **must be** unique within the scope of the whole state machine.
237265
comment (str, optional): Human-readable comment or description. (default: None)
266+
timeout_seconds (int, optional): Positive integer specifying timeout for the state in seconds. If the state runs longer than the specified timeout, then the interpreter fails the state with a `States.Timeout` Error Name. (default: 60)
267+
timeout_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for timeout seconds duration.
268+
heartbeat_seconds (int, optional): Positive integer specifying heartbeat timeout for the state in seconds. This value should be lower than the one specified for `timeout_seconds`. If more time than the specified heartbeat elapses between heartbeats from the task, then the interpreter fails the state with a `States.Timeout` Error Name.
269+
heartbeat_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for heartbeat seconds duration.
238270
input_path (str, optional): Path applied to the state’s raw input to select some or all of it; that selection is used by the state. (default: '$')
239271
parameters (dict, optional): The value of this field becomes the effective input for the state.
240272
result_path (str, optional): Path specifying the raw input’s combination with or replacement by the state’s result. (default: '$')
@@ -255,6 +287,10 @@ def __init__(self, state_id, **kwargs):
255287
Args:
256288
state_id (str): State name whose length **must be** less than or equal to 128 unicode characters. State names **must be** unique within the scope of the whole state machine.
257289
comment (str, optional): Human-readable comment or description. (default: None)
290+
timeout_seconds (int, optional): Positive integer specifying timeout for the state in seconds. If the state runs longer than the specified timeout, then the interpreter fails the state with a `States.Timeout` Error Name. (default: 60)
291+
timeout_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for timeout seconds duration.
292+
heartbeat_seconds (int, optional): Positive integer specifying heartbeat timeout for the state in seconds. This value should be lower than the one specified for `timeout_seconds`. If more time than the specified heartbeat elapses between heartbeats from the task, then the interpreter fails the state with a `States.Timeout` Error Name.
293+
heartbeat_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for heartbeat seconds duration.
258294
input_path (str, optional): Path applied to the state’s raw input to select some or all of it; that selection is used by the state. (default: '$')
259295
parameters (dict, optional): The value of this field becomes the effective input for the state.
260296
result_path (str, optional): Path specifying the raw input’s combination with or replacement by the state’s result. (default: '$')
@@ -275,6 +311,10 @@ def __init__(self, state_id, **kwargs):
275311
Args:
276312
state_id (str): State name whose length **must be** less than or equal to 128 unicode characters. State names **must be** unique within the scope of the whole state machine.
277313
comment (str, optional): Human-readable comment or description. (default: None)
314+
timeout_seconds (int, optional): Positive integer specifying timeout for the state in seconds. If the state runs longer than the specified timeout, then the interpreter fails the state with a `States.Timeout` Error Name. (default: 60)
315+
timeout_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for timeout seconds duration.
316+
heartbeat_seconds (int, optional): Positive integer specifying heartbeat timeout for the state in seconds. This value should be lower than the one specified for `timeout_seconds`. If more time than the specified heartbeat elapses between heartbeats from the task, then the interpreter fails the state with a `States.Timeout` Error Name.
317+
heartbeat_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for heartbeat seconds duration.
278318
input_path (str, optional): Path applied to the state’s raw input to select some or all of it; that selection is used by the state. (default: '$')
279319
parameters (dict, optional): The value of this field becomes the effective input for the state.
280320
result_path (str, optional): Path specifying the raw input’s combination with or replacement by the state’s result. (default: '$')
@@ -295,6 +335,10 @@ def __init__(self, state_id, **kwargs):
295335
Args:
296336
state_id (str): State name whose length **must be** less than or equal to 128 unicode characters. State names **must be** unique within the scope of the whole state machine.
297337
comment (str, optional): Human-readable comment or description. (default: None)
338+
timeout_seconds (int, optional): Positive integer specifying timeout for the state in seconds. If the state runs longer than the specified timeout, then the interpreter fails the state with a `States.Timeout` Error Name. (default: 60)
339+
timeout_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for timeout seconds duration.
340+
heartbeat_seconds (int, optional): Positive integer specifying heartbeat timeout for the state in seconds. This value should be lower than the one specified for `timeout_seconds`. If more time than the specified heartbeat elapses between heartbeats from the task, then the interpreter fails the state with a `States.Timeout` Error Name.
341+
heartbeat_seconds_path (str, optional): Path applied to the state's input to select the integer to be used for heartbeat seconds duration.
298342
input_path (str, optional): Path applied to the state’s raw input to select some or all of it; that selection is used by the state. (default: '$')
299343
parameters (dict, optional): The value of this field becomes the effective input for the state.
300344
result_path (str, optional): Path specifying the raw input’s combination with or replacement by the state’s result. (default: '$')

tests/unit/test_steps.py

+15
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,21 @@ def test_task_state_creation():
214214
'End': True
215215
}
216216

217+
def test_task_state_creation_with_dynamic_timeout():
218+
task_state = Task(
219+
'Task',
220+
resource='arn:aws:lambda:us-east-1:1234567890:function:StartLambda',
221+
timeout_seconds_path='$.timeout',
222+
heartbeat_seconds_path='$.heartbeat',
223+
)
224+
assert task_state.to_dict() == {
225+
'Type': 'Task',
226+
'Resource': 'arn:aws:lambda:us-east-1:1234567890:function:StartLambda',
227+
'HeartbeatSecondsPath': '$.heartbeat',
228+
'TimeoutSecondsPath': '$.timeout',
229+
'End': True
230+
}
231+
217232
def test_task_state_create_fail_for_duplicated_dynamic_timeout_fields():
218233
with pytest.raises(ValueError):
219234
Task(

0 commit comments

Comments
 (0)