【发布时间】:2021-11-19 13:15:26
【问题描述】:
我有一个 start_execution 命令来通过我的 lambda 函数 (python) 启动一个步进函数:
if event['Records'][0]['eventName'] == 'INSERT':
filename, source, destination_bucket_name, filekey = parse_file_info_from_trigger(event)
response = client.start_execution(
stateMachineArn='aws:states:.......',
input = "{\"first_name\" : \"test\"}"
)
else:
logger.info(f'This is not an Insert event')
如何将上述提取的变量(文件名、源等)传递到 start-execution 命令的输入中?
我试过了:
response = step_function.start_execution(
stateMachineArn=state_machine_zip_files_arn,
input = str({ "filename": f"{filename}", "filetype": f"{filetype}", "unixtimestamp": f"{unixtimestamp}",
"masterclient": f"{masterclient}", "source_bucket_name": f"{source_bucket_name}" ,
"destination_bucket_name": f"{destination_bucket_name}", "filekey": f"{filekey}","this is a test string": f"teststring"})
)
但它给了我一个错误:
Unable to start_execution for state machine: An error occurred (InvalidExecutionInput) when calling the StartExecution operation: Invalid State Machine Execution Input: 'Unexpected character (''' (code 39)): was expecting double-quote to start field name'
【问题讨论】:
标签: python python-3.x amazon-web-services dictionary aws-step-functions