Changeset 4116 for branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3
- Timestamp:
- 07/27/10 18:36:36 (14 years ago)
- Location:
- branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/ClientCommunicator.cs
r4092 r4116 82 82 83 83 foreach (ClientDto client in allClients) { 84 if (client.State != State. offline && client.State != State.nullState) {84 if (client.State != State.Offline && client.State != State.NullState) { 85 85 heartbeatLock.EnterUpgradeableReadLock(); 86 86 … … 88 88 Logger.Info("Client " + client.Id + 89 89 " wasn't offline but hasn't sent heartbeats - setting offline"); 90 client.State = State. offline;90 client.State = State.Offline; 91 91 DaoLocator.ClientDao.Update(client); 92 92 Logger.Info("Client " + client.Id + … … 113 113 Logger.Debug("setting client offline"); 114 114 // client must be set offline 115 client.State = State. offline;115 client.State = State.Offline; 116 116 117 117 //clientAdapter.Update(client); … … 146 146 147 147 private void CheckForPendingJobs() { 148 IList<JobDto> pendingJobsInDB = new List<JobDto>(DaoLocator.JobDao.GetJobsByState(State. pending));148 IList<JobDto> pendingJobsInDB = new List<JobDto>(DaoLocator.JobDao.GetJobsByState(State.Pending)); 149 149 150 150 foreach (JobDto currJob in pendingJobsInDB) { … … 152 152 if (pendingJobs.ContainsKey(currJob.Id)) { 153 153 if (pendingJobs[currJob.Id] <= 0) { 154 currJob.State = State. offline;154 currJob.State = State.Offline; 155 155 DaoLocator.JobDao.Update(currJob); 156 156 } else { … … 185 185 //Really set offline? 186 186 //Reconnect issues with the currently calculating jobs 187 clientInfo.State = State. idle;187 clientInfo.State = State.Idle; 188 188 clientInfo.CalendarSyncStatus = dbClient != null ? dbClient.CalendarSyncStatus : CalendarState.NotAllowedToFetch; 189 189 … … 258 258 Logger.Debug("END Finished Client Fetching"); 259 259 // check if the client is logged in 260 if (client.State == State. offline || client.State == State.nullState) {260 if (client.State == State.Offline || client.State == State.NullState) { 261 261 response.Success = false; 262 262 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_USER_NOT_LOGGED_IN; … … 341 341 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_IS_NOT_BEEING_CALCULATED; 342 342 Logger.Error("There is no job calculated by this user " + hbData.ClientId + " Job: " + curJob); 343 } else if (curJob.State == State. abort) {343 } else if (curJob.State == State.Abort) { 344 344 // a request to abort the job has been set 345 345 response.ActionRequest.Add(new MessageContainer(MessageContainer.MessageType.AbortJob, curJob.Id)); 346 curJob.State = State. finished;346 curJob.State = State.Finished; 347 347 } else { 348 348 // save job progress 349 349 curJob.Percentage = jobProgress.Value; 350 350 351 if (curJob.State == State. requestSnapshot) {351 if (curJob.State == State.RequestSnapshot) { 352 352 // a request for a snapshot has been set 353 353 response.ActionRequest.Add(new MessageContainer(MessageContainer.MessageType.RequestSnapshot, curJob.Id)); 354 curJob.State = State. requestSnapshotSent;354 curJob.State = State.RequestSnapshotSent; 355 355 } 356 356 } … … 376 376 Logger.Error("Job TTL reached Zero, Job gets removed: " + currJob + " and set back to offline. User that sucks: " + currJob.Client); 377 377 378 currJob.State = State. offline;378 currJob.State = State.Offline; 379 379 DaoLocator.JobDao.Update(currJob); 380 380 … … 385 385 } else { 386 386 Logger.Error("Job ID wasn't with the heartbeats: " + currJob); 387 currJob.State = State. offline;387 currJob.State = State.Offline; 388 388 DaoLocator.JobDao.Update(currJob); 389 389 } … … 516 516 return response; 517 517 } 518 if (job.JobInfo.State == State. abort) {518 if (job.JobInfo.State == State.Abort) { 519 519 response.Success = false; 520 520 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_WAS_ABORTED; … … 545 545 return response; 546 546 } 547 if (job.JobInfo.State == State. finished) {547 if (job.JobInfo.State == State.Finished) { 548 548 response.Success = true; 549 549 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOBRESULT_RECEIVED; … … 556 556 } 557 557 //Todo: RequestsnapshotSent => calculating? 558 if (job.JobInfo.State == State. requestSnapshotSent) {559 job.JobInfo.State = State. calculating;560 } 561 if (job.JobInfo.State != State. calculating &&562 job.JobInfo.State != State. pending) {558 if (job.JobInfo.State == State.RequestSnapshotSent) { 559 job.JobInfo.State = State.Calculating; 560 } 561 if (job.JobInfo.State != State.Calculating && 562 job.JobInfo.State != State.Pending) { 563 563 response.Success = false; 564 564 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_WRONG_JOB_STATE; … … 573 573 574 574 if (finished) { 575 job.JobInfo.State = State. finished;575 job.JobInfo.State = State.Finished; 576 576 job.JobInfo.DateFinished = DateTime.Now; 577 577 } … … 637 637 return response; 638 638 } 639 if (client.State == State. calculating) {639 if (client.State == State.Calculating) { 640 640 // check wich job the client was calculating and reset it 641 641 IEnumerable<JobDto> jobsOfClient = DaoLocator.JobDao.FindActiveJobsOfClient(client); 642 642 foreach (JobDto job in jobsOfClient) { 643 if (job.State != State. finished)643 if (job.State != State.Finished) 644 644 DaoLocator.JobDao.SetJobOffline(job); 645 645 } 646 646 } 647 647 648 client.State = State. offline;648 client.State = State.Offline; 649 649 DaoLocator.ClientDao.Update(client); 650 650 … … 670 670 return response; 671 671 } 672 if (job.State == State. finished) {672 if (job.State == State.Finished) { 673 673 response.Success = true; 674 674 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_ALLREADY_FINISHED; … … 676 676 return response; 677 677 } 678 job.State = State. pending;678 job.State = State.Pending; 679 679 lock (pendingJobs) { 680 680 pendingJobs.Add(job.Id, PENDING_TIMEOUT); -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/DbTestApp.cs
r4092 r4116 123 123 c1.NrOfFreeCores = 2; 124 124 c1.CpuSpeedPerCore = 2500; 125 c1.State = State. idle;125 c1.State = State.Idle; 126 126 c1 = clientDao.Insert(c1); 127 127 … … 137 137 c2.NrOfFreeCores = 1; 138 138 c2.CpuSpeedPerCore = 4000; 139 c2.State = State. idle;139 c2.State = State.Idle; 140 140 c2 = clientDao.Insert(c2); 141 141 … … 159 159 Percentage = 0, 160 160 Priority = 1, 161 State = State. offline161 State = State.Offline 162 162 }; 163 163 … … 204 204 client.NrOfFreeCores = 2; 205 205 client.CpuSpeedPerCore = 2500; 206 client.State = State. idle;206 client.State = State.Idle; 207 207 client = clientDao.Insert(client); 208 208 cgd.AddRessourceToClientGroup(client.Id, mg.Id); -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/DefaultScheduler.cs
r4060 r4116 26 26 public bool ExistsJobForClient(HeuristicLab.Hive.Contracts.BusinessObjects.HeartBeatData hbData) { 27 27 List<JobDto> allOfflineJobsForClient = 28 new List<JobDto>(DaoLocator.JobDao.FindFittingJobsForClient(State. offline, hbData.FreeCores, hbData.FreeMemory,28 new List<JobDto>(DaoLocator.JobDao.FindFittingJobsForClient(State.Offline, hbData.FreeCores, hbData.FreeMemory, 29 29 hbData.ClientId)); 30 30 return (allOfflineJobsForClient != null && allOfflineJobsForClient.Count > 0); … … 38 38 ClientDto client = DaoLocator.ClientDao.FindById(clientId); 39 39 LinkedList<JobDto> allOfflineJobsForClient = 40 new LinkedList<JobDto>(DaoLocator.JobDao.FindFittingJobsForClient(State. offline, client.NrOfFreeCores,40 new LinkedList<JobDto>(DaoLocator.JobDao.FindFittingJobsForClient(State.Offline, client.NrOfFreeCores, 41 41 client.FreeMemory, client.Id)); 42 42 if (allOfflineJobsForClient != null && allOfflineJobsForClient.Count > 0) { 43 43 jobToCalculate = allOfflineJobsForClient.First.Value; 44 jobToCalculate.State = State. calculating;44 jobToCalculate.State = State.Calculating; 45 45 jobToCalculate.Client = client; 46 jobToCalculate.Client.State = State. calculating;46 jobToCalculate.Client.State = State.Calculating; 47 47 jobToCalculate.DateCalculated = DateTime.Now; 48 48 DaoLocator.JobDao.AssignClientToJob(client.Id, jobToCalculate.Id); -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/JobManager.cs
r4107 r4116 66 66 List<JobDto> allJobs = new List<JobDto>(DaoLocator.JobDao.FindAll()); 67 67 foreach (JobDto curJob in allJobs) { 68 if (curJob.State != State. calculating && curJob.State != State.finished) {68 if (curJob.State != State.Calculating && curJob.State != State.Finished) { 69 69 DaoLocator.JobDao.SetJobOffline(curJob); 70 70 } … … 170 170 171 171 if (job != null && job.JobInfo != null) { 172 if (job.JobInfo.State != State. offline) {172 if (job.JobInfo.State != State.Offline) { 173 173 response.Success = false; 174 174 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOBSTATE_MUST_BE_OFFLINE; … … 242 242 243 243 //if it's a snapshot but the result hasn't reached the server yet... 244 if (snapshot && (job.State == State. requestSnapshot || job.State == State.requestSnapshotSent)) {244 if (snapshot && (job.State == State.RequestSnapshot || job.State == State.RequestSnapshotSent)) { 245 245 response.Success = true; 246 246 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_RESULT_NOT_YET_HERE; … … 250 250 251 251 //if it's NOT a snapshot, NEITHER request NOR is it finished 252 if (!requested && !snapshot && job.State != State. finished) {252 if (!requested && !snapshot && job.State != State.Finished) { 253 253 response.Success = true; 254 254 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_RESULT_NOT_YET_HERE; … … 273 273 274 274 JobDto job = DaoLocator.JobDao.FindById(jobId); 275 if (job.State == State. requestSnapshot || job.State == State.requestSnapshotSent) {275 if (job.State == State.RequestSnapshot || job.State == State.RequestSnapshotSent) { 276 276 response.Success = true; 277 277 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_REQUEST_ALLREADY_SET; 278 278 return response; 279 279 } 280 if (job.State != State. calculating) {280 if (job.State != State.Calculating) { 281 281 response.Success = false; 282 282 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_IS_NOT_BEEING_CALCULATED; … … 284 284 } 285 285 // job is in correct state 286 job.State = State. requestSnapshot;286 job.State = State.RequestSnapshot; 287 287 DaoLocator.JobDao.Update(job); 288 288 … … 302 302 return response; // no commit needed 303 303 } 304 if (job.State == State. abort) {304 if (job.State == State.Abort) { 305 305 response.Success = true; 306 306 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_ABORT_REQUEST_ALLREADY_SET; 307 307 return response; // no commit needed 308 308 } 309 if (job.State != State. calculating && job.State != State.requestSnapshot && job.State != State.requestSnapshotSent) {309 if (job.State != State.Calculating && job.State != State.RequestSnapshot && job.State != State.RequestSnapshotSent) { 310 310 response.Success = false; 311 311 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_IS_NOT_BEEING_CALCULATED; … … 313 313 } 314 314 // job is in correct state 315 job.State = State. abort;315 job.State = State.Abort; 316 316 DaoLocator.JobDao.Update(job); 317 317 -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/Properties/AssemblyInfo.cs
r4111 r4116 55 55 // by using the '*' as shown below: 56 56 // [assembly: AssemblyVersion("1.0.*")] 57 [assembly: AssemblyVersion("3.3.0.41 07")]58 [assembly: AssemblyFileVersion("3.3.0.41 07")]59 [assembly: AssemblyBuildDate("2010/07/27 1 4:15:12")]57 [assembly: AssemblyVersion("3.3.0.4111")] 58 [assembly: AssemblyFileVersion("3.3.0.4111")] 59 [assembly: AssemblyBuildDate("2010/07/27 18:31:46")]
Note: See TracChangeset
for help on using the changeset viewer.