Changeset 1160
- Timestamp:
- 01/21/09 16:22:25 (16 years ago)
- Location:
- trunk/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/app.config ¶
r1144 r1160 5 5 <connectionStrings> 6 6 <add name="HeuristicLab.Hive.Server.ADODataAccess.Properties.Settings.HiveServerConnectionString" 7 connectionString="Data Source=10.22.20.84;Initial Catalog=HiveServer ;Persist Security Info=True;User ID=hive;Password=hive"7 connectionString="Data Source=10.22.20.84;Initial Catalog=HiveServerTesting;Persist Security Info=True;User ID=hive;Password=hive" 8 8 providerName="System.Data.SqlClient" /> 9 9 </connectionStrings> -
TabularUnified 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 } -
TabularUnified trunk/sources/HeuristicLab.Hive.Server.Core/JobManager.cs ¶
r1149 r1160 50 50 51 51 public void ResetJobsDependingOnResults(Job job) { 52 List<JobResult> allJobResults = new List<JobResult>(jobResultAdapter.Get All());52 List<JobResult> allJobResults = new List<JobResult>(jobResultAdapter.GetResultsOf(job)); 53 53 JobResult lastJobResult = null; 54 54 foreach (JobResult jR in allJobResults) { 55 if (jR.Job != null && jR.Job.Id == job.Id) { 56 if (lastJobResult != null) { 57 // if lastJobResult was before the current jobResult the lastJobResult must be updated 58 if ((jR.timestamp.Subtract(lastJobResult.timestamp)).Seconds > 0) 59 lastJobResult = jR; 60 } 61 } 55 // if lastJobResult was before the current jobResult the lastJobResult must be updated 56 if (lastJobResult == null || 57 (jR.timestamp > lastJobResult.timestamp)) 58 lastJobResult = jR; 62 59 } 63 60 if (lastJobResult != null) { 64 job.Client = null;65 61 job.Percentage = lastJobResult.Percentage; 66 job.State = State.offline;67 62 job.SerializedJob = lastJobResult.Result; 68 63 } else { 69 job.Client = null;70 64 job.Percentage = 0; 71 job.State = State.offline;72 65 } 66 67 job.Client = null; 68 job.State = State.offline; 69 73 70 jobAdapter.Update(job); 74 71 }
Note: See TracChangeset
for help on using the changeset viewer.