Changeset 4264 for branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/SlaveCommunicator.cs
- Timestamp:
- 08/19/10 13:30:56 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/SlaveCommunicator.cs
r4263 r4264 83 83 84 84 foreach (ClientDto client in allClients) { 85 if (client.State != S tate.Offline && client.State !=State.NullState) {85 if (client.State != SlaveState.Offline && client.State != SlaveState.NullState) { 86 86 heartbeatLock.EnterUpgradeableReadLock(); 87 87 … … 89 89 Logger.Info("Client " + client.Id + 90 90 " wasn't offline but hasn't sent heartbeats - setting offline"); 91 client.State = S tate.Offline;91 client.State = SlaveState.Offline; 92 92 DaoLocator.ClientDao.Update(client); 93 93 Logger.Info("Client " + client.Id + … … 114 114 Logger.Debug("setting client offline"); 115 115 // client must be set offline 116 client.State = S tate.Offline;116 client.State = SlaveState.Offline; 117 117 118 118 //clientAdapter.Update(client); … … 147 147 148 148 private void CheckForPendingJobs() { 149 IList<JobDto> pendingJobsInDB = new List<JobDto>(DaoLocator.JobDao.GetJobsByState( State.Pending));149 IList<JobDto> pendingJobsInDB = new List<JobDto>(DaoLocator.JobDao.GetJobsByState(JobState.Pending)); 150 150 151 151 foreach (JobDto currJob in pendingJobsInDB) { … … 153 153 if (pendingJobs.ContainsKey(currJob.Id)) { 154 154 if (pendingJobs[currJob.Id] <= 0) { 155 currJob.State = State.Offline;155 currJob.State = JobState.Offline; 156 156 DaoLocator.JobDao.Update(currJob); 157 157 } else { … … 186 186 //Really set offline? 187 187 //Reconnect issues with the currently calculating jobs 188 slaveInfo.State = S tate.Idle;188 slaveInfo.State = SlaveState.Idle; 189 189 slaveInfo.CalendarSyncStatus = dbClient != null ? dbClient.CalendarSyncStatus : CalendarState.NotAllowedToFetch; 190 190 … … 255 255 Logger.Debug("END Finished Client Fetching"); 256 256 // check if the client is logged in 257 if (client.State == S tate.Offline || client.State ==State.NullState) {257 if (client.State == SlaveState.Offline || client.State == SlaveState.NullState) { 258 258 // response.Success = false; 259 259 response.StatusMessage = ResponseStatus.ProcessHeartBeat_UserNotLoggedIn; … … 359 359 response.ActionRequest.Add(new MessageContainer(MessageContainer.MessageType.AbortJob, curJob.Id)); 360 360 Logger.Error("There is no job calculated by this user " + hbData.SlaveId + " Job: " + curJob); 361 } else if (curJob.State == State.Abort) {361 } else if (curJob.State == JobState.Aborted) { 362 362 // a request to abort the job has been set 363 363 response.ActionRequest.Add(new MessageContainer(MessageContainer.MessageType.AbortJob, curJob.Id)); 364 curJob.State = State.Finished;364 curJob.State = JobState.Finished; 365 365 } else { 366 366 // save job progress 367 367 curJob.Percentage = jobProgress.Value; 368 368 369 if (curJob.State == State.RequestSnapshot) {369 if (curJob.State == JobState.SnapshotRequested) { 370 370 // a request for a snapshot has been set 371 371 response.ActionRequest.Add(new MessageContainer(MessageContainer.MessageType.RequestSnapshot, curJob.Id)); 372 curJob.State = State.RequestSnapshotSent;372 curJob.State = JobState.SnapshotSent; 373 373 } 374 374 } … … 394 394 Logger.Error("Job TTL reached Zero, Job gets removed: " + currJob + " and set back to offline. User that sucks: " + currJob.Client); 395 395 396 currJob.State = State.Offline;396 currJob.State = JobState.Offline; 397 397 DaoLocator.JobDao.Update(currJob); 398 398 … … 403 403 } else { 404 404 Logger.Error("Job ID wasn't with the heartbeats: " + currJob); 405 currJob.State = State.Offline;405 currJob.State = JobState.Offline; 406 406 DaoLocator.JobDao.Update(currJob); 407 407 } … … 516 516 return response; 517 517 } 518 if (job.JobInfo.State == State.Abort) {518 if (job.JobInfo.State == JobState.Aborted) { 519 519 //response.Success = false; 520 520 response.StatusMessage = ResponseStatus.ProcessJobResult_JobAborted; … … 545 545 return response; 546 546 } 547 if (job.JobInfo.State == State.Finished) {547 if (job.JobInfo.State == JobState.Finished) { 548 548 response.StatusMessage = ResponseStatus.Ok; 549 549 response.JobId = jobId; … … 555 555 } 556 556 //Todo: RequestsnapshotSent => calculating? 557 if (job.JobInfo.State == State.RequestSnapshotSent) {558 job.JobInfo.State = State.Calculating;559 } 560 if (job.JobInfo.State != State.Calculating && job.JobInfo.State !=State.Pending) {557 if (job.JobInfo.State == JobState.SnapshotSent) { 558 job.JobInfo.State = JobState.Calculating; 559 } 560 if (job.JobInfo.State != JobState.Calculating && job.JobInfo.State != JobState.Pending) { 561 561 //response.Success = false; 562 562 response.StatusMessage = ResponseStatus.ProcessJobResult_InvalidJobState; … … 571 571 572 572 if (!string.IsNullOrEmpty(exception)) { 573 job.JobInfo.State = State.Failed;573 job.JobInfo.State = JobState.Failed; 574 574 job.JobInfo.Exception = exception; 575 575 job.JobInfo.DateFinished = DateTime.Now; 576 576 } else if (finished) { 577 job.JobInfo.State = State.Finished;577 job.JobInfo.State = JobState.Finished; 578 578 job.JobInfo.DateFinished = DateTime.Now; 579 579 } … … 638 638 return response; 639 639 } 640 if (client.State == S tate.Calculating) {640 if (client.State == SlaveState.Calculating) { 641 641 // check wich job the client was calculating and reset it 642 642 IEnumerable<JobDto> jobsOfClient = DaoLocator.JobDao.FindActiveJobsOfSlave(client); 643 643 foreach (JobDto job in jobsOfClient) { 644 if (job.State != State.Finished)644 if (job.State != JobState.Finished) 645 645 DaoLocator.JobDao.SetJobOffline(job); 646 646 } 647 647 } 648 648 649 client.State = S tate.Offline;649 client.State = SlaveState.Offline; 650 650 DaoLocator.ClientDao.Update(client); 651 651 … … 668 668 return response; 669 669 } 670 if (job.State == State.Finished) {670 if (job.State == JobState.Finished) { 671 671 //response.Success = true; 672 672 response.StatusMessage = ResponseStatus.IsJobStillNeeded_JobAlreadyFinished; … … 674 674 return response; 675 675 } 676 job.State = State.Pending;676 job.State = JobState.Pending; 677 677 lock (pendingJobs) { 678 678 pendingJobs.Add(job.Id, PENDING_TIMEOUT);
Note: See TracChangeset
for help on using the changeset viewer.