- Timestamp:
- 02/01/11 15:51:11 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs
r5402 r5404 100 100 } 101 101 } 102 103 public Job AquireJob(Guid slaveId) { 104 using (trans.OpenTransaction()) { 105 var slave = dao.GetSlave(slaveId); 106 var availableJobs = dao.GetWaitingJobs(slave); 107 var job = availableJobs.FirstOrDefault(); 108 109 if (job != null) { 110 job.SlaveId = slaveId; 111 job.JobState = JobState.Calculating; 112 } 113 return job; 114 } 115 } 116 102 117 103 public PluginData GetConfigurationFile() { 118 104 using (trans.OpenTransaction()) { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/LifecycleManager.cs
r5095 r5404 94 94 /// if not -> set them offline and check if they where calculating a job 95 95 /// </summary> 96 void timer_Tick(object sender, EventArgs e) {96 private void timer_Tick(object sender, EventArgs e) { 97 97 lock (locker) { 98 98 using (trans.OpenTransaction()) { … … 146 146 147 147 if (this.IsAllowedToSendJobs() && slave.IsAllowedToCalculate && heartbeat.FreeCores > 0) { 148 var availableJobs = dao.GetWaitingJobs(slave );148 var availableJobs = dao.GetWaitingJobs(slave, 1); 149 149 if (availableJobs.Count() > 0) { 150 actions.Add(new MessageContainer(MessageContainer.MessageType.AquireJob)); 150 var job = availableJobs.First(); 151 actions.Add(new MessageContainer(MessageContainer.MessageType.CalculateJob, job.Id)); 152 AssignJob(slave, job); 151 153 } 152 154 } … … 164 166 } 165 167 return actions; 168 } 169 170 private void AssignJob(Slave slave, Job job) { 171 job.SlaveId = slave.Id; 172 job.JobState = JobState.Calculating; // Todo: Maybe use State = Transferring (?) 173 job.DateCalculated = DateTime.Now; // Todo: use statelog instead 174 dao.UpdateJob(job); 175 dao.UpdateSlave(slave); 166 176 } 167 177
Note: See TracChangeset
for help on using the changeset viewer.