-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stepfunctions-tasks: StepFunctionsStartExecution should add AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID #14778
Comments
@iOnline247 thanks for adding this feature request. I agree it would be useful to have native support for it. |
@shivlaks Can I pick this up? |
@hassanazharkhan yes, please feel free to open a PR for this feature. I think an appropriate name for the property would be |
I could be way off base here as I'm trying to understand stepfunctions as a whole still, but it seems odd to have both an Instead, would it make more sense to add a new static method in aws-cdk/packages/@aws-cdk/aws-stepfunctions/lib/fields.ts Lines 67 to 69 in 3e9f04d
Something like: public static get executionId(): string {
return new JsonPathToken('$$.Execution.Id').toString();
} Then the interface would look like this: const task = new StepFunctionsStartExecution(this, 'Task', {
stateMachine,
input: sfn.TaskInput.fromObject({
AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID: sfn.JsonPath.executionId,
token: sfn.JsonPath.taskToken, // this is how taskToken is used in the tests
}),
} Tasktoken seems to be one of the other keys modeled in the |
I agree this is nontrivial, but I still think possible. We have information about whether class StepFunctionsStartExecution {
constructor(...) {
// ...
if (this.props.associateWithParent && this.props.input?.type !== sfn.InputType.OBJECT) {
throw new Error('Could not associate child execution with parent execution because input is taken directly from a JSON path (or a value for the `input` property was not provided). Use `sfn.TaskInput.fromObject` instead');
}
}
_renderTask(): any {
let input: any;
if (this.props.associateWithParent) {
const associateWithParentEntry = {
AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID: sfn.JsonPath.stringAt('$$.Execution.Id'),
};
input = { ...this.props.input.value, ...associateWithParentEntry };
} else {
input = this.props.input ? this.props.input.value : sfn.TaskInput.fromJsonPathAt('$').value;
}
return {
// ...
Parameters: {
Input: input,
// ...,
};
}
} I think a |
I can do that too! I was wary about |
…tepFunctionsStartExecution via associateWithParent property (#16475) Adds an `associateWithParent` boolean property on `StepFunctionsStartExecutionProps` that is native support for [Associate Workflow Executions](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-nested-workflows.html#nested-execution-startid). It adds the `"AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID.$": "$$.Execution.Id"` payload to `input`. This allows the Step Functions UI to link child executions from parent executions, making it easier to trace execution flow across state machines. Closes #14778. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
It'd be nice to have a property that'll add the
AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID
to the input payload.Use Case
This will make it easy to add the
AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID
to the input payload.Proposed Solution
Other
This would assist in removing some of the workarounds I've implemented to get this to work. #14777
This is a 🚀 Feature Request
The text was updated successfully, but these errors were encountered: