def run(self, args, config): """Waits on the given tasks to complete or for a timeout to pass.""" config.ee_init() task_ids = [] if args.task_ids == ['all']: tasks = ee.data.getTaskList() for task in tasks: if task['state'] not in utils.TASK_FINISHED_STATES: task_ids.append(task['id']) else: statuses = ee.data.getTaskStatus(args.task_ids) for status in statuses: state = status['state'] task_id = status['id'] if state == 'UNKNOWN': raise ee.EEException('Unknown task id "%s"' % task_id) else: task_ids.append(task_id) utils.wait_for_tasks(task_ids, args.timeout, log_progress=args.verbose)