- Timestamp:
- 01/21/09 16:22:25 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server.Core/ClientCommunicator.cs
r1158 r1160 80 80 void lifecycleManager_OnServerHeartbeat(object sender, EventArgs e) { 81 81 List<ClientInfo> allClients = new List<ClientInfo>(clientAdapter.GetAll()); 82 List<Job> allJobs = new List<Job>(jobAdapter.GetAll());83 82 84 83 foreach (ClientInfo client in allClients) { … … 89 88 client.State = State.offline; 90 89 clientAdapter.Update(client); 90 foreach (Job job in jobAdapter.GetJobsOf(client)) { 91 jobManager.ResetJobsDependingOnResults(job); 92 } 91 93 } else { 92 94 DateTime lastHbOfClient = lastHeartbeats[client.ClientId]; … … 98 100 if (client.State == State.calculating) { 99 101 // check wich job the client was calculating and reset it 100 foreach (Job job in allJobs) { 101 if (job.Client.ClientId == client.ClientId) { 102 jobManager.ResetJobsDependingOnResults(job); 103 } 102 foreach (Job job in jobAdapter.GetJobsOf(client)) { 103 jobManager.ResetJobsDependingOnResults(job); 104 104 } 105 105 } … … 195 195 196 196 if (hbData.jobProgress != null) { 197 List<Job> jobsOfClient = new List<Job>(jobAdapter.GetJobsOf(clientAdapter.GetById(hbData.ClientId))); 198 if (jobsOfClient == null || jobsOfClient.Count == 0) { 199 response.Success = false; 200 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_IS_NOT_BEEING_CALCULATED; 201 return response; 202 } 203 197 204 foreach (KeyValuePair<long, double> jobProgress in hbData.jobProgress) { 198 205 Job curJob = jobAdapter.GetById(jobProgress.Key); 199 curJob.Percentage = jobProgress.Value; 200 jobAdapter.Update(curJob); 206 if (curJob.Client == null || curJob.Client.ClientId != hbData.ClientId) { 207 response.Success = false; 208 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_IS_NOT_BEEING_CALCULATED; 209 } else { 210 curJob.Percentage = jobProgress.Value; 211 jobAdapter.Update(curJob); 212 } 201 213 } 202 214 } … … 228 240 response.Success = true; 229 241 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_PULLED; 230 return response; 242 } else { 243 response.Success = true; 244 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_NO_JOBS_LEFT; 231 245 } 232 246 233 247 jobLock.ReleaseMutex(); 234 235 response.Success = true; 236 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_NO_JOBS_LEFT; 248 /// End Critical section /// 249 237 250 return response; 238 251 }
Note: See TracChangeset
for help on using the changeset viewer.