Refresh the job and checks if it is complete.

        :type retry: :class:`google.api_core.retry.Retry`
        :param retry: (Optional) How to retry the RPC.

        :rtype: bool
        :returns: True if the job is complete, False otherwise.
431649
def done(self, retry=DEFAULT_RETRY):
        
        # Do not refresh is the state is already done, as the job will not
        # change once complete.
        if self.state != _DONE_STATE:
            self.reload(retry=retry)
        return self.state == _DONE_STATE
1090028
def do_work
      done = false

      while not done
        queue_runner(@concurrency, @delay, @retry_count, @progress)

        if @interactive and @verify
          done = verify_results(@group)
          # a retry means we are not done yet.
          done = false if done == 'retry'
        else
          done = true
        end
      end

      if not @verify
        failed_workers, results_display = get_results(group)
        exit 1 if failed_workers.size > 0
      end

      puts 'chimp run complete'
    end
1071933
def retry(self, retries=3, backoff_factor=0.3, status_forcelist=(500, 502, 504)):
        
        retries = Retry(
            total=retries,
            read=retries,
            connect=retries,
            backoff_factor=backoff_factor,
            status_forcelist=status_forcelist,
        )
        # mount all https requests
        self.mount('https://', adapters.HTTPAdapter(max_retries=retries))
1021937
def is_exhausted(self):
        
        retry_counts = (self.total, self.connect, self.read, self.redirect, self.status)
        retry_counts = list(filter(None, retry_counts))
        if not retry_counts:
            return False

        return min(retry_counts) < 0
396484
def is_retryable(err):
    
    if isinstance(err, ConnectionClosed):
        # NB: only retryable if we're not mid-streaming
        if err.mid_stream:
            return False
        else:
            return True
    elif isinstance(err, socket.error):
        code = err.args[0]
        return code in CONN_CLOSED_ERRORS
    else:
        return False
142754
def start(self):
        
        if not self.auto_retry:
            self.curl()
            return
        while not self.is_finished:
            try:
                self.curl()
            except pycurl.error as e:
                # transfer closed with n bytes remaining to read
                if e.args[0] == pycurl.E_PARTIAL_FILE:
                    pass
                # HTTP server doesn't seem to support byte ranges.
                # Cannot resume.
                elif e.args[0] == pycurl.E_HTTP_RANGE_ERROR:
                    break
                # Recv failure: Connection reset by peer
                elif e.args[0] == pycurl.E_RECV_ERROR:
                    if self._rst_retries < self.max_rst_retries:
                        pass
                    else:
                        raise e
                    self._rst_retries += 1
                else:
                    raise e
        self._move_path()
        self._done()
239117
def retry(self, queue=None, delay=None, max_retries=None):
        

        max_retries = max_retries
        if max_retries is None:
            max_retries = self.max_retries

        if self.data.get("retry_count", 0) >= max_retries:
            raise MaxRetriesInterrupt()

        exc = RetryInterrupt()

        exc.queue = queue or self.queue or self.data.get("queue") or "default"
        exc.retry_count = self.data.get("retry_count", 0) + 1
        exc.delay = delay
        if exc.delay is None:
            exc.delay = self.retry_delay

        self._attach_original_exception(exc)

        raise exc
401180
def _refresh_state(self):
    

    # DataFlow's DataflowPipelineResult does not refresh state, so we have to do it ourselves
    # as a workaround.
    self._runner_results._job = (
        self._runner_results._runner.dataflow_client.get_job(self._runner_results.job_id()))
    self._is_complete = self._runner_results.state in ['STOPPED', 'DONE', 'FAILED', 'CANCELLED']
    self._fator_error = getattr(self._runner_results._runner, 'last_error_msg', None)
176132
def retry(tries, delay=0, back_off=1, raise_msg=''):
    

    if back_off < 1:
        raise ValueError('back_off must be 1 or greater')

    tries = math.floor(tries)
    if tries < 0:
        raise ValueError('tries must be 0 or greater')

    if delay < 0:
        raise ValueError('delay must be 0 or greater')

    def deco_retry(f):
        def f_retry(*args, **kwargs):
            max_tries, max_delay = tries, delay  # make mutable

            while max_tries > 0:
                rv = f(*args, **kwargs)  # first attempt
                if rv:  # Done on success
                    return rv

                max_tries -= 1  # consume an attempt
                time.sleep(max_delay)  # wait...
                max_delay *= back_off  # make future wait longer
            else:
                if raise_msg:
                    raise Exception(raise_msg)
                return

        return f_retry  # true decorator -> decorated function

    return deco_retry
961356
def retry_on_exception(num_retries, base_delay=0, exc_type=Exception):
    
    def _retry_on_exception_inner_1(f):
        def _retry_on_exception_inner_2(*args, **kwargs):
            retries = num_retries
            multiplier = 1
            while True:
                try:
                    return f(*args, **kwargs)
                except exc_type:
                    if not retries:
                        raise

                delay = base_delay * multiplier
                multiplier += 1
                log("Retrying '%s' %d more times (delay=%s)" %
                    (f.__name__, retries, delay), level=INFO)
                retries -= 1
                if delay:
                    time.sleep(delay)

        return _retry_on_exception_inner_2

    return _retry_on_exception_inner_1
255945
def reload(self, callback=None, errback=None):
        
        return self.load(reload=True, callback=callback, errback=errback)
1032837
def start_with_retry(current_thread: false, **retryable_options)
      unless started?
        @retryable_options.set(retryable_options)
        start(current_thread: current_thread)
      end
      self
    end
34049
def (self):
        
        while True:
            message = self.res_queue.get()
            if message is None:
                _logger.debug(" thread is terminated")
                return
            self._(message)
1268696
async def retry_post(config, url, *args, **kwargs):
    
    return await _retry_do(config.session.post, url, *args,
                           **_make_headers(config, kwargs))
760542
def reset_for_retry(self, output_writer):
    
    self.input_reader = self.initial_input_reader
    self.slice_id = 0
    self.retries += 1
    self.output_writer = output_writer
    self.handler = self.mapreduce_spec.mapper.handler
88340
private void retry(String subTaskSpecId, MonitorEntry monitorEntry, TaskStatusPlus lastFailedTaskStatus)
  {
    synchronized (startStopLock) {
      if (running) {
        final SubTaskSpec<T> spec = monitorEntry.spec;
        final T task = spec.newSubTask(monitorEntry.taskHistory.size() + 1);
        log.info("Submitting a new task[%s] for retrying spec[%s]", task.getId(), spec.getId());
        indexingServiceClient.runTask(task);
        incrementNumRunningTasks();

        runningTasks.put(
            subTaskSpecId,
            monitorEntry.withNewRunningTask(
                task,
                indexingServiceClient.getTaskStatus(task.getId()).getStatus(),
                lastFailedTaskStatus
            )
        );
      }
    }
  }
60651
def retry(method):
    

    def inner(self, *args, **kwargs):
        attempt_number = 1
        while attempt_number < self.retries:
            try:
                return method(self, *args, **kwargs)
            except HasOffersException as exc:
                if 'API usage exceeded rate limit' not in str(exc):
                    raise exc
                self.logger.debug('Retrying due: %s', exc)
                time.sleep(self.retry_timeout)
            except requests.exceptions.ConnectionError:
                # This happens when the session gets expired
                self.logger.debug('Recreating session due to ConnectionError')
                self._session = requests.Session()
            attempt_number += 1
        raise MaxRetriesExceeded

    return inner