Changeset 9266
- Timestamp:
- 03/01/13 14:25:49 (12 years ago)
- Location:
- trunk/sources
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Services.Hive.DataAccess/3.3/ITransactionManager.cs
r7259 r9266 24 24 namespace HeuristicLab.Services.Hive.DataAccess { 25 25 public interface ITransactionManager { 26 void UseTransaction(Action call, bool serializable= false, bool longRunning = false);27 T UseTransaction<T>(Func<T> call, bool serializable= false, bool longRunning = false);26 void UseTransaction(Action call, bool repeatableRead = false, bool longRunning = false); 27 T UseTransaction<T>(Func<T> call, bool repeatableRead = false, bool longRunning = false); 28 28 } 29 29 } -
trunk/sources/HeuristicLab.Services.Hive/3.3/Convert.cs
r9123 r9266 79 79 } 80 80 } 81 82 public static void ToEntityTaskOnly(DT.Task source, DB.Task target) { 83 if ((source != null) && (target != null)) { 84 target.TaskId = source.Id; 85 target.CoresNeeded = source.CoresNeeded; 86 target.ExecutionTimeMs = source.ExecutionTime.TotalMilliseconds; 87 target.MemoryNeeded = source.MemoryNeeded; 88 target.ParentTaskId = source.ParentTaskId; 89 target.Priority = source.Priority; 90 target.LastHeartbeat = source.LastHeartbeat; 91 target.State = Convert.ToEntity(source.State); 92 target.IsParentTask = source.IsParentTask; 93 target.FinishWhenChildJobsFinished = source.FinishWhenChildJobsFinished; 94 target.Command = Convert.ToEntity(source.Command); 95 // RequiredPlugins are added by Dao 96 target.JobId = source.JobId; 97 target.IsPrivileged = source.IsPrivileged; 98 } 99 } 81 100 #endregion 82 101 -
trunk/sources/HeuristicLab.Services.Hive/3.3/HiveDao.cs
r9259 r9266 120 120 } 121 121 122 public void UpdateTask (DT.Task dto) {122 public void UpdateTaskAndStateLogs(DT.Task dto) { 123 123 using (var db = CreateContext()) { 124 124 var entity = db.Tasks.FirstOrDefault(x => x.TaskId == dto.Id); 125 125 if (entity == null) db.Tasks.InsertOnSubmit(DT.Convert.ToEntity(dto)); 126 126 else DT.Convert.ToEntity(dto, entity); 127 db.SubmitChanges(); 128 } 129 } 130 131 public void UpdateTask(DT.Task dto) { 132 using (var db = CreateContext()) { 133 db.DeferredLoadingEnabled = false; 134 135 var entity = db.Tasks.FirstOrDefault(x => x.TaskId == dto.Id); 136 if (entity == null) db.Tasks.InsertOnSubmit(DT.Convert.ToEntity(dto)); 137 else DT.Convert.ToEntityTaskOnly(dto, entity); 127 138 db.SubmitChanges(); 128 139 } … … 186 197 public DT.Task UpdateTaskState(Guid taskId, TaskState taskState, Guid? slaveId, Guid? userId, string exception) { 187 198 using (var db = CreateContext()) { 188 var job = db.Tasks.SingleOrDefault(x => x.TaskId == taskId);189 job.State = taskState; 199 db.DeferredLoadingEnabled = false; 200 190 201 db.StateLogs.InsertOnSubmit(new StateLog { 191 202 TaskId = taskId, … … 197 208 }); 198 209 db.SubmitChanges(); 199 job = db.Tasks.SingleOrDefault(x => x.TaskId == taskId); 200 return DT.Convert.ToDto(job); 210 } 211 212 using (var db = CreateContext()) { 213 db.DeferredLoadingEnabled = false; 214 215 var task = db.Tasks.SingleOrDefault(x => x.TaskId == taskId); 216 task.State = taskState; 217 db.SubmitChanges(); 218 return DT.Convert.ToDto(task); 201 219 } 202 220 } … … 615 633 public void AssignJobToResource(Guid taskId, IEnumerable<Guid> resourceIds) { 616 634 using (var db = CreateContext()) { 635 db.DeferredLoadingEnabled = false; 636 617 637 List<AssignedResource> assignedResources = new List<AssignedResource>(); 618 638 foreach (Guid rId in resourceIds) { -
trunk/sources/HeuristicLab.Services.Hive/3.3/Interfaces/IHiveDao.cs
r9257 r9266 35 35 Guid AddTask(DT.Task dto); 36 36 void UpdateTaskAndPlugins(DT.Task dto); 37 void UpdateTaskAndStateLogs(DT.Task dto); 37 38 void UpdateTask(DT.Task dto); 38 39 void DeleteTask(Guid id);
Note: See TracChangeset
for help on using the changeset viewer.