我想在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 失败:服务员遇到终端故障状态
答案 0 :(得分:5)
只需改变:
waiter = client.get_waiter('tasks_running')
的
waiter = client.get_waiter('tasks_stopped')