- Timestamp:
- 09/08/11 13:41:25 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3
- Files:
-
- 10 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/Convert.cs
r6717 r6721 31 31 public static class Convert { 32 32 #region Job 33 public static DT. Job ToDto(DB.Jobsource) {34 if (source == null) return null; 35 return new DT. Job{36 Id = source. JobId,33 public static DT.Task ToDto(DB.Task source) { 34 if (source == null) return null; 35 return new DT.Task { 36 Id = source.TaskId, 37 37 CoresNeeded = source.CoresNeeded, 38 38 ExecutionTime = TimeSpan.FromMilliseconds(source.ExecutionTimeMs), 39 39 MemoryNeeded = source.MemoryNeeded, 40 Parent JobId = source.ParentJobId,40 ParentTaskId = source.ParentTaskId, 41 41 Priority = source.Priority, 42 42 PluginsNeededIds = (source.RequiredPlugins == null ? new List<Guid>() : source.RequiredPlugins.Select(x => x.PluginId).ToList()), … … 44 44 State = Convert.ToDto(source.State), 45 45 StateLog = (source.StateLogs == null ? new List<DT.StateLog>() : source.StateLogs.Select(x => Convert.ToDto(x)).OrderBy(x => x.DateTime).ToList()), 46 IsParentJob = source.IsParent Job,46 IsParentJob = source.IsParentTask, 47 47 FinishWhenChildJobsFinished = source.FinishWhenChildJobsFinished, 48 48 Command = Convert.ToDto(source.Command), … … 53 53 } 54 54 55 public static DB. Job ToEntity(DT.Jobsource) {56 if (source == null) return null; 57 var entity = new DB. Job(); ToEntity(source, entity);58 return entity; 59 } 60 public static void ToEntity(DT. Job source, DB.Jobtarget) {61 if ((source != null) && (target != null)) { 62 target. JobId = source.Id;55 public static DB.Task ToEntity(DT.Task source) { 56 if (source == null) return null; 57 var entity = new DB.Task(); ToEntity(source, entity); 58 return entity; 59 } 60 public static void ToEntity(DT.Task source, DB.Task target) { 61 if ((source != null) && (target != null)) { 62 target.TaskId = source.Id; 63 63 target.CoresNeeded = source.CoresNeeded; 64 64 target.ExecutionTimeMs = source.ExecutionTime.TotalMilliseconds; 65 65 target.MemoryNeeded = source.MemoryNeeded; 66 target.Parent JobId = source.ParentJobId;66 target.ParentTaskId = source.ParentTaskId; 67 67 target.Priority = source.Priority; 68 68 target.LastHeartbeat = source.LastHeartbeat; … … 72 72 target.StateLogs.Add(Convert.ToEntity(sl)); 73 73 } 74 target.IsParent Job= source.IsParentJob;74 target.IsParentTask = source.IsParentJob; 75 75 target.FinishWhenChildJobsFinished = source.FinishWhenChildJobsFinished; 76 76 target.Command = Convert.ToEntity(source.Command); … … 83 83 84 84 #region JobData 85 public static DT. JobData ToDto(DB.JobData source) {86 if (source == null) return null; 87 return new DT. JobData { JobId = source.JobId, Data = source.Data.ToArray(), LastUpdate = source.LastUpdate };88 } 89 public static DB. JobData ToEntity(DT.JobData source) {90 if (source == null) return null; 91 var entity = new DB. JobData(); ToEntity(source, entity);92 return entity; 93 } 94 public static void ToEntity(DT. JobData source, DB.JobData target) {95 if ((source != null) && (target != null)) { 96 target. JobId = source.JobId; target.Data = new Binary(source.Data); target.LastUpdate = source.LastUpdate;85 public static DT.TaskData ToDto(DB.TaskData source) { 86 if (source == null) return null; 87 return new DT.TaskData { TaskId = source.TaskId, Data = source.Data.ToArray(), LastUpdate = source.LastUpdate }; 88 } 89 public static DB.TaskData ToEntity(DT.TaskData source) { 90 if (source == null) return null; 91 var entity = new DB.TaskData(); ToEntity(source, entity); 92 return entity; 93 } 94 public static void ToEntity(DT.TaskData source, DB.TaskData target) { 95 if ((source != null) && (target != null)) { 96 target.TaskId = source.TaskId; target.Data = new Binary(source.Data); target.LastUpdate = source.LastUpdate; 97 97 } 98 98 } … … 102 102 public static DT.StateLog ToDto(DB.StateLog source) { 103 103 if (source == null) return null; 104 return new DT.StateLog { Id = source.StateLogId, DateTime = source.DateTime, Exception = source.Exception, JobId = source.JobId, SlaveId = source.SlaveId, State = Convert.ToDto(source.State), UserId = source.UserId };104 return new DT.StateLog { Id = source.StateLogId, DateTime = source.DateTime, Exception = source.Exception, TaskId = source.TaskId, SlaveId = source.SlaveId, State = Convert.ToDto(source.State), UserId = source.UserId }; 105 105 } 106 106 public static DB.StateLog ToEntity(DT.StateLog source) { … … 111 111 public static void ToEntity(DT.StateLog source, DB.StateLog target) { 112 112 if ((source != null) && (target != null)) { 113 target.StateLogId = source.Id; target.DateTime = source.DateTime; target.Exception = source.Exception; target. JobId = source.JobId; target.SlaveId = source.SlaveId; target.State = Convert.ToEntity(source.State); target.UserId = source.UserId;113 target.StateLogId = source.Id; target.DateTime = source.DateTime; target.Exception = source.Exception; target.TaskId = source.TaskId; target.SlaveId = source.SlaveId; target.State = Convert.ToEntity(source.State); target.UserId = source.UserId; 114 114 } 115 115 } … … 365 365 366 366 367 #region JobState368 public static DT. JobState ToDto(DB.JobState source) {369 if (source == DB. JobState.Aborted) {370 return JobState.Aborted;371 } else if (source == DB. JobState.Calculating) {372 return JobState.Calculating;373 } else if (source == DB. JobState.Failed) {374 return JobState.Failed;375 } else if (source == DB. JobState.Finished) {376 return JobState.Finished;377 } else if (source == DB. JobState.Offline) {378 return JobState.Offline;379 } else if (source == DB. JobState.Paused) {380 return JobState.Paused;381 } else if (source == DB. JobState.Transferring) {382 return JobState.Transferring;383 } else if (source == DB. JobState.Waiting) {384 return JobState.Waiting;385 } else 386 return JobState.Failed;387 } 388 389 public static DB. JobState ToEntity(DT.JobState source) {390 if (source == DT. JobState.Aborted) {391 return DB. JobState.Aborted;392 } else if (source == DT. JobState.Calculating) {393 return DB. JobState.Calculating;394 } else if (source == DT. JobState.Failed) {395 return DB. JobState.Failed;396 } else if (source == DT. JobState.Finished) {397 return DB. JobState.Finished;398 } else if (source == DT. JobState.Offline) {399 return DB. JobState.Offline;400 } else if (source == DT. JobState.Paused) {401 return DB. JobState.Paused;402 } else if (source == DT. JobState.Transferring) {403 return DB. JobState.Transferring;404 } else if (source == DT. JobState.Waiting) {405 return DB. JobState.Waiting;406 } else 407 return DB. JobState.Failed;367 #region TaskData 368 public static DT.TaskState ToDto(DB.TaskState source) { 369 if (source == DB.TaskState.Aborted) { 370 return TaskState.Aborted; 371 } else if (source == DB.TaskState.Calculating) { 372 return TaskState.Calculating; 373 } else if (source == DB.TaskState.Failed) { 374 return TaskState.Failed; 375 } else if (source == DB.TaskState.Finished) { 376 return TaskState.Finished; 377 } else if (source == DB.TaskState.Offline) { 378 return TaskState.Offline; 379 } else if (source == DB.TaskState.Paused) { 380 return TaskState.Paused; 381 } else if (source == DB.TaskState.Transferring) { 382 return TaskState.Transferring; 383 } else if (source == DB.TaskState.Waiting) { 384 return TaskState.Waiting; 385 } else 386 return TaskState.Failed; 387 } 388 389 public static DB.TaskState ToEntity(DT.TaskState source) { 390 if (source == DT.TaskState.Aborted) { 391 return DB.TaskState.Aborted; 392 } else if (source == DT.TaskState.Calculating) { 393 return DB.TaskState.Calculating; 394 } else if (source == DT.TaskState.Failed) { 395 return DB.TaskState.Failed; 396 } else if (source == DT.TaskState.Finished) { 397 return DB.TaskState.Finished; 398 } else if (source == DT.TaskState.Offline) { 399 return DB.TaskState.Offline; 400 } else if (source == DT.TaskState.Paused) { 401 return DB.TaskState.Paused; 402 } else if (source == DT.TaskState.Transferring) { 403 return DB.TaskState.Transferring; 404 } else if (source == DT.TaskState.Waiting) { 405 return DB.TaskState.Waiting; 406 } else 407 return DB.TaskState.Failed; 408 408 } 409 409 #endregion -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/DataTransfer/LightweightTask.cs
r6717 r6721 28 28 [DataContract] 29 29 [Serializable] 30 public class Lightweight Job: HiveItem {30 public class LightweightTask : HiveItem { 31 31 [DataMember] 32 32 public TimeSpan ExecutionTime { get; set; } 33 33 [DataMember] 34 public Guid? Parent JobId { get; set; }34 public Guid? ParentTaskId { get; set; } 35 35 [DataMember] 36 36 public List<StateLog> StateLog { get; set; } 37 37 [DataMember] 38 public JobState State { get; set; }38 public TaskState State { get; set; } 39 39 [DataMember] 40 40 public Command? Command { get; set; } … … 44 44 public StateLog CurrentStateLog { get { return StateLog.LastOrDefault(); } } 45 45 public DateTime? DateCreated { get { return StateLog.Count > 0 ? new DateTime?(StateLog.First().DateTime) : null; } } 46 public DateTime? DateFinished { get { return (StateLog.Count > 0 && CurrentStateLog.State == JobState.Finished) ? new DateTime?(CurrentStateLog.DateTime) : null; } }46 public DateTime? DateFinished { get { return (StateLog.Count > 0 && CurrentStateLog.State == TaskState.Finished) ? new DateTime?(CurrentStateLog.DateTime) : null; } } 47 47 48 public Lightweight Job() {48 public LightweightTask() { 49 49 StateLog = new List<DataTransfer.StateLog>(); 50 50 } 51 51 52 public Lightweight Job(Jobjob) {52 public LightweightTask(Task job) { 53 53 this.Id = job.Id; 54 54 this.ExecutionTime = job.ExecutionTime; 55 this.Parent JobId = job.ParentJobId;55 this.ParentTaskId = job.ParentTaskId; 56 56 this.StateLog = new List<StateLog>(job.StateLog); 57 57 this.State = job.State; -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/DataTransfer/StateLog.cs
r6717 r6721 36 36 public string Exception { get; set; } 37 37 [DataMember] 38 public JobState State { get; set; }38 public TaskState State { get; set; } 39 39 [DataMember] 40 public Guid JobId { get; set; }40 public Guid TaskId { get; set; } 41 41 42 42 public StateLog() { } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/DataTransfer/Task.cs
r6717 r6721 27 27 [DataContract] 28 28 [Serializable] 29 public class Job : LightweightJob{29 public class Task : LightweightTask { 30 30 [DataMember] 31 31 public int Priority { get; set; } … … 47 47 public bool IsPrivileged { get; set; } 48 48 49 public Job() {49 public Task() { 50 50 this.PluginsNeededIds = new List<Guid>(); 51 51 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/DataTransfer/TaskData.cs
r6717 r6721 26 26 [DataContract] 27 27 [Serializable] 28 public class JobData {28 public class TaskData { 29 29 [DataMember] 30 public Guid JobId { get; set; }30 public Guid TaskId { get; set; } 31 31 [DataMember] 32 32 public byte[] Data { get; set; } … … 34 34 public DateTime LastUpdate { get; set; } 35 35 36 public JobData() { }36 public TaskData() { } 37 37 } 38 38 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/DataTransfer/TaskState.cs
r6717 r6721 24 24 namespace HeuristicLab.Services.Hive.DataTransfer { 25 25 [Serializable] 26 public enum JobState {26 public enum TaskState { 27 27 /// <summary> 28 /// A jobis offline as long as he is not yet submitted to the hive28 /// A task is offline as long as he is not yet submitted to the hive 29 29 /// </summary> 30 30 Offline, 31 31 32 32 /// <summary> 33 /// Jobis waiting to be calculated33 /// Task is waiting to be calculated 34 34 /// </summary> 35 35 Waiting, 36 36 37 37 /// <summary> 38 /// Jobis beeing transferred38 /// Task is beeing transferred 39 39 /// </summary> 40 40 Transferring, 41 41 42 42 /// <summary> 43 /// Jobis actively calculated on a Slave43 /// Task is actively calculated on a Slave 44 44 /// </summary> 45 45 Calculating, 46 46 47 47 /// <summary> 48 /// Jobis paused, will not be picked up by slaves48 /// Task is paused, will not be picked up by slaves 49 49 /// </summary> 50 50 Paused, 51 51 52 52 /// <summary> 53 /// Jobas finished and is ready to be collected by the Client53 /// Task as finished and is ready to be collected by the Client 54 54 /// </summary> 55 55 Finished, 56 56 57 57 /// <summary> 58 /// Jobis aborted and result can be collected by the Client58 /// Task is aborted and result can be collected by the Client 59 59 /// </summary> 60 60 Aborted, 61 61 62 62 /// <summary> 63 /// Jobas been aborted due to an error. Results are ready to be collected63 /// Task as been aborted due to an error. Results are ready to be collected 64 64 /// </summary> 65 65 Failed 66 66 }; 67 67 68 public static class JobStateExtensions {68 public static class TaskStateExtensions { 69 69 /// <summary> 70 70 /// This job is not yet done 71 71 /// </summary> 72 public static bool IsActive(this JobState jobState) {73 return ! jobState.IsDone();72 public static bool IsActive(this TaskState taskState) { 73 return !taskState.IsDone(); 74 74 } 75 75 … … 77 77 /// This job is Waiting 78 78 /// </summary> 79 public static bool IsWaiting(this JobState jobState) {80 return jobState == JobState.Waiting;79 public static bool IsWaiting(this TaskState taskState) { 80 return taskState == TaskState.Waiting; 81 81 } 82 82 … … 84 84 /// This job is Finished || Failed || Aborted 85 85 /// </summary> 86 public static bool IsDone(this JobState jobState) {87 return jobState == JobState.Finished ||88 jobState == JobState.Aborted ||89 jobState == JobState.Failed;86 public static bool IsDone(this TaskState taskState) { 87 return taskState == TaskState.Finished || 88 taskState == TaskState.Aborted || 89 taskState == TaskState.Failed; 90 90 } 91 91 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/HeuristicLab.Services.Hive-3.3.csproj
r6717 r6721 111 111 <Compile Include="DataTransfer\HiveExperimentPermission.cs" /> 112 112 <Compile Include="DataTransfer\HiveItem.cs" /> 113 <Compile Include="DataTransfer\ Job.cs" />114 <Compile Include="DataTransfer\ JobData.cs" />115 <Compile Include="DataTransfer\ JobState.cs" />116 <Compile Include="DataTransfer\Lightweight Job.cs" />113 <Compile Include="DataTransfer\Task.cs" /> 114 <Compile Include="DataTransfer\TaskData.cs" /> 115 <Compile Include="DataTransfer\TaskState.cs" /> 116 <Compile Include="DataTransfer\LightweightTask.cs" /> 117 117 <Compile Include="DataTransfer\NamedHiveItem.cs" /> 118 118 <Compile Include="DataTransfer\Permission.cs" /> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/HiveDao.cs
r6717 r6721 37 37 38 38 #region Job Methods 39 public DT. JobGetJob(Guid id) {40 using (var db = CreateContext()) { 41 return DT.Convert.ToDto(db. Jobs.SingleOrDefault(x => x.JobId == id));42 } 43 } 44 45 public IEnumerable<DT. Job> GetJobs(Expression<Func<Job, bool>> predicate) {46 using (var db = CreateContext()) { 47 return db. Jobs.Where(predicate).Select(x => DT.Convert.ToDto(x)).ToArray();48 } 49 } 50 51 public Guid AddJob(DT. Jobdto) {52 using (var db = CreateContext()) { 53 var entity = DT.Convert.ToEntity(dto); 54 db. Jobs.InsertOnSubmit(entity);39 public DT.Task GetJob(Guid id) { 40 using (var db = CreateContext()) { 41 return DT.Convert.ToDto(db.Tasks.SingleOrDefault(x => x.TaskId == id)); 42 } 43 } 44 45 public IEnumerable<DT.Task> GetJobs(Expression<Func<Task, bool>> predicate) { 46 using (var db = CreateContext()) { 47 return db.Tasks.Where(predicate).Select(x => DT.Convert.ToDto(x)).ToArray(); 48 } 49 } 50 51 public Guid AddJob(DT.Task dto) { 52 using (var db = CreateContext()) { 53 var entity = DT.Convert.ToEntity(dto); 54 db.Tasks.InsertOnSubmit(entity); 55 55 db.SubmitChanges(); 56 56 foreach (Guid pluginId in dto.PluginsNeededIds) { 57 db.RequiredPlugins.InsertOnSubmit(new RequiredPlugin() { JobId = entity.JobId, PluginId = pluginId });58 } 59 db.SubmitChanges(); 60 return entity. JobId;61 } 62 } 63 64 public void UpdateJob(DT. Jobdto) {65 using (var db = CreateContext()) { 66 var entity = db. Jobs.FirstOrDefault(x => x.JobId == dto.Id);67 if (entity == null) db. Jobs.InsertOnSubmit(DT.Convert.ToEntity(dto));57 db.RequiredPlugins.InsertOnSubmit(new RequiredPlugin() { TaskId = entity.TaskId, PluginId = pluginId }); 58 } 59 db.SubmitChanges(); 60 return entity.TaskId; 61 } 62 } 63 64 public void UpdateJob(DT.Task dto) { 65 using (var db = CreateContext()) { 66 var entity = db.Tasks.FirstOrDefault(x => x.TaskId == dto.Id); 67 if (entity == null) db.Tasks.InsertOnSubmit(DT.Convert.ToEntity(dto)); 68 68 else DT.Convert.ToEntity(dto, entity); 69 69 foreach (Guid pluginId in dto.PluginsNeededIds) { 70 70 if (db.RequiredPlugins.Count(p => p.PluginId == pluginId) == 0) { 71 db.RequiredPlugins.InsertOnSubmit(new RequiredPlugin() { JobId = entity.JobId, PluginId = pluginId });71 db.RequiredPlugins.InsertOnSubmit(new RequiredPlugin() { TaskId = entity.TaskId, PluginId = pluginId }); 72 72 } 73 73 } … … 78 78 public void DeleteJob(Guid id) { 79 79 using (var db = CreateContext()) { 80 var entity = db. Jobs.FirstOrDefault(x => x.JobId == id);81 if (entity != null) db. Jobs.DeleteOnSubmit(entity);80 var entity = db.Tasks.FirstOrDefault(x => x.TaskId == id); 81 if (entity != null) db.Tasks.DeleteOnSubmit(entity); 82 82 db.SubmitChanges(); // JobData and child jobs are deleted by db-trigger 83 83 } … … 91 91 /// <param name="finished">if true, all parent jobs which have FinishWhenChildJobsFinished=true are returned, otherwise only FinishWhenChildJobsFinished=false are returned</param> 92 92 /// <returns></returns> 93 public IEnumerable<DT. Job> GetParentJobs(IEnumerable<Guid> resourceIds, int count, bool finished) {93 public IEnumerable<DT.Task> GetParentJobs(IEnumerable<Guid> resourceIds, int count, bool finished) { 94 94 using (var db = CreateContext()) { 95 95 var query = from ar in db.AssignedResources 96 96 where resourceIds.Contains(ar.ResourceId) 97 && ar. Job.State == JobState.Waiting98 && ar. Job.IsParentJob99 && (finished ? ar. Job.FinishWhenChildJobsFinished : !ar.Job.FinishWhenChildJobsFinished)100 && (from child in db. Jobs101 where child.Parent JobId == ar.Job.JobId102 select child.State == JobState.Finished103 || child.State == JobState.Aborted104 || child.State == JobState.Failed).All(x => x)105 && (from child in db. Jobs // avoid returning WaitForChildJobs jobs where no child-jobs exist (yet)106 where child.Parent JobId == ar.Job.JobId97 && ar.Task.State == TaskState.Waiting 98 && ar.Task.IsParentTask 99 && (finished ? ar.Task.FinishWhenChildJobsFinished : !ar.Task.FinishWhenChildJobsFinished) 100 && (from child in db.Tasks 101 where child.ParentTaskId == ar.Task.TaskId 102 select child.State == TaskState.Finished 103 || child.State == TaskState.Aborted 104 || child.State == TaskState.Failed).All(x => x) 105 && (from child in db.Tasks // avoid returning WaitForChildJobs jobs where no child-jobs exist (yet) 106 where child.ParentTaskId == ar.Task.TaskId 107 107 select child).Count() > 0 108 orderby ar. Job.Priority descending, db.Random()109 select DT.Convert.ToDto(ar. Job);108 orderby ar.Task.Priority descending, db.Random() 109 select DT.Convert.ToDto(ar.Task); 110 110 return count == 0 ? query.ToArray() : query.Take(count).ToArray(); 111 111 } 112 112 } 113 113 114 public IEnumerable<DT. Job> GetWaitingJobs(DT.Slave slave, int count) {114 public IEnumerable<DT.Task> GetWaitingJobs(DT.Slave slave, int count) { 115 115 using (var db = CreateContext()) { 116 116 var resourceIds = GetParentResources(slave.Id).Select(r => r.Id); … … 120 120 var query = from ar in db.AssignedResources 121 121 where resourceIds.Contains(ar.ResourceId) 122 && !(ar. Job.IsParentJob && ar.Job.FinishWhenChildJobsFinished)123 && ar. Job.State == JobState.Waiting124 && ar. Job.CoresNeeded <= slave.FreeCores125 && ar. Job.MemoryNeeded <= slave.FreeMemory126 orderby ar. Job.Priority descending, db.Random() // take random job to avoid the race condition that occurs when this method is called concurrently (the same job would be returned)127 select DT.Convert.ToDto(ar. Job);122 && !(ar.Task.IsParentTask && ar.Task.FinishWhenChildJobsFinished) 123 && ar.Task.State == TaskState.Waiting 124 && ar.Task.CoresNeeded <= slave.FreeCores 125 && ar.Task.MemoryNeeded <= slave.FreeMemory 126 orderby ar.Task.Priority descending, db.Random() // take random job to avoid the race condition that occurs when this method is called concurrently (the same job would be returned) 127 select DT.Convert.ToDto(ar.Task); 128 128 var waitingJobs = (count == 0 ? query : query.Take(count)).ToArray(); 129 129 return waitingJobs.Union(waitingParentJobs).OrderByDescending(x => x.Priority); … … 131 131 } 132 132 133 public DT. Job UpdateJobState(Guid jobId, JobState jobState, Guid? slaveId, Guid? userId, string exception) {134 using (var db = CreateContext()) { 135 var job = db. Jobs.SingleOrDefault(x => x.JobId == jobId);133 public DT.Task UpdateJobState(Guid jobId, TaskState jobState, Guid? slaveId, Guid? userId, string exception) { 134 using (var db = CreateContext()) { 135 var job = db.Tasks.SingleOrDefault(x => x.TaskId == jobId); 136 136 job.State = jobState; 137 137 db.StateLogs.InsertOnSubmit(new StateLog { 138 JobId = jobId,138 TaskId = jobId, 139 139 State = jobState, 140 140 SlaveId = slaveId, … … 144 144 }); 145 145 db.SubmitChanges(); 146 job = db. Jobs.SingleOrDefault(x => x.JobId == jobId);146 job = db.Tasks.SingleOrDefault(x => x.TaskId == jobId); 147 147 return DT.Convert.ToDto(job); 148 148 } … … 151 151 152 152 #region JobData Methods 153 public DT. JobData GetJobData(Guid id) {153 public DT.TaskData GetJobData(Guid id) { 154 154 using (var db = CreateContext(true)) { 155 return DT.Convert.ToDto(db. JobDatas.SingleOrDefault(x => x.JobId == id));156 } 157 } 158 159 public IEnumerable<DT. JobData> GetJobDatas(Expression<Func<JobData, bool>> predicate) {155 return DT.Convert.ToDto(db.TaskDatas.SingleOrDefault(x => x.TaskId == id)); 156 } 157 } 158 159 public IEnumerable<DT.TaskData> GetJobDatas(Expression<Func<TaskData, bool>> predicate) { 160 160 using (var db = CreateContext(true)) { 161 return db. JobDatas.Where(predicate).Select(x => DT.Convert.ToDto(x)).ToArray();162 } 163 } 164 165 public Guid AddJobData(DT. JobData dto) {161 return db.TaskDatas.Where(predicate).Select(x => DT.Convert.ToDto(x)).ToArray(); 162 } 163 } 164 165 public Guid AddJobData(DT.TaskData dto) { 166 166 using (var db = CreateContext(true)) { 167 167 var entity = DT.Convert.ToEntity(dto); 168 db. JobDatas.InsertOnSubmit(entity);169 db.SubmitChanges(); 170 return entity. JobId;171 } 172 } 173 174 public void UpdateJobData(DT. JobData dto) {168 db.TaskDatas.InsertOnSubmit(entity); 169 db.SubmitChanges(); 170 return entity.TaskId; 171 } 172 } 173 174 public void UpdateJobData(DT.TaskData dto) { 175 175 using (var db = CreateContext(true)) { 176 var entity = db. JobDatas.FirstOrDefault(x => x.JobId == dto.JobId);177 if (entity == null) db. JobDatas.InsertOnSubmit(DT.Convert.ToEntity(dto));176 var entity = db.TaskDatas.FirstOrDefault(x => x.TaskId == dto.TaskId); 177 if (entity == null) db.TaskDatas.InsertOnSubmit(DT.Convert.ToEntity(dto)); 178 178 else DT.Convert.ToEntity(dto, entity); 179 179 db.SubmitChanges(); … … 183 183 public void DeleteJobData(Guid id) { 184 184 using (var db = CreateContext()) { 185 var entity = db. JobDatas.FirstOrDefault(x => x.JobId == id); // check if all the byte[] is loaded into memory here. otherwise work around to delete without loading it186 if (entity != null) db. JobDatas.DeleteOnSubmit(entity);185 var entity = db.TaskDatas.FirstOrDefault(x => x.TaskId == id); // check if all the byte[] is loaded into memory here. otherwise work around to delete without loading it 186 if (entity != null) db.TaskDatas.DeleteOnSubmit(entity); 187 187 db.SubmitChanges(); 188 188 } … … 241 241 return null; 242 242 243 var jobs = db. Jobs.Where(j => j.HiveExperimentId == exp.Id);243 var jobs = db.Tasks.Where(j => j.HiveExperimentId == exp.Id); 244 244 exp.JobCount = jobs.Count(); 245 exp.CalculatingCount = jobs.Count(j => j.State == JobState.Calculating);246 exp.FinishedCount = jobs.Count(j => j.State == JobState.Finished);245 exp.CalculatingCount = jobs.Count(j => j.State == TaskState.Calculating); 246 exp.FinishedCount = jobs.Count(j => j.State == TaskState.Finished); 247 247 return exp; 248 248 } … … 554 554 public void AssignJobToResource(Guid jobId, Guid resourceId) { 555 555 using (var db = CreateContext()) { 556 var job = db. Jobs.Where(x => x.JobId == jobId).Single();557 job.AssignedResources.Add(new AssignedResource() { JobId = jobId, ResourceId = resourceId });556 var job = db.Tasks.Where(x => x.TaskId == jobId).Single(); 557 job.AssignedResources.Add(new AssignedResource() { TaskId = jobId, ResourceId = resourceId }); 558 558 db.SubmitChanges(); 559 559 } … … 562 562 public IEnumerable<DT.Resource> GetAssignedResources(Guid jobId) { 563 563 using (var db = CreateContext()) { 564 var job = db. Jobs.Where(x => x.JobId == jobId).Single();564 var job = db.Tasks.Where(x => x.TaskId == jobId).Single(); 565 565 return job.AssignedResources.Select(x => DT.Convert.ToDto(x.Resource)).ToArray(); 566 566 } … … 598 598 } 599 599 600 public IEnumerable<DT. Job> GetJobsByResourceId(Guid resourceId) {600 public IEnumerable<DT.Task> GetJobsByResourceId(Guid resourceId) { 601 601 using (var db = CreateContext()) { 602 602 var resources = GetChildResources(resourceId).Select(x => x.Id).ToList(); 603 603 resources.Add(resourceId); 604 604 605 var jobs = db. Jobs.Where(j =>606 j.State == JobState.Calculating &&605 var jobs = db.Tasks.Where(j => 606 j.State == TaskState.Calculating && 607 607 j.StateLogs.OrderByDescending(x => x.DateTime).First().SlaveId.HasValue && 608 608 resources.Contains(j.StateLogs.OrderByDescending(x => x.DateTime).First().SlaveId.Value)); … … 631 631 public Guid GetExperimentForJob(Guid jobId) { 632 632 using (var db = CreateContext()) { 633 return db. Jobs.Single(j => j.JobId == jobId).HiveExperimentId;633 return db.Tasks.Single(j => j.TaskId == jobId).HiveExperimentId; 634 634 } 635 635 } … … 743 743 var userStats = new Dictionary<Guid, DT.UserStatistics>(); 744 744 745 var usedCoresByUser = from job in db. Jobs746 where job.State == JobState.Calculating745 var usedCoresByUser = from job in db.Tasks 746 where job.State == TaskState.Calculating 747 747 group job by job.HiveExperiment.OwnerUserId into g 748 748 select new { UserId = g.Key, UsedCores = g.Count() }; … … 755 755 } 756 756 757 var executionTimesByUser = from job in db. Jobs757 var executionTimesByUser = from job in db.Tasks 758 758 group job by job.HiveExperiment.OwnerUserId into g 759 759 select new { UserId = g.Key, ExecutionTime = TimeSpan.FromMilliseconds(g.Select(x => x.ExecutionTimeMs).Sum()) }; … … 766 766 767 767 // execution times only of finished jobs - necessary to compute efficieny 768 var executionTimesFinishedJobs = from job in db. Jobs769 where job.State == JobState.Finished768 var executionTimesFinishedJobs = from job in db.Tasks 769 where job.State == TaskState.Finished 770 770 group job by job.HiveExperiment.OwnerUserId into g 771 771 select new { UserId = g.Key, ExecutionTimeFinishedJobs = TimeSpan.FromMilliseconds(g.Select(x => x.ExecutionTimeMs).Sum()) }; … … 779 779 780 780 // start to end times only of finished jobs - necessary to compute efficiency 781 var startToEndTimesFinishedJobs = from job in db. Jobs782 where job.State == JobState.Finished781 var startToEndTimesFinishedJobs = from job in db.Tasks 782 where job.State == TaskState.Finished 783 783 group job by job.HiveExperiment.OwnerUserId into g 784 784 select new { … … 817 817 818 818 #region Helpers 819 private void CollectChildJobs(HiveDataContext db, Guid parentJobId, List< Job> collection) {820 var jobs = db. Jobs.Where(j => j.ParentJobId == parentJobId);819 private void CollectChildJobs(HiveDataContext db, Guid parentJobId, List<Task> collection) { 820 var jobs = db.Tasks.Where(j => j.ParentTaskId == parentJobId); 821 821 foreach (var job in jobs) { 822 822 collection.Add(job); 823 if (job.IsParent Job)824 CollectChildJobs(db, job. JobId, collection);823 if (job.IsParentTask) 824 CollectChildJobs(db, job.TaskId, collection); 825 825 } 826 826 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/HiveService.cs
r6717 r6721 61 61 62 62 #region Job Methods 63 public Guid AddJob( Job job, JobData jobData, IEnumerable<Guid> resourceIds) {63 public Guid AddJob(Task job, TaskData jobData, IEnumerable<Guid> resourceIds) { 64 64 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 65 65 return trans.UseTransaction(() => { 66 66 job.Id = dao.AddJob(job); 67 jobData. JobId = job.Id;67 jobData.TaskId = job.Id; 68 68 jobData.LastUpdate = DateTime.Now; 69 69 foreach (Guid slaveGroupId in resourceIds) { … … 71 71 } 72 72 dao.AddJobData(jobData); 73 dao.UpdateJobState(job.Id, DA. JobState.Waiting, null, userManager.CurrentUserId, null);74 return jobData. JobId;73 dao.UpdateJobState(job.Id, DA.TaskState.Waiting, null, userManager.CurrentUserId, null); 74 return jobData.TaskId; 75 75 }, false, true); 76 76 } 77 77 78 public Guid AddChildJob(Guid parentJobId, Job job, JobData jobData) {79 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 80 return trans.UseTransaction(() => { 81 job.Parent JobId = parentJobId;78 public Guid AddChildJob(Guid parentJobId, Task job, TaskData jobData) { 79 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 80 return trans.UseTransaction(() => { 81 job.ParentTaskId = parentJobId; 82 82 return AddJob(job, jobData, dao.GetAssignedResources(parentJobId).Select(x => x.Id)); 83 83 }, false, true); 84 84 } 85 85 86 public JobGetJob(Guid jobId) {86 public Task GetJob(Guid jobId) { 87 87 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 88 88 author.AuthorizeForJob(jobId, Permission.Read); … … 90 90 } 91 91 92 public IEnumerable< Job> GetJobs() {92 public IEnumerable<Task> GetJobs() { 93 93 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 94 94 var jobs = dao.GetJobs(x => true); … … 98 98 } 99 99 100 public IEnumerable<Lightweight Job> GetLightweightJobs(IEnumerable<Guid> jobIds) {101 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 102 var jobs = dao.GetJobs(x => jobIds.Contains(x. JobId)).Select(x => new LightweightJob(x)).ToArray();100 public IEnumerable<LightweightTask> GetLightweightJobs(IEnumerable<Guid> jobIds) { 101 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 102 var jobs = dao.GetJobs(x => jobIds.Contains(x.TaskId)).Select(x => new LightweightTask(x)).ToArray(); 103 103 foreach (var job in jobs) 104 104 author.AuthorizeForJob(job.Id, Permission.Read); … … 106 106 } 107 107 108 public IEnumerable<Lightweight Job> GetLightweightChildJobs(Guid? parentJobId, bool recursive, bool includeParent) {109 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 110 var jobs = GetChildJobs(parentJobId, recursive, includeParent).Select(x => new Lightweight Job(x)).ToArray();108 public IEnumerable<LightweightTask> GetLightweightChildJobs(Guid? parentJobId, bool recursive, bool includeParent) { 109 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 110 var jobs = GetChildJobs(parentJobId, recursive, includeParent).Select(x => new LightweightTask(x)).ToArray(); 111 111 foreach (var job in jobs) 112 112 author.AuthorizeForJob(job.Id, Permission.Read); … … 114 114 } 115 115 116 public IEnumerable<Lightweight Job> GetLightweightExperimentJobs(Guid experimentId) {116 public IEnumerable<LightweightTask> GetLightweightExperimentJobs(Guid experimentId) { 117 117 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 118 118 author.AuthorizeForExperiment(experimentId, Permission.Read); 119 return dao.GetJobs(x => x.HiveExperimentId == experimentId).Select(x => new Lightweight Job(x)).ToArray();120 } 121 122 public JobData GetJobData(Guid jobId) {119 return dao.GetJobs(x => x.HiveExperimentId == experimentId).Select(x => new LightweightTask(x)).ToArray(); 120 } 121 122 public TaskData GetJobData(Guid jobId) { 123 123 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 124 124 author.AuthorizeForJob(jobId, Permission.Read); … … 126 126 } 127 127 128 public void UpdateJob( Jobjob) {128 public void UpdateJob(Task job) { 129 129 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 130 130 author.AuthorizeForJob(job.Id, Permission.Full); … … 134 134 } 135 135 136 public void UpdateJobData( Job job, JobData jobData) {136 public void UpdateJobData(Task job, TaskData jobData) { 137 137 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 138 138 author.AuthorizeForJob(job.Id, Permission.Full); 139 author.AuthorizeForJob(jobData. JobId, Permission.Full);139 author.AuthorizeForJob(jobData.TaskId, Permission.Full); 140 140 //trans.UseTransaction(() => { // cneumuel: try without transaction 141 141 jobData.LastUpdate = DateTime.Now; … … 165 165 } 166 166 167 public Job UpdateJobState(Guid jobId, JobState jobState, Guid? slaveId, Guid? userId, string exception) {167 public Task UpdateJobState(Guid jobId, TaskState jobState, Guid? slaveId, Guid? userId, string exception) { 168 168 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 169 169 author.AuthorizeForJob(jobId, Permission.Full); 170 170 return trans.UseTransaction(() => { 171 Jobjob = dao.UpdateJobState(jobId, DataTransfer.Convert.ToEntity(jobState), slaveId, userId, exception);172 173 if (job.Command.HasValue && job.Command.Value == Command.Pause && job.State == JobState.Paused) {171 Task job = dao.UpdateJobState(jobId, DataTransfer.Convert.ToEntity(jobState), slaveId, userId, exception); 172 173 if (job.Command.HasValue && job.Command.Value == Command.Pause && job.State == TaskState.Paused) { 174 174 job.Command = null; 175 } else if (job.Command.HasValue && job.Command.Value == Command.Abort && job.State == JobState.Aborted) {175 } else if (job.Command.HasValue && job.Command.Value == Command.Abort && job.State == TaskState.Aborted) { 176 176 job.Command = null; 177 } else if (job.Command.HasValue && job.Command.Value == Command.Stop && job.State == JobState.Aborted) {177 } else if (job.Command.HasValue && job.Command.Value == Command.Stop && job.State == TaskState.Aborted) { 178 178 job.Command = null; 179 } else if (jobState == JobState.Paused && !job.Command.HasValue) {179 } else if (jobState == TaskState.Paused && !job.Command.HasValue) { 180 180 // slave paused and uploaded the job (no user-command) -> set waiting. 181 job = dao.UpdateJobState(jobId, DataTransfer.Convert.ToEntity( JobState.Waiting), slaveId, userId, exception);181 job = dao.UpdateJobState(jobId, DataTransfer.Convert.ToEntity(TaskState.Waiting), slaveId, userId, exception); 182 182 } 183 183 … … 187 187 } 188 188 189 public IEnumerable< Job> GetJobsByResourceId(Guid resourceId) {189 public IEnumerable<Task> GetJobsByResourceId(Guid resourceId) { 190 190 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 191 191 var jobs = trans.UseTransaction(() => dao.GetJobsByResourceId(resourceId)); … … 202 202 trans.UseTransaction(() => { 203 203 var job = dao.GetJob(jobId); 204 if (job.State == JobState.Calculating || job.State == JobState.Transferring) {204 if (job.State == TaskState.Calculating || job.State == TaskState.Transferring) { 205 205 job.Command = Command.Stop; 206 206 dao.UpdateJob(job); 207 207 } else { 208 if (job.State != JobState.Aborted && job.State != JobState.Finished && job.State != JobState.Failed) {209 job = UpdateJobState(jobId, JobState.Aborted, null, null, string.Empty);208 if (job.State != TaskState.Aborted && job.State != TaskState.Finished && job.State != TaskState.Failed) { 209 job = UpdateJobState(jobId, TaskState.Aborted, null, null, string.Empty); 210 210 } 211 211 } … … 218 218 trans.UseTransaction(() => { 219 219 var job = dao.GetJob(jobId); 220 if (job.State == JobState.Calculating || job.State == JobState.Transferring) {220 if (job.State == TaskState.Calculating || job.State == TaskState.Transferring) { 221 221 job.Command = Command.Pause; 222 222 dao.UpdateJob(job); 223 223 } else { 224 job = UpdateJobState(jobId, JobState.Paused, null, null, string.Empty);224 job = UpdateJobState(jobId, TaskState.Paused, null, null, string.Empty); 225 225 } 226 226 }); … … 231 231 author.AuthorizeForJob(jobId, Permission.Full); 232 232 trans.UseTransaction(() => { 233 Job job = dao.UpdateJobState(jobId, DA.JobState.Waiting, null, userManager.CurrentUserId, string.Empty);233 Task job = dao.UpdateJobState(jobId, DA.TaskState.Waiting, null, userManager.CurrentUserId, string.Empty); 234 234 job.Command = null; 235 235 dao.UpdateJob(job); … … 591 591 592 592 #region Helper Methods 593 private IEnumerable< Job> GetChildJobs(Guid? parentJobId, bool recursive, bool includeParent) {594 var jobs = new List< Job>(dao.GetJobs(x => parentJobId == null ? !x.ParentJobId.HasValue : x.ParentJobId.Value == parentJobId));593 private IEnumerable<Task> GetChildJobs(Guid? parentJobId, bool recursive, bool includeParent) { 594 var jobs = new List<Task>(dao.GetJobs(x => parentJobId == null ? !x.ParentTaskId.HasValue : x.ParentTaskId.Value == parentJobId)); 595 595 596 596 if (recursive) { 597 var childs = new List< Job>();597 var childs = new List<Task>(); 598 598 foreach (var job in jobs) { 599 599 childs.AddRange(GetChildJobs(job.Id, recursive, false)); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/Interfaces/IHiveDao.cs
r6717 r6721 29 29 public interface IHiveDao { 30 30 #region Job Methods 31 DT. JobGetJob(Guid id);32 IEnumerable<DT. Job> GetJobs(Expression<Func<Job, bool>> predicate);33 Guid AddJob(DT. Jobdto);34 void UpdateJob(DT. Jobdto);31 DT.Task GetJob(Guid id); 32 IEnumerable<DT.Task> GetJobs(Expression<Func<Task, bool>> predicate); 33 Guid AddJob(DT.Task dto); 34 void UpdateJob(DT.Task dto); 35 35 void DeleteJob(Guid id); 36 IEnumerable<DT. Job> GetWaitingJobs(DT.Slave slave, int count);37 IEnumerable<DT. Job> GetParentJobs(IEnumerable<Guid> resourceIds, int count, bool finished);38 DT. Job UpdateJobState(Guid jobId, JobState jobState, Guid? slaveId, Guid? userId, string exception);36 IEnumerable<DT.Task> GetWaitingJobs(DT.Slave slave, int count); 37 IEnumerable<DT.Task> GetParentJobs(IEnumerable<Guid> resourceIds, int count, bool finished); 38 DT.Task UpdateJobState(Guid jobId, TaskState jobState, Guid? slaveId, Guid? userId, string exception); 39 39 #endregion 40 40 41 41 #region JobData Methods 42 DT. JobData GetJobData(Guid id);43 IEnumerable<DT. JobData> GetJobDatas(Expression<Func<JobData, bool>> predicate);44 Guid AddJobData(DT. JobData dto);45 void UpdateJobData(DT. JobData dto);42 DT.TaskData GetJobData(Guid id); 43 IEnumerable<DT.TaskData> GetJobDatas(Expression<Func<TaskData, bool>> predicate); 44 Guid AddJobData(DT.TaskData dto); 45 void UpdateJobData(DT.TaskData dto); 46 46 void DeleteJobData(Guid id); 47 47 #endregion … … 117 117 IEnumerable<DT.Resource> GetParentResources(Guid resourceId); 118 118 IEnumerable<DT.Resource> GetChildResources(Guid resourceId); 119 IEnumerable<DT. Job> GetJobsByResourceId(Guid resourceId);119 IEnumerable<DT.Task> GetJobsByResourceId(Guid resourceId); 120 120 #endregion 121 121 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/Manager/EventManager.cs
r6717 r6721 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HeuristicLab.Services.Hive.DataAccess;26 25 using HeuristicLab.Services.Hive.DataAccess; 27 26 using DT = HeuristicLab.Services.Hive.DataTransfer; … … 92 91 var parentJobsToFinish = dao.GetParentJobs(dao.GetResources(x => true).Select(x => x.Id), 0, true); 93 92 foreach (var job in parentJobsToFinish) { 94 dao.UpdateJobState(job.Id, JobState.Finished, null, null, string.Empty);93 dao.UpdateJobState(job.Id, TaskState.Finished, null, null, string.Empty); 95 94 } 96 95 } 97 96 98 97 private void SetJobsWaiting(Guid slaveId) { 99 var jobs = dao.GetJobs(x => x.State == JobState.Calculating).Where(x => x.StateLog.Last().SlaveId == slaveId);98 var jobs = dao.GetJobs(x => x.State == TaskState.Calculating).Where(x => x.StateLog.Last().SlaveId == slaveId); 100 99 foreach (var j in jobs) { 101 DT. Job job = dao.UpdateJobState(j.Id, JobState.Waiting, slaveId, null, "Slave timed out.");100 DT.Task job = dao.UpdateJobState(j.Id, TaskState.Waiting, slaveId, null, "Slave timed out."); 102 101 job.Command = null; 103 102 dao.UpdateJob(job); … … 109 108 /// </summary> 110 109 private void SetTimeoutJobsWaiting() { 111 var jobs = dao.GetJobs(x => (x.State == JobState.Calculating && (DateTime.Now - x.LastHeartbeat) > HeuristicLab.Services.Hive.Properties.Settings.Default.CalculatingJobHeartbeatTimeout)112 || (x.State == JobState.Transferring && (DateTime.Now - x.LastHeartbeat) > HeuristicLab.Services.Hive.Properties.Settings.Default.TransferringJobHeartbeatTimeout));110 var jobs = dao.GetJobs(x => (x.State == TaskState.Calculating && (DateTime.Now - x.LastHeartbeat) > HeuristicLab.Services.Hive.Properties.Settings.Default.CalculatingJobHeartbeatTimeout) 111 || (x.State == TaskState.Transferring && (DateTime.Now - x.LastHeartbeat) > HeuristicLab.Services.Hive.Properties.Settings.Default.TransferringJobHeartbeatTimeout)); 113 112 foreach (var j in jobs) { 114 DT. Job job = dao.UpdateJobState(j.Id, JobState.Waiting, null, null, "Slave timed out.");113 DT.Task job = dao.UpdateJobState(j.Id, TaskState.Waiting, null, null, "Slave timed out."); 115 114 job.Command = null; 116 115 dao.UpdateJob(job); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/Manager/HeartbeatManager.cs
r6717 r6721 71 71 72 72 // returns true if assignment was successful 73 private bool AssignJob(Slave slave, Jobjob) {73 private bool AssignJob(Slave slave, Task job) { 74 74 // load job again and check if it is still available (this is an attempt to reduce the race condition which causes multiple heartbeats to get the same job assigned) 75 if (dao.GetJob(job.Id).State != JobState.Waiting) return false;75 if (dao.GetJob(job.Id).State != TaskState.Waiting) return false; 76 76 77 job = dao.UpdateJobState(job.Id, DataAccess. JobState.Transferring, slave.Id, null, null);77 job = dao.UpdateJobState(job.Id, DataAccess.TaskState.Transferring, slave.Id, null, null); 78 78 79 79 // from now on the job has some time to send the next heartbeat (ApplicationConstants.TransferringJobHeartbeatTimeout) … … 98 98 // process the jobProgresses 99 99 foreach (var jobProgress in heartbeat.JobProgress) { 100 JobcurJob = dao.GetJob(jobProgress.Key);100 Task curJob = dao.GetJob(jobProgress.Key); 101 101 if (curJob == null) { 102 102 // job does not exist in db … … 135 135 } 136 136 137 private bool JobIsAllowedToBeCalculatedBySlave(Guid slaveId, JobcurJob) {137 private bool JobIsAllowedToBeCalculatedBySlave(Guid slaveId, Task curJob) { 138 138 var assignedResourceIds = dao.GetAssignedResources(curJob.Id).Select(x => x.Id); 139 139 var slaveResourceIds = dao.GetParentResources(slaveId).Select(x => x.Id); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/MessageContainer.cs
r6717 r6721 28 28 /// <summary> 29 29 /// The MessageContainer is a container class for Messages. Its two parts are: 30 /// the actual message itself and the JobId, refered by the message30 /// the actual message itself and the TaskId, refered by the message 31 31 /// </summary> 32 32 [StorableClass] … … 56 56 [Storable] 57 57 [DataMember] 58 public Guid JobId { get; set; }58 public Guid TaskId { get; set; } 59 59 60 60 [StorableConstructor] … … 63 63 public MessageContainer(MessageType message) { 64 64 Message = message; 65 JobId = Guid.Empty;65 TaskId = Guid.Empty; 66 66 } 67 67 public MessageContainer(MessageType message, Guid jobId) { 68 68 Message = message; 69 JobId = jobId;69 TaskId = jobId; 70 70 } 71 71 protected MessageContainer(MessageContainer original, Cloner cloner) { 72 72 cloner.RegisterClonedObject(original, this); 73 73 this.Message = original.Message; 74 this. JobId = original.JobId;74 this.TaskId = original.TaskId; 75 75 } 76 76 public virtual IDeepCloneable Clone(Cloner cloner) { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/ServiceContracts/IHiveService.cs
r6717 r6721 33 33 #region Job Methods 34 34 [OperationContract] 35 Guid AddJob( Job job, JobData jobData, IEnumerable<Guid> resourceIds);36 37 [OperationContract] 38 Guid AddChildJob(Guid parentJobId, Job job, JobData jobData);39 40 [OperationContract] 41 JobGetJob(Guid jobId);42 43 [OperationContract] 44 IEnumerable< Job> GetJobs();45 46 [OperationContract] 47 IEnumerable<Lightweight Job> GetLightweightJobs(IEnumerable<Guid> jobIds);48 49 [OperationContract] 50 IEnumerable<Lightweight Job> GetLightweightChildJobs(Guid? parentJobId, bool recursive, bool includeParent);51 52 [OperationContract] 53 IEnumerable<Lightweight Job> GetLightweightExperimentJobs(Guid experimentId);54 55 [OperationContract] 56 JobData GetJobData(Guid jobId);57 58 [OperationContract] 59 void UpdateJob( JobjobDto);60 61 [OperationContract] 62 void UpdateJobData( Job jobDto, JobData jobDataDto);35 Guid AddJob(Task job, TaskData jobData, IEnumerable<Guid> resourceIds); 36 37 [OperationContract] 38 Guid AddChildJob(Guid parentJobId, Task job, TaskData jobData); 39 40 [OperationContract] 41 Task GetJob(Guid jobId); 42 43 [OperationContract] 44 IEnumerable<Task> GetJobs(); 45 46 [OperationContract] 47 IEnumerable<LightweightTask> GetLightweightJobs(IEnumerable<Guid> jobIds); 48 49 [OperationContract] 50 IEnumerable<LightweightTask> GetLightweightChildJobs(Guid? parentJobId, bool recursive, bool includeParent); 51 52 [OperationContract] 53 IEnumerable<LightweightTask> GetLightweightExperimentJobs(Guid experimentId); 54 55 [OperationContract] 56 TaskData GetJobData(Guid jobId); 57 58 [OperationContract] 59 void UpdateJob(Task jobDto); 60 61 [OperationContract] 62 void UpdateJobData(Task jobDto, TaskData jobDataDto); 63 63 64 64 [OperationContract] … … 69 69 70 70 [OperationContract] 71 Job UpdateJobState(Guid jobId, JobState jobState, Guid? slaveId, Guid? userId, string exception);71 Task UpdateJobState(Guid jobId, TaskState jobState, Guid? slaveId, Guid? userId, string exception); 72 72 #endregion 73 73 … … 194 194 195 195 [OperationContract] 196 IEnumerable< Job> GetJobsByResourceId(Guid resourceId);196 IEnumerable<Task> GetJobsByResourceId(Guid resourceId); 197 197 198 198 [OperationContract]
Note: See TracChangeset
for help on using the changeset viewer.