Changeset 1141
- Timestamp:
- 01/15/09 15:56:08 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.Hive.Server.Core
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server.Core/ClientCommunicator.cs
r1139 r1141 33 33 using HeuristicLab.Hive.JobBase; 34 34 using System.Runtime.CompilerServices; 35 using HeuristicLab.Hive.Server.Core.InternalInterfaces; 35 36 36 37 namespace HeuristicLab.Hive.Server.Core { … … 46 47 IJobResultsAdapter jobResultAdapter; 47 48 ILifecycleManager lifecycleManager; 49 IInternalJobManager jobManager; 48 50 49 51 /// <summary> … … 57 59 jobResultAdapter = ServiceLocator.GetJobResultsAdapter(); 58 60 lifecycleManager = ServiceLocator.GetLifecycleManager(); 61 jobManager = ServiceLocator.GetJobManager() as 62 IInternalJobManager; 59 63 60 64 lifecycleManager.RegisterHeartbeat( … … 90 94 foreach (Job job in allJobs) { 91 95 if (job.Client.ClientId == client.ClientId) { 92 resetJobsDependingOnResults(job);96 jobManager.ResetJobsDependingOnResults(job); 93 97 } 94 98 } … … 108 112 } 109 113 110 private void resetJobsDependingOnResults(Job job) {111 List<JobResult> allJobResults = new List<JobResult>(jobResultAdapter.GetAll());112 JobResult lastJobResult = null;113 foreach (JobResult jR in allJobResults) {114 if (jR.Job != null && jR.Job.Id == job.Id) {115 if (lastJobResult != null) {116 // if lastJobResult was before the current jobResult the lastJobResult must be updated117 if ((jR.timestamp.Subtract(lastJobResult.timestamp)).Seconds > 0)118 lastJobResult = jR;119 }120 }121 }122 if (lastJobResult != null) {123 job.Client = null;124 job.Percentage = lastJobResult.Percentage;125 job.State = State.idle;126 job.SerializedJob = lastJobResult.Result;127 } else {128 job.Client = null;129 job.Percentage = 0;130 job.State = State.idle;131 }132 jobAdapter.Update(job);133 }134 135 114 #region IClientCommunicator Members 136 115 … … 338 317 foreach (Job job in allJobs) { 339 318 if (job.Client.ClientId == client.ClientId) { 340 resetJobsDependingOnResults(job);319 jobManager.ResetJobsDependingOnResults(job); 341 320 } 342 321 } -
trunk/sources/HeuristicLab.Hive.Server.Core/HeuristicLab.Hive.Server.Core.csproj
r1120 r1141 82 82 <Compile Include="InternalInterfaces\DataAccess\IUserAdapter.cs" /> 83 83 <Compile Include="InternalInterfaces\DataAccess\IUserGroupAdapter.cs" /> 84 <Compile Include="InternalInterfaces\IInternalJobManager.cs" /> 84 85 <Compile Include="JobManager.cs" /> 85 86 <Compile Include="LifecycleManager.cs" /> -
trunk/sources/HeuristicLab.Hive.Server.Core/JobManager.cs
r1139 r1141 28 28 using HeuristicLab.Hive.Contracts; 29 29 using HeuristicLab.Hive.Server.Core.InternalInterfaces.DataAccess; 30 using HeuristicLab.Hive.Server.Core.InternalInterfaces; 30 31 31 32 namespace HeuristicLab.Hive.Server.Core { 32 class JobManager: IJobManager {33 class JobManager: IJobManager, IInternalJobManager { 33 34 34 35 IJobAdapter jobAdapter; … … 48 49 } 49 50 50 p rivate void resetJobsDependingOnResults(Job job) {51 public void ResetJobsDependingOnResults(Job job) { 51 52 List<JobResult> allJobResults = new List<JobResult>(jobResultAdapter.GetAll()); 52 53 JobResult lastJobResult = null; … … 77 78 foreach (Job curJob in allJobs) { 78 79 if (curJob.State == State.calculating) { 79 resetJobsDependingOnResults(curJob);80 ResetJobsDependingOnResults(curJob); 80 81 } 81 82 }
Note: See TracChangeset
for help on using the changeset viewer.