Changeset 1500 for trunk/sources/HeuristicLab.Hive.Server.Scheduler
- Timestamp:
- 04/03/09 12:47:47 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server.Scheduler/DefaultScheduler.cs
r1468 r1500 30 30 session.GetDataAdapter<Job, IJobAdapter>(); 31 31 32 List<Job> allOfflineJobs = new List<Job>(jobAdapter.GetJobsByState(State.offline));33 return (allOfflineJobs .Count > 0);32 List<Job> allOfflineJobsForClient = new List<Job>(jobAdapter.FindJobs(State.offline, hbData.FreeCores, hbData.FreeMemory)); 33 return (allOfflineJobsForClient != null && allOfflineJobsForClient.Count > 0); 34 34 } 35 35 finally { … … 52 52 jobLock.WaitOne(); 53 53 54 LinkedList<Job> allOfflineJobs = new LinkedList<Job>(jobAdapter.GetJobsByState(State.offline)); 54 ClientInfo client = clientAdapter.GetById(clientId); 55 LinkedList<Job> allOfflineJobsForClient = new LinkedList<Job>(jobAdapter.FindJobs(State.offline, client.NrOfFreeCores, client.FreeMemory )); 55 56 56 Job job 2Calculate = null;57 if (allOfflineJobs != null && allOfflineJobs.Count > 0) {58 job 2Calculate = allOfflineJobs.First.Value;59 job 2Calculate.State = State.calculating;60 job 2Calculate.Client = clientAdapter.GetById(clientId);61 job 2Calculate.Client.State = State.calculating;57 Job jobToCalculate = null; 58 if (allOfflineJobsForClient != null && allOfflineJobsForClient.Count > 0) { 59 jobToCalculate = allOfflineJobsForClient.First.Value; 60 jobToCalculate.State = State.calculating; 61 jobToCalculate.Client = client; 62 jobToCalculate.Client.State = State.calculating; 62 63 63 job 2Calculate.DateCalculated = DateTime.Now;64 jobAdapter.Update(job 2Calculate);64 jobToCalculate.DateCalculated = DateTime.Now; 65 jobAdapter.Update(jobToCalculate); 65 66 } 66 67 jobLock.ReleaseMutex(); 67 68 /// End Critical section /// 68 69 69 return job 2Calculate;70 return jobToCalculate; 70 71 } 71 72 finally {
Note: See TracChangeset
for help on using the changeset viewer.