2015-11-13 197 views
1

我想在ECS羣集上午餐任務,並等待任務終止。在Boto3上使用AWS 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]) 

這是正確的方法嗎?

I am getting: botocore.exceptions.WaiterError: Waiter TasksRunning failed: Waiter encountered a terminal failure state

回答

2

只是改變:

waiter = client.get_waiter('tasks_running') 

waiter = client.get_waiter('tasks_stopped')