(aws-stepfunctions): Support dynamic Task timeouts (TimeoutSecondsPath/HeartbeatSecondsPath)
See original GitHub issueAmazon States Language supports dynamic Task state timeout and heartbeat configurations by the TimeoutSecondsPath
and HeartbeatSecondsPath
properties respectively. TimeoutSecondsPath
has the same effect as TimeoutSeconds
but reads the seconds value at runtime from the state input using JSONPath. This is not supported in CDK without a CustomState.
- https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-task-state.html
- https://states-language.net/spec.html#task-state
Use Case
Allows CDK users to specify Task state timeout and heartbeat settings at runtime instead of hardcoding static values in the state machine definition.
Proposed Solution
- Option 1 - Expose explicit
timeoutPath
andheartbeatPath
in TaskBaseProps
const myTask = new EcsRunTask(scope, "MyTask", {
...
timeoutPath: JsonPath.numberAt("$.myTimeoutInSeconds")
...
});
// OR
const myTask = new EcsRunTask(scope, "MyTask", {
...
timeoutPath: "$.myTimeoutInSeconds"
...
});
- Option 2 - Use the existing
timeout
andheartbeat
properties and append “Path” to the generated ASL if the provided value is JSONPath, similar to how Parameters works in json-path.ts
const myTask = new EcsRunTask(scope, "MyTask", {
...
timeout: JsonPath.numberAt("$.myTimeoutInSeconds")
...
});
Both would render the same ASL:
{
"Type": "Task",
"Resource": "...",
...
"TimeoutSecondsPath": "$.myTimeoutInSeconds",
...
}
Other
- 👋 I may be able to implement this feature request
- ⚠️ This feature might incur a breaking change
This is a 🚀 Feature Request
Issue Analytics
- State:
- Created 2 years ago
- Reactions:8
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Use timeouts to avoid stuck executions - AWS Step Functions
If something goes wrong and the TimeoutSeconds field isn't specified for an Activity or Task state, an execution is stuck waiting for a...
Read more >How to add dynamic TimeoutSeconds for activity in AWS ...
I have an activity in step function with TimeoutSeconds , like this: ActivityWaiting: Type: Task ...
Read more >Dynamic Task Mapping — Airflow Documentation
Dynamic Task Mapping allows a way for a workflow to create a number of tasks at runtime based upon current data, rather than...
Read more >AWS Step Functions: Handling errors - YouTube
In this session, viewers learn how to use AWS Step Functions workflows to handle errors in their serverless applications.
Read more >Standard Task With Timeout (External Forms) activity
This activity is often used for time-based escalations. For example, if a Tier 1 Customer Support representative does not answer a support query...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
+1 on this feature request. I am developing a new step function and need to use the heartbeatPath since a compile time heartbeat isn’t appropriate. I’ll give the work around a try until the feature is available.
Here is a workaround that does not break the synth
later