Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/281.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 未能触发aws步骤功能活动_Python_Amazon Web Services_State Machine_Aws Step Functions - Fatal编程技术网

Python 未能触发aws步骤功能活动

Python 未能触发aws步骤功能活动,python,amazon-web-services,state-machine,aws-step-functions,Python,Amazon Web Services,State Machine,Aws Step Functions,我有下面一段脚本,它连续地汇集了一项活动ARN 用于触发的新步骤功能。我还有一个cloudwatch事件触发器,每1分钟触发一次 import boto3 import time region = 'ap-southeast-1' activity_arn = 'xxxxxxxx' #correct arn is filled here while True: client = boto3.client('stepfunctions', region_name=region)

我有下面一段脚本,它连续地汇集了一项活动ARN 用于触发的新步骤功能。我还有一个cloudwatch事件触发器,每1分钟触发一次

import boto3
import time

region = 'ap-southeast-1'
activity_arn = 'xxxxxxxx'  #correct arn is filled here

while True:
    client = boto3.client('stepfunctions', region_name=region)
    response = client.get_activity_task(activityArn=activity_arn,
                                        workerName='daily_market_data_batch')    
    activity_token = response['taskToken']
    input_params = json.loads(response['input'])

    # simulating running some long tasks by sending heartbeats
    for i in range(10):
        client.send_task_heartbeat(taskToken=activity_token)
        time.sleep(1)

    print("================")
    print(input_params)
    client.send_task_success(taskToken=activity_token, output='true')
这就是状态机的设置方式

{
  "Comment": "An example using a Task state.",
  "StartAt": "getGreeting",
  "Version": "1.0",
  "TimeoutSeconds": 300,
  "States":
  {
    "getGreeting": {
      "Type": "Task",
      "Resource": "arn:aws:states:ap-southeast-1:XXXXXXXXXX:activity:get_greeting",
      "End": true
    }
}
我期望看到的是:

因为脚本有一个永无止境的while循环,所以我希望只要cloudwatch触发一个新的step函数,脚本就会运行。当每个步骤函数运行时,我希望在脚本的服务器端看到“input_params”的相应打印输出

我实际观察到:

云监控确实按照规定每1分钟触发一次步进功能。然而,我的脚本并没有捕获所有步骤函数的运行。正如您所看到的,有时step函数超时。在我的脚本服务器上,没有为那些遗漏步骤的函数运行打印输出

我需要确保我的活动脚本不会错过任何触发的步骤功能。有人能指出在我的脚本服务器端未能捕获某些步骤函数运行的原因吗?多谢各位