Changeset 17575
- Timestamp:
- 05/29/20 13:31:30 (4 years ago)
- Location:
- trunk/HeuristicLab.Services.Hive/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Services.Hive/3.3/HiveService.cs
r17376 r17575 209 209 } 210 210 211 private bool IsAuthorizedForTask(DA.Task task, Guid? slaveId) { 212 var lastStateLog = task.StateLogs.OrderByDescending(x => x.DateTime).FirstOrDefault(x => x.State == DA.TaskState.Transferring); 213 return lastStateLog == null || slaveId == null || lastStateLog.SlaveId == slaveId; 214 } 215 211 216 public DT.Task UpdateTaskState(Guid taskId, DT.TaskState taskState, Guid? slaveId, Guid? userId, string exception) { 212 217 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); … … 217 222 return pm.UseTransaction(() => { 218 223 var task = taskDao.GetById(taskId); 219 UpdateTaskState(pm, task, taskState, slaveId, userId, exception); 220 pm.SubmitChanges(); 224 if (IsAuthorizedForTask(task, slaveId)) { 225 UpdateTaskState(pm, task, taskState, slaveId, userId, exception); 226 pm.SubmitChanges(); 227 } 221 228 return task.ToDto(); 222 229 }); -
trunk/HeuristicLab.Services.Hive/3.3/Manager/HeartbeatManager.cs
r17574 r17575 120 120 var taskInfos = pm.UseTransaction(() => 121 121 (from task in taskDao.GetAll() 122 123 let lastStateLog = task.StateLogs.OrderByDescending(x => x.DateTime).FirstOrDefault()124 125 126 127 128 129 SlaveId = lastStateLog != null ? lastStateLog.SlaveId : default(Guid)130 122 where taskIds.Contains(task.TaskId) 123 let lastStateLog = task.StateLogs.OrderByDescending(x => x.DateTime).FirstOrDefault(x => x.State == DA.TaskState.Transferring) 124 select new { 125 TaskId = task.TaskId, 126 JobId = task.JobId, 127 State = task.State, 128 Command = task.Command, 129 SlaveId = lastStateLog != null ? lastStateLog.SlaveId : Guid.Empty 130 }).ToList() 131 131 ); 132 132
Note: See TracChangeset
for help on using the changeset viewer.