// GetJobState implements the corresponding RPC method, see the proto doc.
420045
func (impl *adminImpl) GetJobState(c context.Context, id *api.JobID) (*api.JobState, error) {
	job, err := impl.ctl.GetJob(c, mapper.JobID(id.JobId))
	if err != nil {
		return nil, toStatus(err)
	}
	cfg := &api.JobConfig{}
	if err := proto.Unmarshal(job.Config.Params, cfg); err != nil {
		return nil, toStatus(errors.Annotate(err, "failed to unmarshal JobConfig").Err())
	}
	info, err := job.FetchInfo(c)
	if err != nil {
		return nil, toStatus(err)
	}
	return &api.JobState{Config: cfg, Info: info}, nil
}
519470
func (asyncResult *AsyncResult) GetState() *tasks.TaskState {
	if asyncResult.taskState.IsCompleted() {
		return asyncResult.taskState
	}

	taskState, err := asyncResult.backend.GetState(asyncResult.Signature.UUID)
	if err == nil {
		asyncResult.taskState = taskState
	}

	return asyncResult.taskState
}
1028898
func (s *JobListEntry) SetJobState(v string) *JobListEntry {
	s.JobState = &v
	return s
}
279583
func (ps *PeerState) GetRoundState() *cstypes.PeerRoundState {
	ps.mtx.Lock()
	defer ps.mtx.Unlock()

	prs := ps.PRS // copy
	return &prs
}
585310
func (p *ReadOnlySchedulerClient) GetJobUpdateDiff(ctx context.Context, request *JobUpdateRequest) (r *Response, err error) {
  var _args74 ReadOnlySchedulerGetJobUpdateDiffArgs
  _args74.Request = request
  var _result75 ReadOnlySchedulerGetJobUpdateDiffResult
  if err = p.Client_().Call(ctx, "getJobUpdateDiff", &_args74, &_result75); err != nil {
    return
  }
  return _result75.GetSuccess(), nil
}
241969
func (ls *LogsService) GetByJob(jobId uint) (*Log, *http.Response, error) {
	u, err := urlWithOptions(fmt.Sprintf("/jobs/%d/log", jobId), nil)
	if err != nil {
		return nil, nil, err
	}

	req, err := ls.client.NewRequest("GET", u, nil, nil)
	if err != nil {
		return nil, nil, err
	}

	var plainText bytes.Buffer
	resp, err := ls.client.Do(req, &plainText)
	if err != nil {
		return nil, resp, err
	}

	return &Log{JobId: jobId, Body: plainText.String()}, resp, err
}
404513
func (b *Backend) GetState(taskUUID string) (*tasks.TaskState, error) {
	state := &tasks.TaskState{}
	err := b.tasksCollection.FindOne(context.Background(), bson.M{"_id": taskUUID}).Decode(state)

	if err != nil {
		return nil, err
	}
	return state, nil
}
753652
func (s *state) GetState(namespace string, key string) ([]byte, error) {
	values, err := s.GetStateMultipleKeys(namespace, []string{key})
	if err != nil {
		return nil, err
	}
	if len(values) == 0 {
		return nil, nil
	}
	return values[0], nil
}
234975
func (cs *CloudStackClient) GetAsyncJobResult(jobid string, timeout int64) (json.RawMessage, error) {
	var timer time.Duration
	currentTime := time.Now().Unix()

	for {
		p := cs.Asyncjob.NewQueryAsyncJobResultParams(jobid)
		r, err := cs.Asyncjob.QueryAsyncJobResult(p)
		if err != nil {
			return nil, err
		}

		// Status 1 means the job is finished successfully
		if r.Jobstatus == 1 {
			return r.Jobresult, nil
		}

		// When the status is 2, the job has failed
		if r.Jobstatus == 2 {
			if r.Jobresulttype == "text" {
				return nil, fmt.Errorf(string(r.Jobresult))
			} else {
				return nil, fmt.Errorf("Undefined error: %s", string(r.Jobresult))
			}
		}

		if time.Now().Unix()-currentTime > timeout {
			return nil, AsyncTimeoutErr
		}

		// Add an (extremely simple) exponential backoff like feature to prevent
		// flooding the CloudStack API
		if timer < 15 {
			timer++
		}

		time.Sleep(timer * time.Second)
	}
}
1253204
func (p *ReadOnlySchedulerClient) GetJobUpdateDetails(ctx context.Context, query *JobUpdateQuery) (r *Response, err error) {
  var _args72 ReadOnlySchedulerGetJobUpdateDetailsArgs
  _args72.Query = query
  var _result73 ReadOnlySchedulerGetJobUpdateDetailsResult
  if err = p.Client_().Call(ctx, "getJobUpdateDetails", &_args72, &_result73); err != nil {
    return
  }
  return _result73.GetSuccess(), nil
}
249631
func (d *DeploymentStatusRequest) GetState() string {
	if d == nil || d.State == nil {
		return ""
	}
	return *d.State
}
1180647
func (c *Host) GetJob(id string) (*host.ActiveJob, error) {
	var res host.ActiveJob
	err := c.c.Get(fmt.Sprintf("/host/jobs/%s", id), &res)
	return &res, err
}
1142568
func (s *server) GetState() string {
	s.mutex.RLock()
	defer s.mutex.RUnlock()
	return fmt.Sprintf("Name: %s, State: %s, Term: %v, CommitedIndex: %v ", s.name, s.state, s.currentTerm, s.log.commitIndex)
}
1112532
func (m TaskManager) GetDebugState(c context.Context, ctl task.ControllerReadOnly) (*internal.DebugManagerState, error) {
	return nil, fmt.Errorf("no debug state")
}
350972
func (job *QorJob) GetJob() *Job {
	if job.Job != nil {
		return job.Job
	}
	return nil
}
767156
func (vm *VM) GetState() (string, error) {
	if vm.MockGetState != nil {
		return vm.MockGetState()
	}
	return "", lvm.ErrNotImplemented
}
391279
func (e *engineImpl) execTriageJobStateTask(c context.Context, tqTask proto.Message) (err error) {
	jobID := tqTask.(*internal.TriageJobStateTask).JobId

	c = logging.SetField(c, "JobID", jobID)

	op := triageOp{
		jobID:              jobID,
		dispatcher:         e.cfg.Dispatcher,
		policyFactory:      policy.New,
		maxAllowedTriggers: 1000, // experimentally derived number
		enqueueInvocations: func(c context.Context, job *Job, req []task.Request) error {
			_, err := e.enqueueInvocations(c, job, req)
			return err
		},
	}

	// Store the triage log no matter what (even if 'prepare' fails or the
	// transaction fails to land). We want to surface these conditions if they
	// happen consistently.
	defer func() { op.finalize(c, err == nil) }()

	if err = op.prepare(c); err != nil {
		return err
	}

	err = e.jobTxn(c, jobID, func(c context.Context, job *Job, isNew bool) error {
		if isNew {
			logging.Warningf(c, "The job is unexpectedly gone")
			return errSkipPut
		}
		return op.transaction(c, job)
	})
	if err != nil {
		op.debugErrLog(c, err, "The triage transaction FAILED")
	}
	return err
}