- Timestamp:
- 04/16/09 17:33:09 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server.Core/3.2/JobManager.cs
r1530 r1577 254 254 255 255 try { 256 256 IJobAdapter jobAdapter = session.GetDataAdapter<Job, IJobAdapter>(); 257 258 Job job = jobAdapter.GetById(jobId); 259 if (job.State == State.requestSnapshot) { 260 response.Success = true; 261 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_REQUEST_ALLREADY_SET; 262 return response; // no commit needed 263 } 264 if (job.State != State.calculating) { 265 response.Success = false; 266 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_IS_NOT_BEEING_CALCULATED; 267 return response; // no commit needed 268 } 269 // job is in correct state 270 job.State = State.requestSnapshot; 271 jobAdapter.Update(job); 272 273 response.Success = true; 274 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_REQUEST_SET; 257 275 258 276 return response; … … 265 283 266 284 public Response AbortJob(Guid jobId) { 267 throw new NotImplementedException(); 285 ISession session = factory.GetSessionForCurrentThread(); 286 Response response = new Response(); 287 288 try { 289 IJobAdapter jobAdapter = session.GetDataAdapter<Job, IJobAdapter>(); 290 291 Job job = jobAdapter.GetById(jobId); 292 if (job.State == State.abort) { 293 response.Success = true; 294 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_ABORT_REQUEST_ALLREADY_SET; 295 return response; // no commit needed 296 } 297 if (job.State != State.calculating) { 298 response.Success = false; 299 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_IS_NOT_BEEING_CALCULATED; 300 return response; // no commit needed 301 } 302 // job is in correct state 303 job.State = State.abort; 304 jobAdapter.Update(job); 305 306 response.Success = true; 307 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_ABORT_REQUEST_SET; 308 309 return response; 310 } 311 finally { 312 if (session != null) 313 session.EndSession(); 314 } 268 315 } 269 316
Note: See TracChangeset
for help on using the changeset viewer.