// Jobs mocks base method
773501
func (m *MockConfig) Jobs() []multiwatcher.MachineJob {
	ret := m.ctrl.Call(m, "Jobs")
	ret0, _ := ret[0].([]multiwatcher.MachineJob)
	return ret0
}
646371
func (k8s *Kubernetes) Run(qorJob worker.QorJobInterface) error {
	job := qorJob.GetJob()

	if job.Handler != nil {
		return job.Handler(qorJob.GetSerializableArgument(qorJob), qorJob)
	}

	return errors.New("no handler found for job " + job.Name)
}
86574
func (api *MachinerAPI) Jobs(args params.Entities) (params.JobsResults, error) {
	result := params.JobsResults{
		Results: make([]params.JobsResult, len(args.Entities)),
	}

	canRead, err := api.getCanRead()
	if err != nil {
		return result, err
	}

	for i, agent := range args.Entities {
		tag, err := names.ParseMachineTag(agent.Tag)
		if err != nil {
			result.Results[i].Error = common.ServerError(err)
			continue
		}

		if !canRead(tag) {
			result.Results[i].Error = common.ServerError(common.ErrPerm)
			continue
		}

		machine, err := api.getMachine(tag)
		if err != nil {
			result.Results[i].Error = common.ServerError(err)
			continue
		}
		machineJobs := machine.Jobs()
		jobs := make([]multiwatcher.MachineJob, len(machineJobs))
		for i, job := range machineJobs {
			jobs[i] = job.ToParams()
		}
		result.Results[i].Jobs = jobs
	}
	return result, nil
}
482342
func (job *MapOnlyJob) Run() error {
	if job.NewMapperF == nil {
		return errors.New("MapOnlyJob: NewMapperF undefined!")
	}
	if job.Source == nil {
		return errors.New("MapOnlyJob: Source undefined!")
	}
	totalPart := 0
	endss := make([][]chan error, 0, len(job.Source))
	for i := range job.Source {
		partCount, err := job.Source[i].PartCount()
		if err != nil {
			return err
		}
		ends := make([]chan error, 0, partCount)
		for part := 0; part < partCount; part++ {
			end := make(chan error, 1)
			ends = append(ends, end)
			go func(i, part, totalPart int, end chan error) {
				end <- func() error {
					mapper := job.NewMapperF(i, part)
					key, val := mapper.NewKey(), mapper.NewVal()
					cs := make([]sophie.Collector, 0, len(job.Dest))
					for _, dst := range job.Dest {
						c, err := dst.Collector(totalPart)
						if err != nil {
							return errorsp.WithStacksAndMessage(err, "open collector for source %d part %d failed", i, part)
						}
						defer c.Close()
						cs = append(cs, c)
					}
					iter, err := job.Source[i].Iterator(part)
					if err != nil {
						return errorsp.WithStacksAndMessage(err, " open source %d part %d failed", i, part)
					}
					defer iter.Close()

					for {
						if err := iter.Next(key, val); err != nil {
							if errorsp.Cause(err) != io.EOF {
								return errorsp.WithStacksAndMessage(err, "next failed")
							}
							break
						}
						if err := mapper.Map(key, val, cs); err != nil {
							if errorsp.Cause(err) == EOM {
								log.Print("EOM returned, exit early")
								break
							}
							return errorsp.WithStacksAndMessage(err, "mapping %v %v failed", key, val)
						}
					}
					return errorsp.WithStacksAndMessage(mapper.MapEnd(cs), "map end failed")
				}()
			}(i, part, totalPart, end)
			totalPart++
		}
		endss = append(endss, ends)
	}
	var errReturned error
	for _, ends := range endss {
		for part, end := range ends {
			log.Printf("Waiting for mapper %d...", part)
			if err := <-end; err != nil {
				log.Printf("Error returned for part %d: %v", part, err)
				errReturned = err
			}
			log.Printf("No error for mapper %d...", part)
		}
	}
	return errReturned
}
1220830
func (s *Scheduler) RunAll() {
	for i := 0; i < s.size; i++ {
		s.jobs[i].run()
	}
}
1330732
func (j *Jobs) Evaluations(jobID string, q *QueryOptions) ([]*Evaluation, *QueryMeta, error) {
	var resp []*Evaluation
	qm, err := j.client.query("/v1/job/"+jobID+"/evaluations", &resp, q)
	if err != nil {
		return nil, nil, err
	}
	sort.Sort(EvalIndexSort(resp))
	return resp, qm, nil
}
127686
func (m *MockRunner) Run(arg0 txn.TransactionSource) error {
	ret := m.ctrl.Call(m, "Run", arg0)
	ret0, _ := ret[0].(error)
	return ret0
}
1340127
func (m *MockInterface) Scheduling() v1beta110.SchedulingV1beta1Interface {
	ret := m.ctrl.Call(m, "Scheduling")
	ret0, _ := ret[0].(v1beta110.SchedulingV1beta1Interface)
	return ret0
}
518960
func (j *Job) run() (result []reflect.Value, err error) {
	f := reflect.ValueOf(j.funcs[j.jobFunc])
	params := j.fparams[j.jobFunc]
	if len(params) != f.Type().NumIn() {
		err = errors.New("the number of param is not adapted")
		return
	}
	in := make([]reflect.Value, len(params))
	for k, param := range params {
		in[k] = reflect.ValueOf(param)
	}
	result = f.Call(in)
	j.lastRun = time.Now()
	j.scheduleNextRun()
	return
}
20361
func (jenkins *Jenkins) GetJobs() ([]Job, error) {
	var payload = struct {
		Jobs []Job `json:"jobs"`
	}{}
	err := jenkins.get("", nil, &payload)
	return payload.Jobs, err
}
1251318
func (w *workManager) Work(j job) queuedJob {
	qj := newQueuedJob(j)
	switch j.Type() {
	case collectJobType:
		w.collectq.Event <- qj
	case processJobType:
		w.processq.Event <- qj
	case publishJobType:
		w.publishq.Event <- qj
	}
	return qj
}
1196667
func (m *MockCoreV1Interface) Services(arg0 string) v11.ServiceInterface {
	ret := m.ctrl.Call(m, "Services", arg0)
	ret0, _ := ret[0].(v11.ServiceInterface)
	return ret0
}
934668
func (ts *taskScheduler) Work() {
	for _, r := range ts.runners {
		r.Start()
		if r.IsIdle() {
			// Ran out of jobs to start.
			break
		}
	}
}
912636
func (j *Jobs) Register(job *Job, q *WriteOptions) (*JobRegisterResponse, *WriteMeta, error) {
	return j.RegisterOpts(job, nil, q)
}
270351
func (m *MockInstallation) Job() installation.InstalledJob {
	ret := m.ctrl.Call(m, "Job")
	ret0, _ := ret[0].(installation.InstalledJob)
	return ret0
}
1289296
func (j *Jobs) Versions(jobID string, diffs bool, q *QueryOptions) ([]*Job, []*JobDiff, *QueryMeta, error) {
	var resp JobVersionsResponse
	qm, err := j.client.query(fmt.Sprintf("/v1/job/%s/versions?diffs=%v", jobID, diffs), &resp, q)
	if err != nil {
		return nil, nil, nil, err
	}
	return resp.Versions, resp.Diffs, qm, nil
}
525943
func (mr *MockBuilderMockRecorder) Build(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Build", reflect.TypeOf((*MockBuilder)(nil).Build), arg0, arg1, arg2, arg3, arg4)
}