def display_task_progress(
      self, instance, project, region, request_id=None, user=None,
      poll_interval=60):
    """Displays the overall progress of tasks in a Turbinia job.

    Args:
      instance (string): The name of the Turbinia instance
      project (string): The project containing the disk to process
      region (string): Region where turbinia is configured.
      request_id (string): The request ID provided by Turbinia.
      user (string): The username to filter tasks by.
      poll_interval (int): The interval at which to poll for new results.
    """
    total_completed = 0

    while True:
      task_results = self.client.get_task_data(
          instance, project, region, request_id=request_id, user=user)
      tasks = {task['id']: task for task in task_results}
      completed_tasks = set()
      pending_tasks = set()

      for task in tasks.values():
        if task.get('successful') is not None:
          completed_tasks.add(task['id'])
        else:
          pending_tasks.add(task['id'])

      if len(completed_tasks) > total_completed or not completed_tasks:
        total_completed = len(completed_tasks)

        print('Task status update (completed: {0:d} | pending: {1:d})'.format(
            len(completed_tasks), len(pending_tasks)))

        print('Completed tasks:')
        for task_id in completed_tasks:
          self._print_task_data(tasks[task_id])

        print('Pending tasks:')
        for task_id in pending_tasks:
          self._print_task_data(tasks[task_id])

      if len(completed_tasks) == len(task_results) and completed_tasks:
        print('All {0:d} Tasks completed'.format(len(task_results)))
        return

      time.sleep(poll_interval)
def display_task_progress ( self , instance , project , region , request_id = None , user = None , poll_interval = 60 ) : total_completed = 0 while True : task_results = self . client . get_task_data ( instance , project , region , request_id = request_id , user = user ) tasks = { task [ 'id' ] : task for task in task_results } completed_tasks = set ( ) pending_tasks = set ( ) for task in tasks . values ( ) : if task . get ( 'successful' ) is not None : completed_tasks . add ( task [ 'id' ] ) else : pending_tasks . add ( task [ 'id' ] ) if len ( completed_tasks ) > total_completed or not completed_tasks : total_completed = len ( completed_tasks ) print ( 'Task status update (completed: {0:d} | pending: {1:d})' . format ( len ( completed_tasks ) , len ( pending_tasks ) ) ) print ( 'Completed tasks:' ) for task_id in completed_tasks : self . _print_task_data ( tasks [ task_id ] ) print ( 'Pending tasks:' ) for task_id in pending_tasks : self . _print_task_data ( tasks [ task_id ] ) if len ( completed_tasks ) == len ( task_results ) and completed_tasks : print ( 'All {0:d} Tasks completed' . format ( len ( task_results ) ) ) return time . sleep ( poll_interval )
Displays the overall progress of tasks in a Turbinia job.

    Args:
      instance (string): The name of the Turbinia instance
      project (string): The project containing the disk to process
      region (string): Region where turbinia is configured.
      request_id (string): The request ID provided by Turbinia.
      user (string): The username to filter tasks by.
      poll_interval (int): The interval at which to poll for new results.