Changeset 5636 for branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs
- Timestamp:
- 03/08/11 14:54:17 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs
r5633 r5636 36 36 public Guid AddJob(Job job, JobData jobData, IEnumerable<Guid> resourceIds) { 37 37 using (trans.OpenTransaction()) { 38 job.SetState(JobState.Waiting, auth.UserId);39 38 job.Id = dao.AddJob(job); 40 39 jobData.JobId = job.Id; … … 48 47 } 49 48 dao.AddJobData(jobData); 49 dao.UpdateJobState(job.Id, JobState.Waiting, null, auth.UserId, null); 50 50 return jobData.JobId; 51 51 } … … 135 135 } 136 136 137 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 138 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 139 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 140 public Job UpdateJobState(Guid jobId, JobState jobState, Guid? slaveId, Guid? userId, string exception) { 141 using (trans.OpenTransaction()) { 142 return dao.UpdateJobState(jobId, jobState, slaveId, userId, exception); 143 } 144 } 137 145 #endregion 138 146 … … 235 243 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 236 244 public List<MessageContainer> Heartbeat(Heartbeat heartbeat) { 237 TriggerLifecycle( );245 TriggerLifecycle(false); 238 246 239 247 using (trans.OpenTransaction()) { … … 391 399 } 392 400 393 public void TriggerLifecycle( ) {401 public void TriggerLifecycle(bool force) { 394 402 using (trans.OpenTransaction()) { 395 403 DateTime lastCleanup = dao.GetLastCleanup(); 396 if ( DateTime.Now - lastCleanup > TimeSpan.FromSeconds(59)) {404 if (force || DateTime.Now - lastCleanup > TimeSpan.FromSeconds(59)) { 397 405 dao.SetLastCleanup(DateTime.Now); 398 406 lifecycleManager.Cleanup();
Note: See TracChangeset
for help on using the changeset viewer.