public JobStatus GetNewJobStatus(Job job) { JobStatus jobStatus = null; lock (jobIDJobStatusDictionary) { if (jobIDJobStatusDictionary.ContainsKey(job.jobID)) { jobStatus = jobIDJobStatusDictionary[job.jobID]; } else { jobStatus = new JobStatus(); jobStatus.jobID = job.jobID; jobStatus.trialCount = 0; jobStatus.jobProgress = 0; jobStatus.jobStatusType = JobStatusType.PROCESSING; jobIDJobStatusDictionary.Add(job.jobID, jobStatus); } } return jobStatus; }
public bool OnJobProgress(JobStatus jobStatus) { Job job = null; if (jobDicByJobID.ContainsKey(jobStatus.jobID)) { job = jobDicByJobID[jobStatus.jobID]; Client client = clientManager.GetClientByClientKey(job.clientKey); if (client != null) { AsyncServerClientJobProgressCastMessage msg = new AsyncServerClientJobProgressCastMessage(); msg.jobStatus = jobStatus; if (!client.GetAsyncComm().SendCast(msg)) Console.WriteLine("[Error] SendCast failed!"); return true; } else { return false; } } return false; }
public JobStatus GetNewJobStatus(Job job) { JobStatus jobStatus = new JobStatus(); jobStatus.jobID = job.jobID; jobStatus.jobProgress = 0; jobStatus.trialCount = 0; jobStatus.jobStatusType = JobStatusType.WAITING; jobStatusDicByJobID.Add(jobStatus.jobID, jobStatus); return jobStatus; }
public JobStatus GetJobStatusClone(int jobID) { lock(jobIDJobStatusDictionary) { if (jobIDJobStatusDictionary.ContainsKey(jobID)) { JobStatus jobStatus = jobIDJobStatusDictionary[jobID]; JobStatus newJobStatus = new JobStatus(); newJobStatus.jobID = jobStatus.jobID; newJobStatus.jobProgress = jobStatus.jobProgress; newJobStatus.jobStatusType = jobStatus.jobStatusType; return newJobStatus; } else return null; } }