original_docstring: Waits with retrues for operation to be done given poller.
  
    Args:
      poller: OperationPoller, poller to use during retrials.
      operation_ref: object, passed to operation poller poll method.
      message: str, string to display for progress_tracker.
      pre_start_sleep_ms: int, Time to wait before making first poll request.
      max_retrials: int, max number of retrials before raising RetryException.
      max_wait_ms: int, number of ms to wait before raising WaitException.
      exponential_sleep_multiplier: float, factor to use on subsequent retries.
      jitter_ms: int, random (up to the value) additional sleep between retries.
      wait_ceiling_ms: int, Maximum wait between retries.
      sleep_ms: int or iterable: for how long to wait between trials.
  
    Returns:
      poller.GetResult(operation).
  
    Raises:
      AbortWaitError: if ctrl-c was pressed.
      TimeoutError: if retryer has finished wihout being done.
    
docstring: Waits with retrues for operation to be done given poller.
docstring_tokens: Waits with retrues for operation to be done given poller .
code: def WaitFor(poller, operation_ref, message,
              pre_start_sleep_ms=1000,
              max_retrials=None,
              max_wait_ms=1800000,
              exponential_sleep_multiplier=1.4,
              jitter_ms=1000,
              wait_ceiling_ms=180000,
              sleep_ms=2000):
    """Waits with retrues for operation to be done given poller.
  
    Args:
      poller: OperationPoller, poller to use during retrials.
      operation_ref: object, passed to operation poller poll method.
      message: str, string to display for progress_tracker.
      pre_start_sleep_ms: int, Time to wait before making first poll request.
      max_retrials: int, max number of retrials before raising RetryException.
      max_wait_ms: int, number of ms to wait before raising WaitException.
      exponential_sleep_multiplier: float, factor to use on subsequent retries.
      jitter_ms: int, random (up to the value) additional sleep between retries.
      wait_ceiling_ms: int, Maximum wait between retries.
      sleep_ms: int or iterable: for how long to wait between trials.
  
    Returns:
      poller.GetResult(operation).
  
    Raises:
      AbortWaitError: if ctrl-c was pressed.
      TimeoutError: if retryer has finished wihout being done.
    """
    def _CtrlCHandler(unused_signal, unused_frame):
      raise AbortWaitError('Ctrl-C aborted wait.')
  
    try:
      with execution_utils.CtrlCSection(_CtrlCHandler):
        try:
          with progress_tracker.ProgressTracker(message) as tracker:
  
            if pre_start_sleep_ms:
              _SleepMs(pre_start_sleep_ms)
  
            def _StatusUpdate(unused_result, unused_status):
              tracker.Tick()
  
            retryer = retry.Retryer(
                max_retrials=max_retrials,
                max_wait_ms=max_wait_ms,
                exponential_sleep_multiplier=exponential_sleep_multiplier,
                jitter_ms=jitter_ms,
                wait_ceiling_ms=wait_ceiling_ms,
                status_update_func=_StatusUpdate)
  
            def _IsNotDone(operation, unused_state):
              return not poller.IsDone(operation)
  
            operation = retryer.RetryOnResult(
                func=poller.Poll,
                args=(operation_ref,),
                should_retry_if=_IsNotDone,
                sleep_ms=sleep_ms)
        except retry.WaitException:
          raise TimeoutError(
              'Operation {0} has not finished in {1} seconds. {2}'
              .format(operation_ref, int(max_wait_ms / 1000), _TIMEOUT_MESSAGE))
        except retry.MaxRetrialsException as e:
          raise TimeoutError(
              'Operation {0} has not finished in {1} seconds '
              'after max {2} retrials. {3}'
              .format(operation_ref,
                      int(e.state.time_passed_ms / 1000),
                      e.state.retrial,
                      _TIMEOUT_MESSAGE))
  
    except AbortWaitError:
      # Write this out now that progress tracker is done.
      sys.stderr.write('Aborting wait for operation {0}.\n'.format(operation_ref))
      raise
  
    return poller.GetResult(operation)
code_tokens: def WaitFor ( poller , operation_ref , message , pre_start_sleep_ms = 1000 , max_retrials = None , max_wait_ms = 1800000 , exponential_sleep_multiplier = 1.4 , jitter_ms = 1000 , wait_ceiling_ms = 180000 , sleep_ms = 2000 ) : def _CtrlCHandler ( unused_signal , unused_frame ) : raise AbortWaitError ( 'Ctrl-C aborted wait.' ) try : with execution_utils . CtrlCSection ( _CtrlCHandler ) : try : with progress_tracker . ProgressTracker ( message ) as tracker : if pre_start_sleep_ms : _SleepMs ( pre_start_sleep_ms ) def _StatusUpdate ( unused_result , unused_status ) : tracker . Tick ( ) retryer = retry . Retryer ( max_retrials = max_retrials , max_wait_ms = max_wait_ms , exponential_sleep_multiplier = exponential_sleep_multiplier , jitter_ms = jitter_ms , wait_ceiling_ms = wait_ceiling_ms , status_update_func = _StatusUpdate ) def _IsNotDone ( operation , unused_state ) : return not poller . IsDone ( operation ) operation = retryer . RetryOnResult ( func = poller . Poll , args = ( operation_ref , ) , should_retry_if = _IsNotDone , sleep_ms = sleep_ms ) except retry . WaitException : raise TimeoutError ( 'Operation {0} has not finished in {1} seconds. {2}' . format ( operation_ref , int ( max_wait_ms / 1000 ) , _TIMEOUT_MESSAGE ) ) except retry . MaxRetrialsException as e : raise TimeoutError ( 'Operation {0} has not finished in {1} seconds ' 'after max {2} retrials. {3}' . format ( operation_ref , int ( e . state . time_passed_ms / 1000 ) , e . state . retrial , _TIMEOUT_MESSAGE ) ) except AbortWaitError : sys . stderr . write ( 'Aborting wait for operation {0}.\n' . format ( operation_ref ) ) raise return poller . GetResult ( operation )
short_docstring: Waits with retrues for operation to be done given poller.
short_docstring_tokens: Waits with retrues for operation to be done given poller .
comment: """Waits with retrues for operation to be done given poller.
  
    Args:
      poller: OperationPoller, poller to use during retrials.
      operation_ref: object, passed to operation poller poll method.
      message: str, string to display for progress_tracker.
      pre_start_sleep_ms: int, Time to wait before making first poll request.
      max_retrials: int, max number of retrials before raising RetryException.
      max_wait_ms: int, number of ms to wait before raising WaitException.
      exponential_sleep_multiplier: float, factor to use on subsequent retries.
      jitter_ms: int, random (up to the value) additional sleep between retries.
      wait_ceiling_ms: int, Maximum wait between retries.
      sleep_ms: int or iterable: for how long to wait between trials.
  
    Returns:
      poller.GetResult(operation).
  
    Raises:
      AbortWaitError: if ctrl-c was pressed.
      TimeoutError: if retryer has finished wihout being done.
    """$SEP$# Write this out now that progress tracker is done.