Changeset 4253 for branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/DefaultScheduler.cs
- Timestamp:
- 08/18/10 15:29:57 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/DefaultScheduler.cs
r4121 r4253 24 24 } 25 25 26 public bool ExistsJobFor Client(HeuristicLab.Hive.Contracts.BusinessObjects.HeartBeatData hbData) {27 List<JobDto> allOfflineJobsFor Client=28 new List<JobDto>(DaoLocator.JobDao.FindFittingJobsFor Client(State.Offline, hbData.FreeCores, hbData.FreeMemory, hbData.ClientId));29 return (allOfflineJobsFor Client != null && allOfflineJobsForClient.Count > 0);26 public bool ExistsJobForSlave(HeuristicLab.Hive.Contracts.BusinessObjects.HeartBeatData hbData) { 27 List<JobDto> allOfflineJobsForSlave = 28 new List<JobDto>(DaoLocator.JobDao.FindFittingJobsForSlave(State.Offline, hbData.FreeCores, hbData.FreeMemory, hbData.SlaveId)); 29 return (allOfflineJobsForSlave != null && allOfflineJobsForSlave.Count > 0); 30 30 } 31 31 32 public HeuristicLab.Hive.Contracts.BusinessObjects.JobDto GetNextJobFor Client(Guid clientId) {32 public HeuristicLab.Hive.Contracts.BusinessObjects.JobDto GetNextJobForSlave(Guid slaveId) { 33 33 /// Critical section /// 34 34 jobLock.WaitOne(); 35 35 JobDto jobToCalculate = null; 36 36 using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = ApplicationConstants.ISOLATION_LEVEL_SCOPE })) { 37 ClientDto client = DaoLocator.ClientDao.FindById(clientId);38 LinkedList<JobDto> allOfflineJobsFor Client=39 new LinkedList<JobDto>(DaoLocator.JobDao.FindFittingJobsFor Client(State.Offline, client.NrOfFreeCores, client.FreeMemory, client.Id));40 if (allOfflineJobsFor Client != null && allOfflineJobsForClient.Count > 0) {41 jobToCalculate = allOfflineJobsFor Client.First.Value;37 ClientDto slave = DaoLocator.ClientDao.FindById(slaveId); 38 LinkedList<JobDto> allOfflineJobsForSlave = 39 new LinkedList<JobDto>(DaoLocator.JobDao.FindFittingJobsForSlave(State.Offline, slave.NrOfFreeCores, slave.FreeMemory, slave.Id)); 40 if (allOfflineJobsForSlave != null && allOfflineJobsForSlave.Count > 0) { 41 jobToCalculate = allOfflineJobsForSlave.First.Value; 42 42 jobToCalculate.State = State.Calculating; 43 jobToCalculate.Client = client;43 jobToCalculate.Client = slave; 44 44 jobToCalculate.Client.State = State.Calculating; 45 45 jobToCalculate.DateCalculated = DateTime.Now; 46 DaoLocator.JobDao.Assign ClientToJob(client.Id, jobToCalculate.Id);46 DaoLocator.JobDao.AssignSlaveToJob(slave.Id, jobToCalculate.Id); 47 47 DaoLocator.JobDao.Update(jobToCalculate); 48 48 DaoLocator.ClientDao.Update(jobToCalculate.Client);
Note: See TracChangeset
for help on using the changeset viewer.