11

我想在 ECS 集群上午餐任务并等待任务终止。

import boto3

client = boto3.client('ecs')
response = client.run_task(
    cluster='default',
    taskDefinition='RGB',
    overrides={
         'containerOverrides': [
             {
                 'name': 'RGB',
                 'command': [
                     'python', 
                     '-u', 
                     'rgb.py'
                 ]
             }
         ]
     }                   
    )

arn = response["tasks"][0]['taskArn']
waiter = client.get_waiter('tasks_running')
waiter.wait(cluster='default', tasks=[arn])

这是正确的方法吗?

我得到: botocore.exceptions.WaiterError: Waiter TasksRunning failed: Waiter 遇到终端故障状态

4

1 回答 1

14

只是改变:

waiter = client.get_waiter('tasks_running')

为了

waiter = client.get_waiter('tasks_stopped')
于 2015-11-18T01:23:19.530 回答