Gets result back from Salesforce as whatever type was originally sent in create_batch (xml, or csv).
        :param job_id:
        :param batch_id:
        :param result_id:
436485
def get_batch_result(self, job_id, batch_id, result_id):
        
        response = requests.get(self._get_batch_result_url(job_id, batch_id, result_id),
                                headers=self._get_session_headers())
        response.raise_for_status()

        return response.content
609628
def get(self, id):
        
        self.cur.execute("SELECT * FROM jobs WHERE hash=?", (id,))
        item = self.cur.fetchone()
        if item:
            return dict(zip(
                ("id", "description", "last-run", "next-run", "last-run-result"),
                item))

        return None
583591
def create_job(project_id, data, opts = {})
      data, _status_code, _headers = create_job_with_http_info(project_id, data, opts)
      return data
    end
1284024
def get_job(id_or_uri, opts = {})
      data, _status_code, _headers = get_job_with_http_info(id_or_uri, opts)
      return data
    end
1062737
def job(project_id, job_id, opts = {})
      data, _status_code, _headers = job_with_http_info(project_id, job_id, opts)
      return data
    end
543730
def after_run(self, result_id):
        
        self.local_project.set_remote_id_after_send(result_id)
        self.settings.project_id = result_id
929020
def get_async_job(self, job_id):
        
        uri = "/ws/sci/{0}".format(job_id)
        # TODO: do parsing here?
        return self._conn.get(uri)
346722
async def send_job_result(self, job_id: BackendJobId, result: str, text: str = "", grade: float = None, problems: Dict[str, SPResult] = None,
                              tests: Dict[str, Any] = None, custom: Dict[str, Any] = None, state: str = "", archive: Optional[bytes] = None,
                              stdout: Optional[str] = None, stderr: Optional[str] = None):
        
        if job_id not in self.__running_job:
            raise JobNotRunningException()
        del self.__running_job[job_id]

        if grade is None:
            if result == "success":
                grade = 100.0
            else:
                grade = 0.0
        if problems is None:
            problems = {}
        if custom is None:
            custom = {}
        if tests is None:
            tests = {}

        await ZMQUtils.send(self.__backend_socket, AgentJobDone(job_id, (result, text), round(grade, 2), problems, tests, custom, state, archive, stdout, stderr))
475866
public function get($job_id)
    {
        $result = null;
        $this->hook->attach('job.get.before', $job_id, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $result = $this->getSession($job_id);
        $this->hook->attach('job.get.after', $job_id, $result, $this);
        return $result;
    }
266733
def get_all_results_from_jobs(user, j_id):
    

    job = v1_utils.verify_existence_and_get(j_id, _TABLE)

    if not user.is_in_team(job['team_id']) and not user.is_read_only_user():
        raise dci_exc.Unauthorized()

    # get testscases from tests_results
    query = sql.select([models.TESTS_RESULTS]). \
        where(models.TESTS_RESULTS.c.job_id == job['id'])
    all_tests_results = flask.g.db_conn.execute(query).fetchall()

    results = []
    for test_result in all_tests_results:
        test_result = dict(test_result)
        results.append({'filename': test_result['name'],
                        'name': test_result['name'],
                        'total': test_result['total'],
                        'failures': test_result['failures'],
                        'errors': test_result['errors'],
                        'skips': test_result['skips'],
                        'time': test_result['time'],
                        'regressions': test_result['regressions'],
                        'successfixes': test_result['successfixes'],
                        'success': test_result['success'],
                        'file_id': test_result['file_id']})

    return flask.jsonify({'results': results,
                          '_meta': {'count': len(results)}})
155887
def output(context, id):
    

    colors = {
        'pre-run': '\x1b[6;30;44m',
        'running': '\x1b[6;30;42m',
        'post-run': '\x1b[6;30;44m',
        'failure': '\x1b[6;30;41m'}
    result = job.list_jobstates(context, id=id, sort='created_at')
    jobstates = result.json()['jobstates']

    for js in jobstates:
        color = colors.get(js['status'], '')
        click.echo('%s[%s]\x1b[0m %s' % (
            color,
            js['status'],
            js['comment']))
        f_l = job.list_files(
            context,
            id=id,
            where='jobstate_id:' + js['id'],
            sort='created_at')
        for f in f_l.json()['files']:
            click.echo(dci_file.content(context, id=f['id']).text)
105940
def get_job_id(short=True):
    

    jobid = os.environ.get('PBS_JOBID', '')

    if short:
        # Strip off '.rman2'
        jobid = jobid.split('.')[0]

    return(jobid)
1112433
def _store_inserted_ids(self, mapping, job_id, local_ids_for_batch):
        """"""
        id_table_name = self._reset_id_table(mapping)
        conn = self.session.connection()
        for batch_id, local_ids in local_ids_for_batch.items():
            try:
                results_url = "{}/job/{}/batch/{}/result".format(
                    self.bulk.endpoint, job_id, batch_id
                )
                # Download entire result file to a temporary file first
                # to avoid the server dropping connections
                with _download_file(results_url, self.bulk) as f:
                    self.logger.info(
                        "  Downloaded results for batch {}".format(batch_id)
                    )
                    self._store_inserted_ids_for_batch(
                        f, local_ids, id_table_name, conn
                    )
                self.logger.info(
                    "  Updated {} for batch {}".format(id_table_name, batch_id)
                )
            except Exception:  # pragma: nocover
                # If we can't download one result file,
                # don't let that stop us from downloading the others
                self.logger.error(
                    "Could not download batch results: {}".format(batch_id)
                )
                continue
        self.session.commit()
1301970
def add_result(self, job):
        
        self.cur.execute(
            "INSERT INTO history VALUES(?,?,?,?)",
            (job["id"], job["description"], job["last-run"], job["last-run-result"]))

        return True
1237844
def job_success(self, job, queue, job_result):
        

        # display what was done
        obj = job.get_object()
        message = '[%s|%s] %s [%s]' % (queue.name.hget(),
                                       obj.pk.get(),
                                       job_result,
                                       threading.current_thread().name)
        self.log(message)

        # default stuff: update job and queue statuses, and do logging
        super(FullNameWorker, self).job_success(job, queue, job_result)

        # update the queue's dates
        queue_fields_to_update = {
            'last_job_date': str(datetime.utcnow())
        }
        if not queue.first_job_date.hget():
            queue_fields_to_update['first_job_date'] = queue_fields_to_update['last_job_date']
        queue.hmset(**queue_fields_to_update)

        # update the jobs counter on the queue
        queue.jobs_counter.hincrby(1)

        # save a ref to the job to display at the end of this example script
        self.jobs.append(int(job.pk.get()))
1246342
def post(self, result_id, project_id):
        """"""

        result = db.session.query(Result).filter_by(id=result_id).first()

        if result is None:
            return jsonify({
                'result': None,
                'message': 'No interface defined for URL.'
            }), 404

        job_status = CommandsState.job_status(result.path_name)
        if job_status != JobStatus.RUNNING:
            if job_status == JobStatus.NO_EXTENSION_ERROR:
                return jsonify({
                    'message': '\'CommandsExtension\' is not set or disabled.'
                }), 400
            elif job_status == JobStatus.INITIALIZED:
                return jsonify({
                    'message': 'The target training job has not run, yet'
                }), 400
            elif job_status == JobStatus.STOPPED:
                return jsonify({
                    'message': 'The target training job has already stopped'
                }), 400
            else:
                return jsonify({
                    'message': 'Cannot get the target training job status'
                }), 400

        request_json = request.get_json()
        if request_json is None:
            return jsonify({
                'message': 'Empty request.'
            }), 400

        command_name = request_json.get('name', None)
        if command_name is None:
            return jsonify({
                'message': 'Name is required.'
            }), 400

        schedule = request_json.get('schedule', None)
        if not CommandItem.is_valid_schedule(schedule):
            return jsonify({
                'message': 'Schedule is invalid.'
            }), 400

        command = CommandItem(
            name=command_name,
        )

        command.set_request(
            CommandItem.REQUEST_OPEN,
            request_json.get('body', None),
            request_json.get('schedule', None)
        )

        commands = CommandItem.load_commands(result.path_name)
        commands.append(command)

        CommandItem.dump_commands(commands, result.path_name)

        new_result = crawl_result(result, force=True)
        new_result_dict = new_result.serialize

        return jsonify({'commands': new_result_dict['commands']})
66362
def retrieve(self, request, project, pk=None):
        
        log = JobLog.objects.get(id=pk)
        return Response(self._log_as_dict(log))