Changeset 4264 for branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core
- Timestamp:
- 08/19/10 13:30:56 (14 years ago)
- Location:
- branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/DefaultScheduler.cs
r4263 r4264 21 21 22 22 public bool ExistsJobForSlave(HeartBeatData hbData) { 23 List<JobDto> allOfflineJobsForSlave = new List<JobDto>(DaoLocator.JobDao.FindFittingJobsForSlave( State.Offline, hbData.FreeCores, hbData.FreeMemory, hbData.SlaveId));23 List<JobDto> allOfflineJobsForSlave = new List<JobDto>(DaoLocator.JobDao.FindFittingJobsForSlave(JobState.Offline, hbData.FreeCores, hbData.FreeMemory, hbData.SlaveId)); 24 24 return (allOfflineJobsForSlave != null && allOfflineJobsForSlave.Count > 0); 25 25 } … … 31 31 using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = ApplicationConstants.ISOLATION_LEVEL_SCOPE })) { 32 32 ClientDto slave = DaoLocator.ClientDao.FindById(slaveId); 33 LinkedList<JobDto> allOfflineJobsForSlave = new LinkedList<JobDto>(DaoLocator.JobDao.FindFittingJobsForSlave( State.Offline, slave.NrOfFreeCores, slave.FreeMemory, slave.Id));33 LinkedList<JobDto> allOfflineJobsForSlave = new LinkedList<JobDto>(DaoLocator.JobDao.FindFittingJobsForSlave(JobState.Offline, slave.NrOfFreeCores, slave.FreeMemory, slave.Id)); 34 34 if (allOfflineJobsForSlave != null && allOfflineJobsForSlave.Count > 0) { 35 35 jobToCalculate = allOfflineJobsForSlave.First.Value; 36 jobToCalculate.State = State.Calculating;36 jobToCalculate.State = JobState.Calculating; 37 37 jobToCalculate.Client = slave; 38 jobToCalculate.Client.State = S tate.Calculating;38 jobToCalculate.Client.State = SlaveState.Calculating; 39 39 jobToCalculate.DateCalculated = DateTime.Now; 40 40 DaoLocator.JobDao.AssignSlaveToJob(slave.Id, jobToCalculate.Id); -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/Facades/ServerConsoleFacade.cs
r4263 r4264 108 108 } 109 109 110 public ResponseList<JobDto> GetAllJobsWithFilter( State jobState, int offset, int count) {110 public ResponseList<JobDto> GetAllJobsWithFilter(JobState jobState, int offset, int count) { 111 111 using (contextFactory.GetContext(false)) { 112 112 secMan.Authorize("AccessJobs", sessionID, Guid.Empty); -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/JobManager.cs
r4263 r4264 58 58 List<JobDto> allJobs = new List<JobDto>(DaoLocator.JobDao.FindAll()); 59 59 foreach (JobDto curJob in allJobs) { 60 if (curJob.State != State.Calculating && curJob.State !=State.Finished) {60 if (curJob.State != JobState.Calculating && curJob.State != JobState.Finished) { 61 61 DaoLocator.JobDao.SetJobOffline(curJob); 62 62 } … … 86 86 } 87 87 88 public ResponseList<JobDto> GetAllJobsWithFilter( State jobState, int offset, int count) {88 public ResponseList<JobDto> GetAllJobsWithFilter(JobState jobState, int offset, int count) { 89 89 ResponseList<JobDto> response = new ResponseList<JobDto>(); 90 90 response.List = new List<JobDto>(DaoLocator.JobDao.FindWithLimitations(jobState, offset, count)); … … 153 153 154 154 if (job != null && job.JobInfo != null) { 155 if (job.JobInfo.State != State.Offline) {155 if (job.JobInfo.State != JobState.Offline) { 156 156 response.StatusMessage = ResponseStatus.AddNewJob_JobStateMustBeOffline; 157 157 return response; … … 222 222 223 223 //if it's a snapshot but the result hasn't reached the server yet... 224 if (snapshot && (job.State == State.RequestSnapshot || job.State == State.RequestSnapshotSent)) {224 if (snapshot && (job.State == JobState.SnapshotRequested || job.State == JobState.SnapshotSent)) { 225 225 response.StatusMessage = ResponseStatus.GetLastSerializedResult_JobResultNotYetThere; 226 226 … … 229 229 230 230 //if it's NOT a snapshot, NEITHER request NOR is it finished 231 if (!requested && !snapshot && job.State != State.Finished) {231 if (!requested && !snapshot && job.State != JobState.Finished) { 232 232 response.StatusMessage = ResponseStatus.GetLastSerializedResult_JobResultNotYetThere; 233 233 … … 248 248 249 249 JobDto job = DaoLocator.JobDao.FindById(jobId); 250 if (job.State == State.RequestSnapshot || job.State == State.RequestSnapshotSent) {250 if (job.State == JobState.SnapshotRequested || job.State == JobState.SnapshotSent) { 251 251 response.StatusMessage = ResponseStatus.RequestSnapshot_SnapshotAlreadyRequested; 252 252 return response; 253 253 } 254 if (job.State != State.Calculating) {254 if (job.State != JobState.Calculating) { 255 255 response.StatusMessage = ResponseStatus.RequestSnapshot_JobIsNotBeeingCalculated; 256 256 return response; 257 257 } 258 258 // job is in correct state 259 job.State = State.RequestSnapshot;259 job.State = JobState.SnapshotRequested; 260 260 DaoLocator.JobDao.Update(job); 261 261 … … 275 275 return response; // no commit needed 276 276 } 277 if (job.State == State.Abort) {277 if (job.State == JobState.Aborted) { 278 278 //response.Success = true; 279 279 response.StatusMessage = ResponseStatus.AbortJob_AbortAlreadyRequested; 280 280 return response; // no commit needed 281 281 } 282 if (job.State != State.Calculating && job.State != State.RequestSnapshot && job.State != State.RequestSnapshotSent) {282 if (job.State != JobState.Calculating && job.State != JobState.SnapshotRequested && job.State != JobState.SnapshotSent) { 283 283 //response.Success = false; 284 284 response.StatusMessage = ResponseStatus.AbortJob_JobIsNotBeeingCalculated; … … 286 286 } 287 287 // job is in correct state 288 job.State = State.Abort;288 job.State = JobState.Aborted; 289 289 DaoLocator.JobDao.Update(job); 290 290 -
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.