Skip to content
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

'parameters' not coming through in Step Functions TaskProps #5267

Closed
sarchila opened this issue Dec 1, 2019 · 1 comment · Fixed by #5408
Closed

'parameters' not coming through in Step Functions TaskProps #5267

sarchila opened this issue Dec 1, 2019 · 1 comment · Fixed by #5408
Assignees
Labels
@aws-cdk/aws-stepfunctions Related to AWS StepFunctions bug This issue is a bug. good first issue Related to contributions. See CONTRIBUTING.md language/python Related to Python bindings needs-triage This issue or PR still needs to be triaged.

Comments

@sarchila
Copy link

sarchila commented Dec 1, 2019

Related to #4815, which is meant to provide this functionalilty.

Reproduction Steps

Using this test as a guide, I created the following simplified stack in python:

from aws_cdk import (
    aws_lambda,
    aws_stepfunctions,
    aws_stepfunctions_tasks,
    core,
)

class TestStack(core.Stack):
    def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
        super().__init__(scope, id, **kwargs)
        self.app_prefix = id

        pass_state = aws_stepfunctions.Pass(
            scope=self,
            id=f'{self.app_prefix}_pass_state',
            input_path="$",
            output_path="$.state",
            parameters={
                "input.$": "$",
                "stringArgument": "inital-task",
                "numberArgument": 123,
                "booleanArgument": True,
                "arrayArgument": ["a", "b", "c"]
            },
        )
        print('PASS STATE >> ' + str(pass_state.to_state_json()))

        glue_start_job_sync = aws_lambda.Function.from_function_arn(
            scope=self,
            id=f'{self.app_prefix}_start_glue_job_run_sync',
            function_arn='arn:aws:states:::glue:startJobRun.sync',
        )

        task_state = aws_stepfunctions.Task(
            scope=self,
            id=f'{self.app_prefix}_task_state',
            task=aws_stepfunctions_tasks.InvokeFunction(glue_start_job_sync),
            input_path="$",
            output_path="$.state",
            parameters={
                "input.$": "$",
                "stringArgument": "inital-task",
                "numberArgument": 123,
                "booleanArgument": True,
                "arrayArgument": ["a", "b", "c"]
            },
        )
        print('TASK STATE >> ' + str(task_state.to_state_json()))


app = core.App()
test_stack = TestStack(app, 'test-example-app')
app.synth()

I get the following printed when I synthesize:

PASS STATE >> {'Type': 'Pass', 'InputPath': '$', 'Parameters': {'input.$': '$', 'stringArgument': 'inital-task', 'numberArgument': 123, 'booleanArgument': True, 'arrayArgument': ['a', 'b', 'c']}, 'OutputPath': '$.state', 'End': True}
TASK STATE >> {'End': True, 'InputPath': '$', 'OutputPath': '$.state', 'Type': 'Task', 'Resource': 'arn:aws:states:::glue:startJobRun.sync'}

As you can see, the same parameters came through just fine in the aws_stepfunctions.Pass state, but did not come through in the rendered json for the aws_stepfunctions.Task state.

Error Log

Environment

  • CLI Version : 1.18.0 (build bc924bc)
  • Framework Version: 1.18.0
  • OS : MacOS
  • Language : python

Other


This is 🐛 Bug Report

@sarchila sarchila added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 1, 2019
@SomayaB SomayaB added language/python Related to Python bindings @aws-cdk/aws-stepfunctions Related to AWS StepFunctions labels Dec 2, 2019
@rix0rrr rix0rrr added the good first issue Related to contributions. See CONTRIBUTING.md label Dec 2, 2019
@rix0rrr
Copy link
Contributor

rix0rrr commented Dec 13, 2019

parameters are tied to the specific Task that is being run. In your case, it would go in to:

            task=aws_stepfunctions_tasks.InvokeFunction(glue_start_job_sync, payload={
                "input.$": "$",
                "stringArgument": "inital-task",
                "numberArgument": 123,
                "booleanArgument": True,
                "arrayArgument": ["a", "b", "c"]
            })

@rix0rrr rix0rrr closed this as completed Dec 13, 2019
rix0rrr added a commit that referenced this issue Dec 13, 2019
Make `Task`'s `parameters` property be respected, while at the same
time making it very clear that it actually shouldn't be used at all
via documentation.

It got added in a previous commit but wasn't actually respected. We
have the option between deprecating it (since it never really worked),
or making it work but disrecommending it. Could still serve as a useful
location to add overrides in cases where people want to use Tokens
in place of enum-typed parameters, which today is not possible.

Fixes #5267.
mergify bot pushed a commit that referenced this issue Dec 16, 2019
Make `Task`'s `parameters` property be respected, while at the same
time making it very clear that it actually shouldn't be used at all
via documentation.

It got added in a previous commit but wasn't actually respected. We
have the option between deprecating it (since it never really worked),
or making it work but disrecommending it. Could still serve as a useful
location to add overrides in cases where people want to use Tokens
in place of enum-typed parameters, which today is not possible.

Fixes #5267.
ed-at-work pushed a commit to ed-at-work/aws-cdk that referenced this issue Dec 17, 2019
Make `Task`'s `parameters` property be respected, while at the same
time making it very clear that it actually shouldn't be used at all
via documentation.

It got added in a previous commit but wasn't actually respected. We
have the option between deprecating it (since it never really worked),
or making it work but disrecommending it. Could still serve as a useful
location to add overrides in cases where people want to use Tokens
in place of enum-typed parameters, which today is not possible.

Fixes aws#5267.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-stepfunctions Related to AWS StepFunctions bug This issue is a bug. good first issue Related to contributions. See CONTRIBUTING.md language/python Related to Python bindings needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants