Changeset 1139
- Timestamp:
- 01/15/09 15:50:43 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.Hive.Server.Core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server.Core/ClientCommunicator.cs
r1137 r1139 130 130 job.State = State.idle; 131 131 } 132 jobAdapter.Update(job); 132 133 } 133 134 -
trunk/sources/HeuristicLab.Hive.Server.Core/JobManager.cs
r1133 r1139 33 33 34 34 IJobAdapter jobAdapter; 35 IJobResultsAdapter jobResultAdapter; 35 36 ILifecycleManager lifecycleManager; 36 37 … … 39 40 public JobManager() { 40 41 jobAdapter = ServiceLocator.GetJobAdapter(); 42 jobResultAdapter = ServiceLocator.GetJobResultsAdapter(); 41 43 42 44 lifecycleManager = ServiceLocator.GetLifecycleManager(); … … 46 48 } 47 49 50 private void resetJobsDependingOnResults(Job job) { 51 List<JobResult> allJobResults = new List<JobResult>(jobResultAdapter.GetAll()); 52 JobResult lastJobResult = null; 53 foreach (JobResult jR in allJobResults) { 54 if (jR.Job != null && jR.Job.Id == job.Id) { 55 if (lastJobResult != null) { 56 // if lastJobResult was before the current jobResult the lastJobResult must be updated 57 if ((jR.timestamp.Subtract(lastJobResult.timestamp)).Seconds > 0) 58 lastJobResult = jR; 59 } 60 } 61 } 62 if (lastJobResult != null) { 63 job.Client = null; 64 job.Percentage = lastJobResult.Percentage; 65 job.State = State.idle; 66 job.SerializedJob = lastJobResult.Result; 67 } else { 68 job.Client = null; 69 job.Percentage = 0; 70 job.State = State.idle; 71 } 72 jobAdapter.Update(job); 73 } 74 48 75 void checkForDeadJobs() { 49 76 List<Job> allJobs = new List<Job>(jobAdapter.GetAll()); 50 77 foreach (Job curJob in allJobs) { 51 78 if (curJob.State == State.calculating) { 52 // TODO check for job results 53 curJob.State = State.idle; 54 curJob.Percentage = 0; 55 curJob.Client = null; 79 resetJobsDependingOnResults(curJob); 56 80 } 57 81 }
Note: See TracChangeset
for help on using the changeset viewer.