Skip to content

Commit 47b9de9

Browse files
authored
Improve state execution timeouts (#414)
* Improve state execution timeouts Signed-off-by: Tihomir Surdilovic <[email protected]> * fix typo Signed-off-by: Tihomir Surdilovic <[email protected]> * fix typo Signed-off-by: Tihomir Surdilovic <[email protected]> * fix required prop Signed-off-by: Tihomir Surdilovic <[email protected]>
1 parent e2121ea commit 47b9de9

File tree

2 files changed

+54
-10
lines changed

2 files changed

+54
-10
lines changed

schema/timeouts.json

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,31 @@
7373
]
7474
},
7575
"stateExecTimeout": {
76-
"type": "string",
77-
"description": "State execution timeout duration (ISO 8601 duration format)",
78-
"minLength": 1
76+
"oneOf": [
77+
{
78+
"type": "string",
79+
"description": "Total state execution timeout (including retries) (ISO 8601 duration format)",
80+
"minLength": 1
81+
},
82+
{
83+
"type": "object",
84+
"description": "Workflow default timeouts",
85+
"properties": {
86+
"single": {
87+
"type": "string",
88+
"description": "Single state execution timeout, not including retries (ISO 8601 duration format)",
89+
"minLength": 1
90+
},
91+
"total": {
92+
"type": "string",
93+
"description": "Total state execution timeout, including retries (ISO 8601 duration format)",
94+
"minLength": 1
95+
}
96+
},
97+
"additionalProperties": false,
98+
"required": ["total"]
99+
}
100+
]
79101
},
80102
"actionExecTimeout": {
81103
"type": "string",

specification.md

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4942,28 +4942,28 @@ Let's take a look all possible timeout definitions:
49424942

49434943
#### Workflow Timeout Definition
49444944

4945-
Workflow timeouts are defined with the top-level timeouts property. It can have two types, `string` and `object`.
4945+
Workflow timeouts are defined with the top-level `timeouts` property. It can have two types, `string` and `object`.
49464946
If `string` type it defines an URI that points to a Json or Yaml file containing the workflow timeout definitions.
49474947
If `object` type, it is used to define the timeout definitions in-line and has the following properties:
49484948

49494949
| Parameter | Description | Type | Required |
49504950
| --- | --- | --- | --- |
49514951
| workflowExecTimeout | Workflow execution timeout (ISO 8601 duration format) | string or object | no |
4952-
| stateExecTimeout | Default workflow state execution timeout (ISO 8601 duration format) | string | no |
4952+
| stateExecTimeout | Default workflow state execution timeout (ISO 8601 duration format) | string or object | no |
49534953
| actionExecTimeouts | Default single actions definition execution timeout (ISO 8601 duration format) | string | no |
49544954
| branchExecTimeout | Default single branch execution timeout (ISO 8601 duration format) | string | no |
49554955
| eventTimeout | Default timeout for consuming defined events (ISO 8601 duration format) | string | no |
49564956

4957-
The `eventTimeout` property defines the maximum amount of time to wait to consume defined events. If not specified it should be
4957+
The `eventTimeout` property defines the maximum amount of time to wait to consume defined events. If not specified it should default to
49584958
"unlimited".
49594959

4960-
The `branchExecTimeout` property defines the maximum execution time for a single branch. If not specified it should be
4960+
The `branchExecTimeout` property defines the maximum execution time for a single branch. If not specified it should default to
49614961
"unlimited".
49624962

4963-
The `actionExecTimeout` property defines the maximum execution time for a single actions definition. If not specified it should be
4963+
The `actionExecTimeout` property defines the maximum execution time for a single actions definition. If not specified it should default to
49644964
"unlimited". Note that an action definition can include multiple actions.
49654965

4966-
The `stateExecTimeout` property defines the maximum execution time for a single state. If not specified it should be
4966+
The `stateExecTimeout` property defines the maximum execution time for a single workflow state. If not specified it should default to
49674967
"unlimited".
49684968

49694969
The `workflowExecTimeout` property defines the workflow execution timeout.
@@ -5034,13 +5034,35 @@ not obeyed in the workflow definition.
50345034

50355035
#### States Timeout Definition
50365036

5037-
All workflow states can define the `timeout` property and can define different timeout
5037+
All workflow states can define the `timeouts` property and can define different timeout
50385038
settings depending on their state type.
50395039
Please reference each [workflow state definitions](#Workflow-States) for more information on which
50405040
timeout settings are available for each state type.
50415041

50425042
Workflow states timeouts cannot define the `workflowExecTimeout` property.
50435043

5044+
All workflow states can define the `stateExecTimeout` property. This property can have two types, namely string
5045+
and object.
5046+
If defined as string type, it defines the total state execution timeout, including any [retries](#Retry-Definition)
5047+
as defined in the states retry policy.
5048+
If defined as object type it has the following properties:
5049+
5050+
| Parameter | Description | Type | Required |
5051+
| --- | --- | --- | --- |
5052+
| single | Single state execution timeout, not including retries (ISO 8601 duration format) | string | no |
5053+
| total | Total state execution timeout, including retries (ISO 8601 duration format) | string | yes |
5054+
5055+
The `single` property defines a single state execution timeout. This property does not take in account retries.
5056+
Each time the state is executed, whether when it is executes as part of standard control flow logic, or as part of a retry,
5057+
its total execution timeouts is the value of the `single` property.
5058+
To show an example, let's say that we set the `single`
5059+
property to "PT10S", meaning 10 seconds. A workflow state "X" which defines this timeout when first executed has the max execution timeout
5060+
set to 10 seconds. If the state execution is then retried, each time it is retried, the individual retry max execution timeout is again 10 seconds.
5061+
5062+
The `total` property on the other hand defines a state execution timeout taking in account retries.
5063+
This means when this state is executed, its execution timeout is the value of the `total` property no matter how many retries
5064+
have to be performed. If a state execution includes zero or one hundred retries, the total execution timeout is set by this property.
5065+
50445066
#### Branch Timeout Definition
50455067

50465068
[Parallel states](#Parallel-State) can define the `branchExecTimeout` property. If defined on the state

0 commit comments

Comments
 (0)