Get the result for a job. This will block if the job is incomplete.

    Returns:
      The result for the Job.

    Raises:
      An exception if the Job resulted in an exception.
327341
def result(self):
    
    self.wait()
    if self._fatal_error:
      raise self._fatal_error
    return self._result
54965
def end(self):
    
    if self._end_memoized_result is not None:
      return self._end_memoized_result
    if self._background_worker_pool:
      if self._aborted:
        self.log(Report.INFO, "Aborting background workers.")
        self._background_worker_pool.abort()
      else:
        self.log(Report.INFO, "Waiting for background workers to finish.")
        self._background_worker_pool.shutdown()
      self.end_workunit(self._background_root_workunit)

    self.shutdown_worker_pool()

    # Run a dummy work unit to write out one last timestamp.
    with self.new_workunit("complete"):
      pass

    self.end_workunit(self._main_root_workunit)

    outcome = self._main_root_workunit.outcome()
    if self._background_root_workunit:
      outcome = min(outcome, self._background_root_workunit.outcome())
    outcome_str = WorkUnit.outcome_string(outcome)
    log_level = RunTracker._log_levels[outcome]
    self.log(log_level, outcome_str)

    if self.run_info.get_info('outcome') is None:
      # If the goal is clean-all then the run info dir no longer exists, so ignore that error.
      self.run_info.add_info('outcome', outcome_str, ignore_errors=True)

    if self._target_to_data:
      self.run_info.add_info('target_data', self._target_to_data)

    self.report.close()
    self.store_stats()

    run_failed = outcome in [WorkUnit.FAILURE, WorkUnit.ABORTED]
    result = PANTS_FAILED_EXIT_CODE if run_failed else PANTS_SUCCEEDED_EXIT_CODE
    self._end_memoized_result = result
    return self._end_memoized_result
1282048
def get_job(self, job_name):
        
        for job in self.jobs:
            if job.name == job_name:
                return job
        logger.warn('Tried to find job with name {0}, but job not found'.format(job_name))
        return None
1133166
def done(self):
        
        return self._exception != self._SENTINEL or self._result != self._SENTINEL
433346
def getResults(self):
        

        results = self._response.copy()
        if 'status' in self._response.keys():
            if results['status'] is not None:
                del results['status']
            return results
        else:
            return None
1022113
async def status(self) -> JobStatus:
        
        if await self._redis.exists(result_key_prefix + self.job_id):
            return JobStatus.complete
        elif await self._redis.exists(in_progress_key_prefix + self.job_id):
            return JobStatus.in_progress
        else:
            score = await self._redis.zscore(queue_name, self.job_id)
            if not score:
                return JobStatus.not_found
            return JobStatus.deferred if score > timestamp_ms() else JobStatus.queued
398729
def get(self):
        
        try:
            item = self._queue.get_nowait()
        except (Empty, PersistEmpty):
            return None

        if self._persistence_path:
            self._queue.task_done()

        return item
436857
public T get() {
    Barrier2 bar = _barrier;
    if( bar != null )           // Barrier may be null if task already completed
      bar.join(); // Block on the *barrier* task, which blocks until the fjtask on*Completion code runs completely
    assert isStopped();
    if (_ex!=null)
      throw new RuntimeException((Throwable)AutoBuffer.javaSerializeReadPojo(_ex));
    // Maybe null return, if the started fjtask does not actually produce a result at this Key
    return _result==null ? null : _result.get(); 
  }
1132200
def finished(self):
    

    return self.__state in (Job.ERROR, Job.SUCCESS, Job.CANCELLED)
702528
def wait_for_job_to_finish(
            self,
            job_id,
            sec_to_sleep=5.0,
            max_retries=100000):
        

        not_done = True
        retry_attempt = 1
        while not_done:

            if self.debug:
                log.info(("JOBSTATUS getting job.id={} details")
                         .format(
                            job_id))

            response = self.get_job_by_id(job_id)

            if self.debug:
                log.info(("JOBSTATUS got job.id={} response={}")
                         .format(
                            job_id,
                            response))

            if response["status"] != SUCCESS:
                log.error(("JOBSTATUS failed to get job.id={} with error={}")
                          .format(
                            job_id,
                            response["error"]))
                return self.build_response(
                    status=ERROR,
                    error=response["error"],
                    data=response["data"])
            # stop if this failed getting the job details

            job_data = response.get(
                "data",
                None)

            if not job_data:
                return self.build_response(
                    status=ERROR,
                    error="failed to find job dictionary in response",
                    data=response["data"])

            job_status = job_data["status"]

            if job_status == "finished" \
               or job_status == "completed" \
               or job_status == "launched":

                if self.debug:
                    log.info(("job.id={} is done with status={}")
                             .format(
                                job_id,
                                job_status))

                result_id = job_data["predict_manifest"]["result_id"]

                if self.debug:
                    log.info(("JOBRESULT getting result.id={} details")
                             .format(
                                result_id))

                response = self.get_result_by_id(result_id)

                if self.debug:
                    log.info(("JOBRESULT got result.id={} response={}")
                             .format(
                                result_id,
                                response))

                if response["status"] != SUCCESS:
                    log.error(("JOBRESULT failed to get "
                               "result.id={} with error={}")
                              .format(
                                result_id,
                                response["error"]))
                    return self.build_response(
                        status=ERROR,
                        error=response["error"],
                        data=response["data"])
                # stop if this failed getting the result details

                result_data = response.get(
                    "data",
                    None)

                if result_data["status"] == "finished":
                    full_response = {
                        "job": job_data,
                        "result": result_data
                    }
                    not_done = False
                    return self.build_response(
                        status=SUCCESS,
                        error="",
                        data=full_response)
                else:
                    if retry_attempt % 100 == 0:
                        if self.verbose:
                            log.info(("result_id={} are not done retry={}")
                                     .format(
                                        result_id,
                                        retry_attempt))

                    retry_attempt += 1
                    if retry_attempt > max_retries:
                        err_msg = ("failed waiting "
                                   "for job.id={} result.id={} "
                                   "to finish").format(
                                    job_id,
                                    result_id)
                        log.error(err_msg)
                        return self.build_response(
                            status=ERROR,
                            error=err_msg)
                    else:
                        time.sleep(sec_to_sleep)
                    # wait while results are written to the db
            else:

                retry_attempt += 1
                if retry_attempt > max_retries:
                    err_msg = ("failed waiting "
                               "for job.id={} to finish").format(
                                   job_id)
                    log.error(err_msg)
                    return self.build_response(
                        status=ERROR,
                        error=err_msg)
                else:
                    if self.verbose:
                        if retry_attempt % 100 == 0:
                            log.info(("waiting on job.id={} retry={}")
                                     .format(
                                        job_id,
                                        retry_attempt))
                    # if logging just to show this is running
                    time.sleep(sec_to_sleep)
950992
def get_status(self):
        '''
        
        '''
        jobs = Job.objects.filter(push=self).filter(
            Q(failure_classification__isnull=True) |
            Q(failure_classification__name='not classified')).exclude(tier=3)

        status_dict = {}
        for (state, result, total) in jobs.values_list(
                'state', 'result').annotate(
                    total=Count('result')):
            if state == 'completed':
                status_dict[result] = total
            else:
                status_dict[state] = total
        if 'superseded' in status_dict:
            # backward compatability for API consumers
            status_dict['coalesced'] = status_dict['superseded']

        return status_dict
1194216
def _get_job_results(query=None):
    '''
    
    '''
    if not query:
        raise CommandExecutionError("Query parameters cannot be empty.")

    response = __proxy__['panos.call'](query)

    # If the response contains a job, we will wait for the results
    if 'result' in response and 'job' in response['result']:
        jid = response['result']['job']

        while get_job(jid)['result']['job']['status'] != 'FIN':
            time.sleep(5)

        return get_job(jid)
    else:
        return response
163456
def result(self):
        """"""
        msg = "Use get_result() which forces correct exception handling"
        warnings.warn(DeprecationWarning(msg), stacklevel=2)
        return self._result
522298
protected <T> TypedResult<T> handleMissingResult() {
		// check if the monitoring thread is still there
		// we need to wait until we know what is going on
		if (monitoringThread.isAlive()) {
			return TypedResult.empty();
		}
		// the job finished with an exception
		else if (executionException != null) {
			throw executionException;
		}
		// we assume that a bounded job finished
		else {
			return TypedResult.endOfStream();
		}
	}
910971
def _get_result(future, pipe, timeout):
    """"""
    counter = count(step=SLEEP_UNIT)

    try:
        while not pipe.poll(SLEEP_UNIT):
            if timeout is not None and next(counter) >= timeout:
                return TimeoutError('Task Timeout', timeout)
            elif future.cancelled():
                return CancelledError()

        return pipe.recv()
    except (EOFError, OSError):
        return ProcessExpired('Abnormal termination')
    except Exception as error:
        return error
620534
def get_finished_results(self):
        
        task_and_results = []
        for pending_result in self.pending_results:
            if pending_result.ready():
                ret = pending_result.get()
                task_id, result = ret
                task = self.task_id_to_task[task_id]
                # process any pending messages for this task (will also process other tasks messages)
                self.process_all_messages_in_queue()
                task.after_run(result)
                task_and_results.append((task, result))
                self.pending_results.remove(pending_result)
        return task_and_results
381697
async def result(self) -> T:
        
        try:
            event = await self.recv_event()
        except Component.Success as succ:
            # success was thrown; return the result
            result, = succ.args
            return cast(T, result)
        except Component.Failure as fail:
            # here we don't expect a wrapped result, so we unwrap the failure
            cause, = fail.args
            raise cause
        else:
            # there was a regular event; shouldn't happen/is exceptional
            raise Component.EventException(event)