aws-step-functions-data-science-sdk-python
aws-step-functions-data-science-sdk-python copied to clipboard
Add support for Amazon States Language "ResultSelector" in Task, Map …
Add ResultSelector support for Task, Map and Parallel states.
Issue #, if available: https://github.com/aws/aws-step-functions-data-science-sdk-python/issues/95
Description of changes
Adding new Amazon States Language payload template "ResultSelector" https://states-language.net/#payload-template
This change allows user to define a result_selector
which is used to define the effective result of a state.
Testing
- Added unit test for changes
- Manual test:
# Create a simple workflow containing a task state with `result_selector`
from stepfunctions.inputs import StepResult
step_result = StepResult()
step_result_placeholder = {
'Output': step_result['output']
}
state_with_result_selector = Task(
state_id='StartState',
parameters={'Key': 'Value'},
result_selector=step_result_placeholder,
resource=<resource_arn>
)
workflow = Workflow(
name="ResultSelector_Example",
definition=state_with_result_selector,
role=<workflow_execution_role>
)
# Execute the workflow and confirm it has completed successfully
workflow.execute()
Workflow definition:
{
"StartAt": "StartState",
"States": {
"StartState": {
"Parameters": {
"Key": "Value"
},
"ResultSelector": {
"Output.$": "$['output']"
},
"Resource": <resource_arn>,
"Type": "Task",
"End": true
}
}
}
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
AWS CodeBuild CI Report
- Result: SUCCEEDED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
AWS CodeBuild CI Report
- CodeBuild project: StepFunctionsPythonSDK-integtests
- Commit ID: 41f2db2fe08f9f7d0e3ac413ce171f1c09310488
- Result: SUCCEEDED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
Any update with this? Would be fantastic to have! :+1:
Taking over to help merge @yoodan93 's PR Thank you for your review - will be addressing comments shortly
can you also add some details around testing
Added manual test details
at some point we should probably add some basic integ tests that exercise state machines and their support for ASL features. Presumably, we'll be adding more capabilities in the future. Probably not in scope for this PR, but worth thinking about sooner than later.
Agreed! let's do add integ tests in another PR
Manual test: Generated a workflow with a Task with StepResult placeholder and executed successfully
This is very unspecific. Can you share the SDK code you used to generate that?
This is very unspecific. Can you share the SDK code you used to generate that?
Agreed - this is not sufficient information to reproduce the test. I provided more details in the Testing section of the PR description
AWS CodeBuild CI Report
- CodeBuild project: AutoBuildProject6AEA49D1-sEHrOdk7acJc
- Commit ID: 6594b1c7412095c0a24f2daf502dbe5d85e003d6
- Result: SUCCEEDED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
Hi! Any plans on merging this PR soon? I'm writing a stepfunction state machine which requires this... Thanks.