- Timestamp:
- 06/23/09 11:35:41 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server.Core/3.2/JobManager.cs
r2005 r2082 73 73 public void ResetJobsDependingOnResults(Job job) { 74 74 ISession session = factory.GetSessionForCurrentThread(); 75 ITransaction tx = null; 75 76 76 77 try { … … 78 79 session.GetDataAdapter<Job, IJobAdapter>(); 79 80 80 JobResult lastJobResult = GetLastJobResult(job); 81 if (lastJobResult != null) { 82 job.Percentage = lastJobResult.Percentage; 83 job.SerializedJob = lastJobResult.Result; 84 } else { 85 job.Percentage = 0; 86 } 87 88 job.Client = null; 89 job.State = State.offline; 90 91 jobAdapter.Update(job); 81 tx = session.BeginTransaction(); 82 83 if (job != null) { 84 ComputableJob computableJob = 85 new ComputableJob(); 86 computableJob.JobInfo = 87 job; 88 89 JobResult lastJobResult = GetLastJobResult(job); 90 if (lastJobResult != null) { 91 computableJob.JobInfo.Percentage = lastJobResult.Percentage; 92 computableJob.SerializedJob = lastJobResult.Result; 93 94 jobAdapter.UpdateComputableJob(computableJob); 95 } else { 96 computableJob.JobInfo.Percentage = 0; 97 } 98 99 computableJob.JobInfo.Client = null; 100 computableJob.JobInfo.State = State.offline; 101 102 jobAdapter.Update(computableJob.JobInfo); 103 } 104 105 tx.Commit(); 106 } 107 catch (Exception ex) { 108 if (tx != null) 109 tx.Rollback(); 110 throw ex; 92 111 } 93 112 finally { … … 185 204 /// <param name="job"></param> 186 205 /// <returns></returns> 187 public ResponseObject<Job> AddNewJob( Job job) {206 public ResponseObject<Job> AddNewJob(ComputableJob job) { 188 207 ISession session = factory.GetSessionForCurrentThread(); 189 208 … … 194 213 ResponseObject<Job> response = new ResponseObject<Job>(); 195 214 196 if (job != null ) {197 if (job. State != State.offline) {215 if (job != null && job.JobInfo != null) { 216 if (job.JobInfo.State != State.offline) { 198 217 response.Success = false; 199 218 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOBSTATE_MUST_BE_OFFLINE; 200 219 return response; 201 220 } 202 if (job. Id != Guid.Empty) {221 if (job.JobInfo.Id != Guid.Empty) { 203 222 response.Success = false; 204 223 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_ID_MUST_NOT_BE_SET; … … 211 230 } 212 231 213 job. DateCreated = DateTime.Now;214 jobAdapter.Update (job);232 job.JobInfo.DateCreated = DateTime.Now; 233 jobAdapter.UpdateComputableJob(job); 215 234 response.Success = true; 216 response.Obj = job ;235 response.Obj = job.JobInfo; 217 236 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_ADDED; 218 237 } else {
Note: See TracChangeset
for help on using the changeset viewer.