-
Notifications
You must be signed in to change notification settings - Fork 90
Add support for Amazon States Language "ResultSelector" in Task, Map … #102
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
Changes from all commits
c05c90f
8667c37
851fc0e
3430024
e67804b
2758879
9df0b8d
ca45e9e
a7016da
eb0a82c
5f5c4ca
6871e03
21595dc
f4cb764
6594b1c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
Placeholders | ||
============= | ||
|
||
|
||
Once defined, a workflow is static unless you update it explicitly. But, you can pass | ||
input to workflow executions. You can have dynamic values | ||
that you use in the **parameters** fields of the steps in your workflow. For this, | ||
that you use in the **parameters** or **result_selector** fields of the steps in your workflow. For this, | ||
the AWS Step Functions Data Science SDK provides a way to define placeholders to pass around when you | ||
create your workflow. There are 2 mechanisms for passing dynamic values in a workflow. | ||
create your workflow. There are 3 mechanisms for passing dynamic values in a workflow. | ||
|
||
The first mechanism is a global input to the workflow execution. This input is | ||
accessible to all the steps in the workflow. The SDK provides :py:meth:`stepfunctions.inputs.ExecutionInput` | ||
|
@@ -50,6 +51,7 @@ to define the schema for this input, and to access the values in your workflow. | |
|
||
workflow.execute(inputs={'myDynamicInput': "WorldHello"}) | ||
|
||
|
||
The second mechanism is for passing dynamic values from one step to the next | ||
step. The output of one step becomes the input of the next step. | ||
The SDK provides the :py:meth:`stepfunctions.inputs.StepInput` class for this. | ||
|
@@ -64,10 +66,10 @@ that returns the placeholder output for that step. | |
parameters={ | ||
"FunctionName": "MakeApiCall", | ||
"Payload": { | ||
"input": "20192312" | ||
} | ||
"input": "20192312" | ||
} | ||
) | ||
} | ||
) | ||
|
||
lambda_state_second = LambdaStep( | ||
state_id="MySecondLambdaStep", | ||
|
@@ -83,10 +85,34 @@ that returns the placeholder output for that step. | |
|
||
|
||
|
||
The third mechanism is a placeholder for a step's result. The result of a step can be modified | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still wondering if it's really necessary to introduce StepResult when StepInput could also be used to achieve the same thing. I left that comment earlier but it didn't get an answer. Literally the only difference is the class name. Thoughts @shivlaks? We can always add classes later, but removing it afterwards breaks back-compat. lambda_result = StepInput(
schema={
"Id": str,
}
)
lambda_state_first = LambdaStep(
state_id="MyFirstLambdaStep",
result_selector={
"Output": lambda_result["Id"],
"Status": "Success"
}
) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good question - I missed that comment earlier While it does make sense to use the same object, I think the name To be backwards compatible, we can't rename |
||
with the **result_selector** field to replace the step's result. | ||
The SDK provides :py:meth:`stepfunctions.inputs.StepResult` class for this. | ||
|
||
.. code-block:: python | ||
|
||
lambda_result = StepResult( | ||
schema={ | ||
"Id": str, | ||
} | ||
) | ||
|
||
lambda_state_first = LambdaStep( | ||
state_id="MyFirstLambdaStep", | ||
result_selector={ | ||
"Output": lambda_result["Id"], | ||
"Status": "Success" | ||
} | ||
) | ||
|
||
|
||
.. autoclass:: stepfunctions.inputs.Placeholder | ||
|
||
.. autoclass:: stepfunctions.inputs.ExecutionInput | ||
:inherited-members: | ||
|
||
.. autoclass:: stepfunctions.inputs.StepInput | ||
:inherited-members: | ||
|
||
.. autoclass:: stepfunctions.inputs.StepResult | ||
:inherited-members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,7 @@ def __init__(self, state_id, wait_for_callback=False, **kwargs): | |
comment (str, optional): Human-readable comment or description. (default: None) | ||
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: '$') | ||
parameters (dict, optional): The value of this field becomes the effective input for the state. | ||
result_selector (dict, optional): The value of this field becomes the effective result of the state. | ||
result_path (str, optional): Path specifying the raw input’s combination with or replacement by the state’s result. (default: '$') | ||
output_path (str, optional): Path applied to the state’s output after the application of `result_path`, producing the effective output which serves as the raw input for the next state. (default: '$') | ||
""" | ||
|
@@ -98,6 +99,7 @@ def __init__(self, state_id, wait_for_completion=True, **kwargs): | |
comment (str, optional): Human-readable comment or description. (default: None) | ||
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: '$') | ||
parameters (dict, optional): The value of this field becomes the effective input for the state. | ||
result_selector (dict, optional): The value of this field becomes the effective result of the state. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maintaining these docstrings for every inheriting class is pretty annoying. I wonder if there anything we can do to make that easier. |
||
result_path (str, optional): Path specifying the raw input’s combination with or replacement by the state’s result. (default: '$') | ||
output_path (str, optional): Path applied to the state’s output after the application of `result_path`, producing the effective output which serves as the raw input for the next state. (default: '$') | ||
""" | ||
|
@@ -138,6 +140,7 @@ def __init__(self, state_id, wait_for_completion=True, **kwargs): | |
comment (str, optional): Human-readable comment or description. (default: None) | ||
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: '$') | ||
parameters (dict, optional): The value of this field becomes the effective input for the state. | ||
result_selector (dict, optional): The value of this field becomes the effective result of the state. | ||
ca-nguyen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
result_path (str, optional): Path specifying the raw input’s combination with or replacement by the state’s result. (default: '$') | ||
output_path (str, optional): Path applied to the state’s output after the application of `result_path`, producing the effective output which serves as the raw input for the next state. (default: '$') | ||
""" | ||
|
@@ -178,6 +181,7 @@ def __init__(self, state_id, wait_for_completion=True, **kwargs): | |
comment (str, optional): Human-readable comment or description. (default: None) | ||
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: '$') | ||
parameters (dict, optional): The value of this field becomes the effective input for the state. | ||
result_selector (dict, optional): The value of this field becomes the effective result of the state. | ||
result_path (str, optional): Path specifying the raw input’s combination with or replacement by the state’s result. (default: '$') | ||
output_path (str, optional): Path applied to the state’s output after the application of `result_path`, producing the effective output which serves as the raw input for the next state. (default: '$') | ||
""" | ||
|
Uh oh!
There was an error while loading. Please reload this page.