def _track_tasks(task_ids):
 while True:
  statuses = _get_task_statuses(task_ids)
  if all([(status == 'STOPPED') for status in statuses]):
   logger.info('ECS tasks {0} STOPPED'.format(','.join(task_ids)))
   break
  time.sleep(POLL_TIME)
  logger.debug('ECS task status for tasks {0}: {1}'.format(','.join(task_ids), status))

def _track_tasks ( task_ids ) : while True : statuses = _get_task_statuses ( task_ids ) if all ( [ ( status == 'STOPPED' ) for status in statuses ] ) : logger . info ( 'ECS tasks {0} STOPPED' . format ( ',' . join ( task_ids ) ) ) break time . sleep ( POLL_TIME ) logger . debug ( 'ECS task status for tasks {0}: {1}' . format ( ',' . join ( task_ids ) , status ) )
poll task status until stopped .