我有一個 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')
如何將上述提取的變數(檔案名、源等)傳遞到啟動執行命令的輸入中?
我試過這個:
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'
uj5u.com熱心網友回復:
的預期格式input是str. 您應該將字典轉換成STR如下:json.dumps(your_input_data)。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/360923.html
