Changeset 5511
- Timestamp:
- 02/17/11 14:47:56 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources
- Files:
-
- 4 added
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Tests/Mocks/MockHiveService.cs ¶
r5458 r5511 154 154 } 155 155 156 public void UpdateJob(Job jobDto , JobData jobDataDto) {156 public void UpdateJob(Job jobDto) { 157 157 Console.WriteLine("Update Job called!"); 158 ResultJobs.Add(jobDto); 159 } 160 161 public void UpdateJobData(Job jobDto, JobData jobDataDto) { 162 Console.WriteLine("Update JobData called!"); 158 163 ResultJobDatas.Add(jobDataDto); 159 164 ResultJobs.Add(jobDto); … … 174 179 if (curJobIdx < jobs.Count) { 175 180 var job = jobs[curJobIdx]; 176 job.SlaveId = slaveId;181 // job.SlaveId = slaveId; // commented out because of change to StateLog 177 182 curJobIdx++; 178 183 return job; -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Tests/SlaveTest.cs ¶
r5404 r5511 76 76 [TestMethod] 77 77 public void TestSingleJob() { 78 Job testJob = new Job { Id = Guid.NewGuid(), JobState = JobState.Waiting, DateCreated = DateTime.Now, CoresNeeded = 1, MemoryNeeded = 0 }; 78 Job testJob = new Job { Id = Guid.NewGuid(), CoresNeeded = 1, MemoryNeeded = 0 }; 79 testJob.SetState(JobState.Waiting); 79 80 List<Job> jobList = new List<Job>(); 80 81 jobList.Add(testJob); … … 113 114 [TestMethod] 114 115 public void TestShutdownSlaveWhileJobRunning() { 115 Job testJob = new Job { Id = Guid.NewGuid(), JobState = JobState.Waiting, DateCreated = DateTime.Now, CoresNeeded = 1, MemoryNeeded = 0 }; 116 Job testJob = new Job { Id = Guid.NewGuid(), CoresNeeded = 1, MemoryNeeded = 0 }; 117 testJob.SetState(JobState.Waiting); 116 118 List<Job> jobList = new List<Job>(); 117 119 jobList.Add(testJob); … … 173 175 [TestMethod] 174 176 public void TestTwoJobs() { 175 Job testJob1 = new Job { Id = Guid.NewGuid(), JobState = JobState.Waiting, DateCreated = DateTime.Now, CoresNeeded = 1, MemoryNeeded = 0 }; 176 Job testJob2 = new Job { Id = Guid.NewGuid(), JobState = JobState.Waiting, DateCreated = DateTime.Now, CoresNeeded = 1, MemoryNeeded = 0 }; 177 Job testJob1 = new Job { Id = Guid.NewGuid(), CoresNeeded = 1, MemoryNeeded = 0 }; 178 testJob1.SetState(JobState.Waiting); 179 Job testJob2 = new Job { Id = Guid.NewGuid(), CoresNeeded = 1, MemoryNeeded = 0 }; 180 testJob2.SetState(JobState.Waiting); 177 181 List<Job> jobList = new List<Job>(); 178 182 jobList.Add(testJob1); -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Core.cs ¶
r5472 r5511 185 185 engines[job.Id].Pause(); 186 186 JobData sJob = engines[job.Id].GetFinishedJob(); 187 job.Exception = engines[job.Id].CurrentException;187 // job.Exception = engines[job.Id].CurrentException; // can there be an exception if a job is paused 188 188 job.ExecutionTime = engines[job.Id].ExecutionTime; 189 189 190 190 try { 191 191 ClientCom.LogMessage("Sending the paused job with id: " + job.Id); 192 wcfService.UpdateJob (job, sJob);192 wcfService.UpdateJobData(job, sJob, ConfigManager.Instance.GetClientInfo().Id); 193 193 SlaveStatusInfo.JobsProcessed++; //TODO: count or not count, thats the question 194 194 } … … 208 208 engines[job.Id].Stop(); 209 209 JobData sJob = engines[job.Id].GetFinishedJob(); 210 job.Exception = engines[job.Id].CurrentException;210 // job.Exception = engines[job.Id].CurrentException; // can there be an exception if a job is stopped regularly 211 211 job.ExecutionTime = engines[job.Id].ExecutionTime; 212 212 213 213 try { 214 214 ClientCom.LogMessage("Sending the stoppped job with id: " + job.Id); 215 wcfService.UpdateJob (job, sJob);215 wcfService.UpdateJobData(job, sJob, ConfigManager.Instance.GetClientInfo().Id); 216 216 SlaveStatusInfo.JobsProcessed++; //TODO: count or not count, thats the question 217 217 } … … 345 345 } else { 346 346 Job job = Jobs[data.JobId]; 347 job.JobState = JobState.WaitingForChildJobs; 348 wcfService.UpdateJob(job, data); 347 job.SetState(JobState.Transferring); 348 wcfService.UpdateJobData(job, data, ConfigManager.Instance.GetClientInfo().Id); 349 job.SetState(JobState.Waiting); // todo: what if it was a ResumeOnChildJobsFinished job before? maybe look into StateLog 350 wcfService.UpdateJob(job); 349 351 } 350 352 KillAppDomain(data.JobId); … … 372 374 cJob.ExecutionTime = engines[jobId].ExecutionTime; 373 375 374 JobData sJob = engines[j obId].GetFinishedJob();375 cJob.Exception = engines[jobId].CurrentException;376 cJob.ExecutionTime = engines[j obId].ExecutionTime;376 JobData sJob = engines[jId].GetFinishedJob(); 377 // cJob.Exception = engines[jId].CurrentException; // can there be an exception if the job is sent normally. the exception should be entered in the statelog with the corresponding state (Failed) 378 cJob.ExecutionTime = engines[jId].ExecutionTime; 377 379 378 380 try { 379 381 ClientCom.LogMessage("Sending the finished job with id: " + jobId); 380 wcfService.UpdateJob (cJob, sJob);382 wcfService.UpdateJobData(cJob, sJob, ConfigManager.Instance.GetClientInfo().Id); 381 383 SlaveStatusInfo.JobsProcessed++; 382 384 } -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Executor.cs ¶
r5469 r5511 128 128 129 129 Job childJob = new Job(); 130 childJob. JobState = JobState.Offline;130 childJob.SetState(JobState.Offline); 131 131 childJob.CoresNeeded = 1; 132 132 childJob.MemoryNeeded = 0; -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/WcfService.cs ¶
r5458 r5511 23 23 using System.Collections.Generic; 24 24 using HeuristicLab.Clients.Common; 25 using HeuristicLab.Clients.Hive.Slave.Properties;26 25 using HeuristicLab.Common; 27 26 using HeuristicLab.Services.Hive.Common; … … 141 140 } 142 141 142 public void UpdateJob(Job job) { 143 using (Disposable<IHiveService> service = GetSlaveService()) { 144 try { 145 service.Obj.UpdateJob(job); 146 } 147 catch (Exception ex) { 148 HandleNetworkError(ex); 149 } 150 } 151 } 152 143 153 /// <summary> 144 154 /// used on pause or if job finished to upload the job results … … 146 156 /// <param name="job"></param> 147 157 /// <param name="jobData"></param> 148 public void UpdateJob(Job job, JobData jobData) { 149 using (Disposable<IHiveService> service = GetSlaveService()) { 150 try { 151 service.Obj.UpdateJob(job, jobData); 152 } 153 catch (Exception ex) { 154 HandleNetworkError(ex); 155 } 156 } 157 } 158 158 public void UpdateJobData(Job job, JobData jobData, Guid slaveId) { 159 using (Disposable<IHiveService> service = GetSlaveService()) { 160 try { 161 JobState before = job.State; 162 job.SetState(JobState.Transferring, slaveId, ""); 163 service.Obj.UpdateJob(job); 164 165 service.Obj.UpdateJobData(job, jobData); 166 167 job.SetState(before, slaveId, ""); 168 service.Obj.UpdateJob(job); 169 } 170 catch (Exception ex) { 171 HandleNetworkError(ex); 172 } 173 } 174 } 175 159 176 public List<MessageContainer> SendHeartbeat(Heartbeat heartbeat) { 160 177 using (Disposable<IHiveService> service = GetSlaveService()) { -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/HiveJobView.cs ¶
r4905 r5511 127 127 } else { 128 128 if (Content != null && Content.Job != null) { 129 this.stateTextBox.Text = Content.Job. JobState.ToString();129 this.stateTextBox.Text = Content.Job.State.ToString(); 130 130 this.executionTimeTextBox.Text = Content.Job.ExecutionTime.ToString(); 131 this.dateCalculatedText.Text = Content.Job.DateCalculated.ToString();131 //this.dateCalculatedText.Text = Content.Job.DateCalculated.ToString(); 132 132 this.dateFinishedTextBox.Text = Content.Job.DateFinished.ToString(); 133 this.exceptionTextBox.Text = Content.Job. Exception;133 this.exceptionTextBox.Text = Content.Job.CurrentStateLog.Exception; 134 134 } else { 135 135 this.stateTextBox.Text = string.Empty; -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveExperimentClient.cs ¶
r5458 r5511 24 24 using System.Linq; 25 25 using System.Threading; 26 using HeuristicLab.Clients.Common; 27 using HeuristicLab.Clients.Hive.Jobs; 26 28 using HeuristicLab.Common; 27 29 using HeuristicLab.Core; 30 using HeuristicLab.Optimization; 31 using HeuristicLab.Services.Hive.Common; 32 using HeuristicLab.Services.Hive.Common.DataTransfer; 33 using HeuristicLab.Services.Hive.Common.ServiceContracts; 28 34 using HeuristicLab.Tracing; 29 using HeuristicLab.Services.Hive.Common;30 using HeuristicLab.Services.Hive.Common.ServiceContracts;31 using HeuristicLab.Services.Hive.Common.DataTransfer;32 using HeuristicLab.Clients.Hive.Jobs;33 using HeuristicLab.Clients.Common;34 using HeuristicLab.Optimization;35 35 36 36 namespace HeuristicLab.Clients.Hive { 37 using System.Configuration; 38 using System.IO; 39 using HeuristicLab.PluginInfrastructure; 37 40 using DT = HeuristicLab.Services.Hive.Common.DataTransfer; 38 using HeuristicLab.PluginInfrastructure;39 using System.IO;40 using System.Configuration;41 using System.Reflection;42 using HeuristicLab.PluginInfrastructure.Manager;43 41 44 42 /// <summary> … … 301 299 private static Plugin UploadConfigurationFile(IHiveService service) { 302 300 string exeFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "HeuristicLab 3.3.exe"); 303 string configFileName = ConfigurationManager.OpenExeConfiguration(exeFilePath).FilePath;301 string configFileName = Path.GetFileName(ConfigurationManager.OpenExeConfiguration(exeFilePath).FilePath); 304 302 305 303 Plugin configPlugin = new Plugin() { … … 331 329 if (hiveJob.OptimizerJob.ComputeInParallel && 332 330 (hiveJob.OptimizerJob.Optimizer is Optimization.Experiment || hiveJob.OptimizerJob.Optimizer is Optimization.BatchRun)) { 333 hiveJob.Job. JobState = JobState.WaitingForChildJobs;331 hiveJob.Job.SetState(JobState.FinishOnChildJobsFinished); 334 332 hiveJob.OptimizerJob.CollectChildJobs = false; // don't collect child-jobs on slaves 335 333 jobData = hiveJob.GetAsJobData(true, out plugins); … … 522 520 if (hj != null) { 523 521 hj.UpdateFromLightweightJob(lightweightJob); 524 if ((hj.Job. JobState == JobState.Aborted ||525 hj.Job. JobState == JobState.Failed ||526 hj.Job. JobState == JobState.Finished) &&522 if ((hj.Job.State == JobState.Aborted || 523 hj.Job.State == JobState.Failed || 524 hj.Job.State == JobState.Finished) && 527 525 !hj.IsFinishedOptimizerDownloaded) { 528 526 LogMessage(hj.Job.Id, "Downloading optimizer for job"); -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveJobClient.cs ¶
r5404 r5511 23 23 using System.Collections.Generic; 24 24 using System.Drawing; 25 using System.IO;26 25 using System.Linq; 27 26 using HeuristicLab.Clients.Hive.Jobs; … … 32 31 using HeuristicLab.PluginInfrastructure; 33 32 using HeuristicLab.Services.Hive.Common.DataTransfer; 34 using HeuristicLab.PluginInfrastructure.Manager;35 33 36 34 namespace HeuristicLab.Clients.Hive { … … 45 43 return HeuristicLab.Common.Resources.VSImageLibrary.Event; 46 44 } else { 47 if (job. JobState == JobState.Waiting) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutablePrepared;48 else if (job. JobState == JobState.WaitingForChildJobs) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutablePrepared;49 else if (job. JobState == JobState.Calculating) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStarted;50 else if (job. JobState == JobState.Aborted) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStopped;51 else if (job. JobState == JobState.Failed) return HeuristicLab.Common.Resources.VSImageLibrary.Error;52 else if (job. JobState == JobState.Finished) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStopped;45 if (job.State == JobState.Waiting) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutablePrepared; 46 else if (job.State == JobState.FinishOnChildJobsFinished) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutablePrepared; 47 else if (job.State == JobState.Calculating) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStarted; 48 else if (job.State == JobState.Aborted) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStopped; 49 else if (job.State == JobState.Failed) return HeuristicLab.Common.Resources.VSImageLibrary.Error; 50 else if (job.State == JobState.Finished) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStopped; 53 51 else return HeuristicLab.Common.Resources.VSImageLibrary.Event; 54 52 } … … 108 106 public HiveJob() { 109 107 this.Job = new Job() { 110 JobState = JobState.Offline,111 DateCreated = DateTime.Now,112 108 CoresNeeded = 1, 113 109 MemoryNeeded = 0 114 110 }; 111 job.SetState(JobState.Offline); 115 112 this.childHiveJobs = new ItemList<HiveJob>(); 116 113 syncJobsWithOptimizers = true; … … 406 403 if (lightweightJob != null) { 407 404 job.Id = lightweightJob.Id; 408 job.DateCreated = lightweightJob.DateCreated;409 job.DateCalculated = lightweightJob.DateCalculated;410 job.DateFinished = lightweightJob.DateFinished;411 job.Exception = lightweightJob.Exception;412 405 job.Id = lightweightJob.Id; 413 406 job.ExecutionTime = lightweightJob.ExecutionTime; 414 job. JobState = lightweightJob.JobState;407 job.StateLog = new List<StateLog>(lightweightJob.StateLog); 415 408 // what about parentJob 416 409 OnJobStateChanged(); … … 488 481 public event EventHandler JobStateChanged; 489 482 private void OnJobStateChanged() { 490 LogMessage("JobStateChanged (State: " + this.Job. JobState + ", ExecutionTime: " + this.Job.ExecutionTime.ToString() + ")");483 LogMessage("JobStateChanged (State: " + this.Job.State + ", ExecutionTime: " + this.Job.ExecutionTime.ToString() + ")"); 491 484 EventHandler handler = JobStateChanged; 492 485 if (handler != null) handler(this, EventArgs.Empty); -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/HiveExperiment.cs ¶
r5458 r5511 29 29 public class HiveExperiment : NamedHiveItem { 30 30 [DataMember] 31 public Guid UserId { get; set; }31 public Guid OwnerUserId { get; set; } 32 32 [DataMember] 33 33 public Guid RootJobId { get; set; } … … 36 36 [DataMember] 37 37 public string ResourceNames { get; set; } 38 [DataMember] 39 public DateTime? LastAccessed { get; set; } 38 40 39 41 public HiveExperiment() { } 40 42 protected HiveExperiment(HiveExperiment original, Cloner cloner) : base(original, cloner) { 41 43 this.RootJobId = original.RootJobId; 42 this. UserId = original.UserId;44 this.OwnerUserId = original.OwnerUserId; 43 45 this.DateCreated = original.DateCreated; 44 46 this.ResourceNames = original.ResourceNames; 47 this.LastAccessed = original.LastAccessed; 45 48 } 46 49 public override IDeepCloneable Clone(Cloner cloner) { -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/Job.cs ¶
r5405 r5511 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Linq;25 24 using System.Runtime.Serialization; 26 25 using HeuristicLab.Common; … … 30 29 [Serializable] 31 30 public class Job : LightweightJob { 32 [DataMember]33 public Guid UserId { get; set; }34 31 [DataMember] 35 32 public int Priority { get; set; } … … 42 39 [DataMember] 43 40 public DateTime? LastHeartbeat { get; set; } 44 41 45 42 public Job() { 46 43 this.PluginsNeededIds = new List<Guid>(); 47 44 } 48 45 protected Job(Job original, Cloner cloner) : base(original, cloner) { 49 this.UserId = original.UserId;50 46 this.Priority = original.Priority; 51 47 this.CoresNeeded = original.CoresNeeded; … … 59 55 60 56 public override string ToString() { 61 return string.Format("State: {0}, SlaveId: {1}, DateCreated: {2}, DateCalculated: {3}, CoresNeeded: {4}, MemoryNeeded: {5}", JobState, SlaveId, DateCreated, DateCalculated, CoresNeeded, MemoryNeeded);57 return string.Format("State: {0}, SlaveId: {1}, DateCreated: {2}, DateCalculated: {3}, CoresNeeded: {4}, MemoryNeeded: {5}", State, CurrentStateLog.SlaveId, DateCreated, CoresNeeded, MemoryNeeded); 62 58 } 63 59 -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/JobState.cs ¶
r4649 r5511 33 33 Waiting, 34 34 35 /// <summary> 35 /// <summary> 36 /// The job is set to Finished when all child jobs are Finished. 37 /// </summary> 38 FinishOnChildJobsFinished, 39 40 /// <summary> 36 41 /// The job is paused and waits on the server to be sent back to a Slave when all of its child jobs are Finished. 37 42 /// </summary> 38 WaitingForChildJobs, 43 ResumeOnChildJobsFinished, 44 45 /// <summary> 46 /// Job is beeing transferred 47 /// </summary> 48 Transferring, 39 49 40 50 /// <summary> … … 72 82 public static bool IsWaiting(this JobState jobState) { 73 83 return jobState == JobState.Waiting || 74 jobState == JobState. WaitingForChildJobs;84 jobState == JobState.FinishOnChildJobsFinished; 75 85 } 76 86 -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/LightweightJob.cs ¶
r5106 r5511 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 23 25 using System.Runtime.Serialization; 24 26 using HeuristicLab.Common; … … 29 31 public class LightweightJob : HiveItem { 30 32 [DataMember] 31 public Guid? SlaveId { get; set; }32 [DataMember]33 public JobState JobState { get; set; }34 [DataMember]35 33 public TimeSpan? ExecutionTime { get; set; } 36 34 [DataMember] 37 public String Exception{ get; set; }35 public Guid? ParentJobId { get; set; } 38 36 [DataMember] 39 public DateTime DateCreated{ get; set; }37 public List<StateLog> StateLog { get; set; } 40 38 [DataMember] 41 public DateTime? DateCalculated{ get; set; }42 [DataMember] 43 public DateTime? DateFinished { get; set;}44 [DataMember]45 public Guid? ParentJobId { get; set;}39 public JobState State { get; set; } 40 41 public StateLog CurrentStateLog { get { return StateLog.Last(); } } 42 public DateTime DateCreated { get { return StateLog.First().DateTime; } } 43 public DateTime? DateFinished { get { return CurrentStateLog.State == JobState.Finished ? new DateTime?(CurrentStateLog.DateTime) : null; } } 46 44 47 45 public LightweightJob() { 48 JobState = DataTransfer.JobState.Offline;46 StateLog = new List<DataTransfer.StateLog>(); 49 47 } 48 50 49 public LightweightJob(Job job) { 51 this.SlaveId = job.SlaveId;52 this.JobState = job.JobState;53 50 this.ExecutionTime = job.ExecutionTime; 54 this.Exception = job.Exception;55 this.DateCreated = job.DateCreated;56 this.DateCalculated = job.DateCalculated;57 this.DateFinished = job.DateFinished;58 51 this.ParentJobId = job.ParentJobId; 52 this.StateLog = new List<StateLog>(); 59 53 } 60 protected LightweightJob(LightweightJob original, Cloner cloner) : base(original, cloner) { 61 this.SlaveId = original.SlaveId; 62 this.JobState = original.JobState; 54 protected LightweightJob(LightweightJob original, Cloner cloner) 55 : base(original, cloner) { 63 56 this.ExecutionTime = original.ExecutionTime; 64 this.Exception = original.Exception;65 this.DateCreated = original.DateCreated;66 this.DateCalculated = original.DateCalculated;67 this.DateFinished = original.DateFinished;68 57 this.ParentJobId = original.ParentJobId; 58 this.StateLog = new List<StateLog>(original.StateLog); 69 59 } 70 60 public override IDeepCloneable Clone(Cloner cloner) { 71 61 return new LightweightJob(this, cloner); 72 62 } 63 64 public void SetState(JobState state) { 65 this.State = state; 66 this.StateLog.Add(new StateLog() { State = state, DateTime = DateTime.Now }); 67 } 68 69 public void SetState(JobState state, Guid userId) { 70 this.State = state; 71 this.StateLog.Add(new StateLog() { State = state, DateTime = DateTime.Now, UserId = userId }); 72 } 73 74 public void SetState(JobState state, Guid slaveId, string exception) { 75 this.State = state; 76 this.StateLog.Add(new StateLog() { State = state, DateTime = DateTime.Now, SlaveId = slaveId, Exception = exception }); 77 } 73 78 } 74 79 } -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/HeuristicLab.Services.Hive.Common-3.4.csproj ¶
r5402 r5511 97 97 <None Include="HeuristicLabServicesHiveCommonPlugin.cs.frame" /> 98 98 <Compile Include="DataTransfer\Appointment.cs" /> 99 <Compile Include="DataTransfer\HiveExperimentPermission.cs" /> 100 <Compile Include="DataTransfer\StateLog.cs" /> 99 101 <Compile Include="DataTransfer\HeartBeat.cs" /> 100 102 <Compile Include="DataTransfer\HiveExperiment.cs" /> 101 103 <Compile Include="DataTransfer\HiveItem.cs" /> 102 104 <Compile Include="DataTransfer\HiveItemBase.cs" /> 105 <Compile Include="DataTransfer\Permission.cs" /> 103 106 <Compile Include="DataTransfer\PluginData.cs" /> 104 107 <Compile Include="DataTransfer\Plugin.cs" /> … … 106 109 <Compile Include="DataTransfer\LightweightJob.cs" /> 107 110 <Compile Include="DataTransfer\JobState.cs" /> 111 <Compile Include="Logger.cs" /> 108 112 <Compile Include="MessageContainer.cs" /> 109 113 <Compile Include="DataTransfer\NamedHiveItem.cs" /> -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/ServiceContracts/IHiveService.cs ¶
r5458 r5511 12 12 #region Job Methods 13 13 [OperationContract] 14 Guid AddJob(Job job, JobData jobData, IEnumerable<Guid> slaveGroupIds);14 Guid AddJob(Job job, JobData jobData, IEnumerable<Guid> resourceIds); 15 15 16 16 [OperationContract] … … 33 33 34 34 [OperationContract] 35 void UpdateJob(Job jobDto, JobData jobDataDto); 35 void UpdateJob(Job jobDto); 36 37 [OperationContract] 38 void UpdateJobData(Job jobDto, JobData jobDataDto); 36 39 37 40 [OperationContract] -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Convert.cs ¶
r5458 r5511 33 33 Id = source.JobId, 34 34 CoresNeeded = source.CoresNeeded, 35 DateCalculated = source.DateCalculated, 36 DateCreated = source.DateCreated, 37 DateFinished = source.DateFinished, 38 Exception = source.Exception, 39 ExecutionTime = source.ExecutionTime, 35 ExecutionTime = string.IsNullOrEmpty(source.ExecutionTime) ? TimeSpan.Zero : TimeSpan.Parse(source.ExecutionTime), 40 36 MemoryNeeded = source.MemoryNeeded, 41 37 ParentJobId = source.ParentJobId, 42 38 Priority = source.Priority, 43 SlaveId = source.SlaveId,44 JobState = source.JobState,45 UserId = source.UserId,46 39 PluginsNeededIds = source.RequiredPlugins.Select(x => x.PluginId).ToList(), 47 LastHeartbeat = source.LastHeartbeat 40 LastHeartbeat = source.LastHeartbeat, 41 State = source.State, 42 StateLog = source.StateLogs.Select(x => Convert.ToDto(x)).OrderBy(x => x.DateTime).ToList() 48 43 }; 49 44 } … … 57 52 target.JobId = source.Id; 58 53 target.CoresNeeded = source.CoresNeeded; 59 target.DateCalculated = source.DateCalculated; 60 target.DateCreated = source.DateCreated; 61 target.DateFinished = source.DateFinished; 62 target.Exception = source.Exception; 63 target.ExecutionTime = source.ExecutionTime; 54 target.ExecutionTime = source.ExecutionTime.ToString(); 64 55 target.MemoryNeeded = source.MemoryNeeded; 65 56 target.ParentJobId = source.ParentJobId; 66 57 target.Priority = source.Priority; 67 target.SlaveId = source.SlaveId;68 target.JobState = source.JobState;69 target.UserId = source.UserId;70 58 target.LastHeartbeat = source.LastHeartbeat; 59 target.State = source.State; 60 if (target.StateLogs == null) target.StateLogs = new EntitySet<StateLog>(); 61 target.StateLogs.AddRange(source.StateLog.Select(x => Convert.ToEntity(x)).OrderBy(x => x.DateTime)); 71 62 // RequiredPlugins are added by Dao 72 63 } … … 91 82 #endregion 92 83 84 #region StateLog 85 public static DT.StateLog ToDto(StateLog source) { 86 if (source == null) return null; 87 return new DT.StateLog { Id = source.StateLogId, DateTime = source.DateTime, Exception = source.Exception, JobId = source.JobId, SlaveId = source.SlaveId, State = source.State, UserId = source.UserId }; 88 } 89 public static StateLog ToEntity(DT.StateLog source) { 90 if (source == null) return null; 91 var entity = new StateLog(); ToEntity(source, entity); 92 return entity; 93 } 94 public static void ToEntity(DT.StateLog source, StateLog target) { 95 if ((source != null) && (target != null)) { 96 target.StateLogId = source.Id; target.DateTime = source.DateTime; target.Exception = source.Exception; target.JobId = source.JobId; target.SlaveId = source.SlaveId; target.State = source.State; target.UserId = source.UserId; 97 } 98 } 99 #endregion 100 93 101 #region HiveExperiment 94 102 public static DT.HiveExperiment ToDto(HiveExperiment source) { 95 103 if (source == null) return null; 96 return new DT.HiveExperiment { Id = source.HiveExperimentId, Description = source.Description, Name = source.Name, RootJobId = source.RootJobId, UserId = source.UserId, DateCreated = source.DateCreated, ResourceNames = source.ResourceIds};104 return new DT.HiveExperiment { Id = source.HiveExperimentId, Description = source.Description, Name = source.Name, RootJobId = source.RootJobId, OwnerUserId = source.OwnerUserId, DateCreated = source.DateCreated, ResourceNames = source.ResourceIds, LastAccessed = source.LastAccessed }; 97 105 } 98 106 public static HiveExperiment ToEntity(DT.HiveExperiment source) { … … 103 111 public static void ToEntity(DT.HiveExperiment source, HiveExperiment target) { 104 112 if ((source != null) && (target != null)) { 105 target.HiveExperimentId = source.Id; target.Description = source.Description; target.Name = source.Name; target.RootJobId = source.RootJobId; target.UserId = source.UserId; target.DateCreated = source.DateCreated; target.ResourceIds = source.ResourceNames; 113 target.HiveExperimentId = source.Id; target.Description = source.Description; target.Name = source.Name; target.RootJobId = source.RootJobId; target.OwnerUserId = source.OwnerUserId; target.DateCreated = source.DateCreated; target.ResourceIds = source.ResourceNames; target.LastAccessed = source.LastAccessed; 114 } 115 } 116 #endregion 117 118 #region HiveExperimentPermission 119 public static DT.HiveExperimentPermission ToDto(HiveExperimentPermission source) { 120 if (source == null) return null; 121 return new DT.HiveExperimentPermission { HiveExperimentId = source.HiveExperimentId, GrantedUserId = source.GrantedUserId, GrantedByUserId = source.GrantedByUserId, Permission = source.Permission }; 122 } 123 public static HiveExperimentPermission ToEntity(DT.HiveExperimentPermission source) { 124 if (source == null) return null; 125 var entity = new HiveExperimentPermission(); ToEntity(source, entity); 126 return entity; 127 } 128 public static void ToEntity(DT.HiveExperimentPermission source, HiveExperimentPermission target) { 129 if ((source != null) && (target != null)) { 130 target.HiveExperimentId = source.HiveExperimentId; target.GrantedUserId = source.GrantedUserId; target.GrantedByUserId = source.GrantedByUserId; target.Permission = source.Permission; 106 131 } 107 132 } … … 145 170 public static DT.Slave ToDto(Slave source) { 146 171 if (source == null) return null; 147 return new DT.Slave { 148 Id = source.ResourceId, 149 ParentResourceId = source.ParentResourceId, 172 return new DT.Slave { 173 Id = source.ResourceId, 174 ParentResourceId = source.ParentResourceId, 150 175 Cores = source.Cores, 151 CpuSpeed = source.CpuSpeed, 152 FreeCores = source.FreeCores, 153 FreeMemory = source.FreeMemory, 154 IsAllowedToCalculate = source.IsAllowedToCalculate, 155 Memory = source.Memory, 156 Name = source.Name, 157 SlaveState = source.SlaveState, 158 CpuArchitecture = source.CpuArchitecture, 176 CpuSpeed = source.CpuSpeed, 177 FreeCores = source.FreeCores, 178 FreeMemory = source.FreeMemory, 179 IsAllowedToCalculate = source.IsAllowedToCalculate, 180 Memory = source.Memory, 181 Name = source.Name, 182 SlaveState = source.SlaveState, 183 CpuArchitecture = source.CpuArchitecture, 159 184 OperatingSystem = source.OperatingSystem, 160 185 LastHeartbeat = source.LastHeartbeat … … 170 195 target.ResourceId = source.Id; 171 196 target.ParentResourceId = source.ParentResourceId; 172 target.Cores = source.Cores; 197 target.Cores = source.Cores; 173 198 target.CpuSpeed = source.CpuSpeed; 174 199 target.FreeCores = source.FreeCores; 175 target.FreeMemory = source.FreeMemory; 200 target.FreeMemory = source.FreeMemory; 176 201 target.IsAllowedToCalculate = source.IsAllowedToCalculate; 177 202 target.Memory = source.Memory; 178 target.Name = source.Name; 179 target.SlaveState = source.SlaveState; 180 target.CpuArchitecture = source.CpuArchitecture; 203 target.Name = source.Name; 204 target.SlaveState = source.SlaveState; 205 target.CpuArchitecture = source.CpuArchitecture; 181 206 target.OperatingSystem = source.OperatingSystem; 182 207 target.LastHeartbeat = source.LastHeartbeat; -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs ¶
r5404 r5511 85 85 using (var db = CreateContext()) { 86 86 var query = from ar in db.AssignedResources 87 join sl in db.StateLogs on ar.JobId equals sl.JobId 87 88 where resourceIds.Contains(ar.ResourceId) 88 && ar.Job. JobState == JobState.WaitingForChildJobs89 && ar.Job.State == JobState.FinishOnChildJobsFinished 89 90 && (from child in db.Jobs 90 91 where child.ParentJobId == ar.Job.JobId 91 select child. JobState == JobState.Finished).All(x => x)92 select child.State == JobState.Finished).All(x => x) 92 93 && (from child in db.Jobs // avoid returning WaitForChildJobs jobs where no child-jobs exist (yet) 93 94 where child.ParentJobId == ar.Job.JobId … … 107 108 var query = from ar in db.AssignedResources 108 109 where resourceIds.Contains(ar.ResourceId) 109 && ar.Job. JobState == JobState.Waiting110 && ar.Job.State == JobState.Waiting 110 111 && ar.Job.CoresNeeded <= slave.FreeCores 111 112 && ar.Job.MemoryNeeded <= slave.FreeMemory … … 197 198 } 198 199 } 200 #endregion 201 202 #region HiveExperimentPermission Methods 203 204 public DT.HiveExperimentPermission GetHiveExperimentPermission(Guid hiveExperimentId, Guid grantedUserId) { 205 using (var db = CreateContext()) { 206 return Convert.ToDto(db.HiveExperimentPermissions.SingleOrDefault(x => x.HiveExperimentId == hiveExperimentId && x.GrantedUserId == grantedUserId)); 207 } 208 } 209 210 public IEnumerable<DT.HiveExperimentPermission> GetHiveExperimentPermissions(Expression<Func<HiveExperimentPermission, bool>> predicate) { 211 using (var db = CreateContext()) { 212 return db.HiveExperimentPermissions.Where(predicate).Select(x => Convert.ToDto(x)).ToArray(); 213 } 214 } 215 216 public void AddHiveExperimentPermission(DT.HiveExperimentPermission dto) { 217 using (var db = CreateContext()) { 218 var entity = Convert.ToEntity(dto); 219 db.HiveExperimentPermissions.InsertOnSubmit(entity); 220 db.SubmitChanges(); 221 } 222 } 223 224 public void UpdateHiveExperimentPermission(DT.HiveExperimentPermission dto) { 225 using (var db = CreateContext()) { 226 var entity = db.HiveExperimentPermissions.FirstOrDefault(x => x.HiveExperimentId == dto.HiveExperimentId && x.GrantedUserId == dto.GrantedUserId); 227 if (entity == null) db.HiveExperimentPermissions.InsertOnSubmit(Convert.ToEntity(dto)); 228 else Convert.ToEntity(dto, entity); 229 db.SubmitChanges(); 230 } 231 } 232 233 public void DeleteHiveExperimentPermission(Guid hiveExperimentId, Guid grantedUserId) { 234 using (var db = CreateContext()) { 235 var entity = db.HiveExperimentPermissions.FirstOrDefault(x => x.HiveExperimentId == hiveExperimentId && x.GrantedUserId == grantedUserId); 236 if (entity != null) db.HiveExperimentPermissions.DeleteOnSubmit(entity); 237 db.SubmitChanges(); 238 } 239 } 240 199 241 #endregion 200 242 … … 440 482 441 483 #region Authorization Methods 442 public bool IsUserAuthorizedForJobs(Guid userId, params Guid[] jobIds) { 443 using (var db = CreateContext()) { 444 var userIds = from job in db.Jobs // this needs to be fast! 445 where jobIds.Contains(job.JobId) 446 select job.UserId; 447 return userIds.All(x => x == userId); 448 } 449 } 484 public Permission GetPermissionForJob(Guid jobId, Guid userId) { 485 using (var db = CreateContext()) { 486 return GetPermissionForExperiment(GetExperimentForJob(jobId), userId); 487 } 488 } 489 490 public Permission GetPermissionForExperiment(Guid experimentId, Guid userId) { 491 using (var db = CreateContext()) { 492 HiveExperimentPermission permission = db.HiveExperimentPermissions.SingleOrDefault(p => p.HiveExperimentId == experimentId && p.GrantedUserId == userId); 493 return permission != null ? permission.Permission : Permission.NotAllowed; 494 } 495 } 496 497 public Guid GetExperimentForJob(Guid jobId) { 498 using (var db = CreateContext()) { 499 var job = db.Jobs.SingleOrDefault(j => j.JobId == jobId); 500 if (job.ParentJobId.HasValue) { 501 return GetExperimentForJob(job.ParentJobId.Value); 502 } else { 503 return db.HiveExperiments.SingleOrDefault(he => he.RootJobId == jobId).HiveExperimentId; 504 } 505 } 506 } 507 450 508 #endregion 451 509 } -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml ¶
r5405 r5511 39 39 <Association Name="Resource_Resource" Member="ChildResources" ThisKey="ResourceId" OtherKey="ParentResourceId" Type="Resource" /> 40 40 <Association Name="Resource_UptimeCalendar" Member="UptimeCalendars" ThisKey="ResourceId" OtherKey="ResourceId" Type="UptimeCalendar" /> 41 <Association Name="Resource_StateLog" Member="StateLogs" ThisKey="ResourceId" OtherKey="SlaveId" Type="StateLog" /> 41 42 <Association Name="Resource_Resource" Member="ParentResource" ThisKey="ParentResourceId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" /> 42 43 <Type Name="Slave" InheritanceCode="Slave" IsInheritanceDefault="true"> … … 52 53 <Column Name="OperatingSystem" Type="System.String" DbType="VarChar(MAX)" CanBeNull="false" UpdateCheck="Never" /> 53 54 <Column Name="LastHeartbeat" Type="System.DateTime" DbType="DateTime" CanBeNull="true" /> 54 <Association Name="Slave_Job" Member="Jobs" ThisKey="ResourceId" OtherKey="SlaveId" Type="Job" />55 55 </Type> 56 56 <Type Name="SlaveGroup" InheritanceCode="GROUP" /> … … 61 61 <Column Name="JobId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" /> 62 62 <Column Name="ParentJobId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" /> 63 <Column Name="JobState" Type="global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState" DbType="VarChar(15)" CanBeNull="false" /> 64 <Column Name="ResourceId" Member="SlaveId" Storage="_ResourceId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" /> 65 <Column Name="ExecutionTime" Type="System.TimeSpan" DbType="Time" CanBeNull="true" /> 66 <Column Name="Exception" Type="System.String" DbType="VarChar(MAX)" CanBeNull="true" /> 67 <Column Name="DateCreated" Type="System.DateTime" DbType="DateTime" CanBeNull="false" /> 68 <Column Name="DateCalculated" Type="System.DateTime" DbType="DateTime" CanBeNull="true" /> 69 <Column Name="DateFinished" Type="System.DateTime" DbType="DateTime" CanBeNull="true" /> 63 <Column Name="ExecutionTime" Type="System.String" DbType="VarChar(30)" CanBeNull="true" /> 70 64 <Column Name="Priority" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" /> 71 <Column Name="ProjectId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" />72 <Column Name="UserId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" />73 65 <Column Name="CoresNeeded" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" /> 74 66 <Column Name="MemoryNeeded" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" /> 75 67 <Column Name="LastHeartbeat" Type="System.DateTime" DbType="DateTime" CanBeNull="true" /> 68 <Column Name="JobState" Member="State" Type="global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState" DbType="VarChar(30)" CanBeNull="false" /> 76 69 <Association Name="Job_AssignedResource" Member="AssignedResources" ThisKey="JobId" OtherKey="JobId" Type="AssignedResource" /> 77 70 <Association Name="Job_RequiredPlugin" Member="RequiredPlugins" ThisKey="JobId" OtherKey="JobId" Type="RequiredPlugin" /> 78 71 <Association Name="Job_Job" Member="ChildJobs" Storage="_Jobs" ThisKey="JobId" OtherKey="ParentJobId" Type="Job" /> 79 72 <Association Name="Job_JobData" Member="JobData" ThisKey="JobId" OtherKey="JobId" Type="JobData" Cardinality="One" /> 73 <Association Name="Job_StateLog" Member="StateLogs" ThisKey="JobId" OtherKey="JobId" Type="StateLog" /> 80 74 <Association Name="Job_Job" Member="ParentJob" Storage="_Job1" ThisKey="ParentJobId" OtherKey="JobId" Type="Job" IsForeignKey="true" /> 81 <Association Name="Slave_Job" Member="Slave" ThisKey="SlaveId" OtherKey="ResourceId" Type="Slave" IsForeignKey="true" DeleteRule="SET NULL" />82 75 </Type> 83 76 </Table> … … 100 93 <Column Name="Description" Type="System.String" DbType="VarChar(MAX)" CanBeNull="true" /> 101 94 <Column Name="ResourceIds" Type="System.String" DbType="VarChar(MAX)" CanBeNull="true" /> 102 <Column Name=" UserId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" />95 <Column Name="OwnerUserId" Storage="_UserId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" /> 103 96 <Column Name="RootJobId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" /> 104 97 <Column Name="DateCreated" Type="System.DateTime" DbType="DateTime" CanBeNull="false" /> 98 <Column Name="LastAccessed" Type="System.DateTime" DbType="DateTime" CanBeNull="true" /> 99 <Column Name="IsHiveEngine" Type="System.Boolean" DbType="Bit" CanBeNull="false" /> 100 <Association Name="HiveExperiment_HiveExperimentPermission" Member="HiveExperimentPermissions" ThisKey="HiveExperimentId" OtherKey="HiveExperimentId" Type="HiveExperimentPermission" /> 105 101 <Association Name="Job_HiveExperiment" Member="RootJob" Storage="_Job" ThisKey="RootJobId" OtherKey="JobId" Type="Job" IsForeignKey="true" DeleteRule="CASCADE" /> 106 102 </Type> 107 103 </Table> 108 <Table Name=" " Member="JobDatas">104 <Table Name="dbo.JobData" Member="JobDatas"> 109 105 <Type Name="JobData"> 110 106 <Column Name="JobId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" /> … … 114 110 </Type> 115 111 </Table> 116 <Table Name=" " Member="PluginDatas">112 <Table Name="dbo.PluginData" Member="PluginDatas"> 117 113 <Type Name="PluginData"> 118 114 <Column Name="PluginDataId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" /> … … 123 119 </Type> 124 120 </Table> 121 <Table Name="dbo.StateLog" Member="StateLogs"> 122 <Type Name="StateLog"> 123 <Column Name="StateLogId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" /> 124 <Column Name="State" Type="global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState" DbType="VarChar(30) NOT NULL" CanBeNull="false" /> 125 <Column Name="DateTime" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" /> 126 <Column Name="JobId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" /> 127 <Column Name="UserId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" /> 128 <Column Name="SlaveId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" /> 129 <Column Name="Exception" Type="System.String" DbType="VarChar(MAX)" CanBeNull="false" /> 130 <Association Name="Job_StateLog" Member="Job" ThisKey="JobId" OtherKey="JobId" Type="Job" IsForeignKey="true" /> 131 <Association Name="Resource_StateLog" Member="Resource" ThisKey="SlaveId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" /> 132 </Type> 133 </Table> 134 <Table Name="dbo.HiveExperimentPermission" Member="HiveExperimentPermissions"> 135 <Type Name="HiveExperimentPermission"> 136 <Column Name="HiveExperimentId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" /> 137 <Column Name="GrantedUserId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" /> 138 <Column Name="GrantedByUserId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" /> 139 <Column Name="Permission" Type="global::HeuristicLab.Services.Hive.Common.DataTransfer.Permission" DbType="VarChar(15) NOT NULL" CanBeNull="false" /> 140 <Association Name="HiveExperiment_HiveExperimentPermission" Member="HiveExperiment" ThisKey="HiveExperimentId" OtherKey="HiveExperimentId" Type="HiveExperiment" IsForeignKey="true" /> 141 </Type> 142 </Table> 125 143 </Database> -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml.layout ¶
r5405 r5511 3 3 <DataContextMoniker Name="/HiveDataContext" /> 4 4 <nestedChildShapes> 5 <classShape Id="a929c9dc-69f4-4488-ba1c-a2342bf81d89" absoluteBounds="8.875, 3. 75, 2, 1.3862939453124987">5 <classShape Id="a929c9dc-69f4-4488-ba1c-a2342bf81d89" absoluteBounds="8.875, 3.875, 2, 1.3862939453124987"> 6 6 <DataClassMoniker Name="/HiveDataContext/AssignedResource" /> 7 7 <nestedChildShapes> 8 <elementListCompartment Id="8b005775-f0ee-41b0-ae10-6d1151003708" absoluteBounds="8.89, 4. 2100000000000009, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />8 <elementListCompartment Id="8b005775-f0ee-41b0-ae10-6d1151003708" absoluteBounds="8.89, 4.3350000000000009, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" /> 9 9 </nestedChildShapes> 10 10 </classShape> 11 <classShape Id="7d998e56-4fba-41ca-a1a8-1dcdb9068edf" absoluteBounds=" 9, 5.5, 2, 1.9631982421874996">11 <classShape Id="7d998e56-4fba-41ca-a1a8-1dcdb9068edf" absoluteBounds="8.875, 5.5, 2, 1.9631982421874996"> 12 12 <DataClassMoniker Name="/HiveDataContext/Plugin" /> 13 13 <nestedChildShapes> 14 <elementListCompartment Id="ec4ba325-6dff-4418-baad-59af81ae2024" absoluteBounds=" 9.015, 5.9600000000000009, 1.9700000000000002, 1.4031982421875" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />14 <elementListCompartment Id="ec4ba325-6dff-4418-baad-59af81ae2024" absoluteBounds="8.89, 5.9600000000000009, 1.9700000000000002, 1.4031982421875" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" /> 15 15 </nestedChildShapes> 16 16 </classShape> … … 27 27 </nestedChildShapes> 28 28 </classShape> 29 <classShape Id="695bfc39-59f3-4e60-8644-f847964bf62c" absoluteBounds="6.5, 1, 2, 3.6939111328124996">29 <classShape Id="695bfc39-59f3-4e60-8644-f847964bf62c" absoluteBounds="6.5, 1, 2, 2.3478011067708335"> 30 30 <DataClassMoniker Name="/HiveDataContext/Job" /> 31 31 <nestedChildShapes> 32 <elementListCompartment Id="a6a30e11-03d1-4869-82e6-b733f4ef9974" absoluteBounds="6.5150000000000006, 1.46, 1.9700000000000002, 3.1339111328125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />32 <elementListCompartment Id="a6a30e11-03d1-4869-82e6-b733f4ef9974" absoluteBounds="6.5150000000000006, 1.46, 1.9700000000000002, 1.7878011067708333" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" /> 33 33 </nestedChildShapes> 34 34 </classShape> … … 39 39 </nestedChildShapes> 40 40 </classShape> 41 <classShape Id="e6f840cc-2968-4be1-b234-eef624ccacbb" absoluteBounds="4.125, 2.625, 2, 2. 1554996744791666">41 <classShape Id="e6f840cc-2968-4be1-b234-eef624ccacbb" absoluteBounds="4.125, 2.625, 2, 2.5401025390624996"> 42 42 <DataClassMoniker Name="/HiveDataContext/HiveExperiment" /> 43 43 <nestedChildShapes> 44 <elementListCompartment Id="0c65d4e1-256a-4a91-9a57-392f25e4de7f" absoluteBounds="4.1400000000000006, 3.0850000000000009, 1.9700000000000002, 1. 5954996744791665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />44 <elementListCompartment Id="0c65d4e1-256a-4a91-9a57-392f25e4de7f" absoluteBounds="4.1400000000000006, 3.0850000000000009, 1.9700000000000002, 1.9801025390625" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" /> 45 45 </nestedChildShapes> 46 46 </classShape> … … 69 69 </nodes> 70 70 </inheritanceConnector> 71 <associationConnector edgePoints="[(11.9843735 : 2.57859537760417); (11.9843735 : 4. 44314697265625); (10.875 : 4.44314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">71 <associationConnector edgePoints="[(11.9843735 : 2.57859537760417); (11.9843735 : 4.56814697265625); (10.875 : 4.56814697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 72 72 <AssociationMoniker Name="/HiveDataContext/Resource/Resource_AssignedResource" /> 73 73 <nodes> … … 76 76 </nodes> 77 77 </associationConnector> 78 <associationConnector edgePoints="[(8.5 : 4.22195556640625); (8.875 : 4.22195556640625)]" fixedFrom="NotFixed" fixedTo="NotFixed">78 <associationConnector edgePoints="[(8.5 : 3.34780110677083); (8.875 : 3.875)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 79 79 <AssociationMoniker Name="/HiveDataContext/Job/Job_AssignedResource" /> 80 80 <nodes> … … 83 83 </nodes> 84 84 </associationConnector> 85 <associationConnector edgePoints="[(7. 0898076923077 : 4.6939111328125); (7.0898076923077 : 5.5)]" fixedFrom="NotFixed" fixedTo="NotFixed">85 <associationConnector edgePoints="[(7.4687475 : 3.34780110677083); (7.4687475 : 5.5)]" fixedFrom="Algorithm" fixedTo="Algorithm"> 86 86 <AssociationMoniker Name="/HiveDataContext/Job/Job_RequiredPlugin" /> 87 87 <nodes> … … 97 97 </nodes> 98 98 </associationConnector> 99 <associationConnector edgePoints="[(8.875 : 2.33735270182292); (8.5 : 2.33735270182292)]" fixedFrom="NotFixed" fixedTo="NotFixed">100 <AssociationMoniker Name="/HiveDataContext/Slave/Slave_Job" />101 <nodes>102 <classShapeMoniker Id="26f4edfa-91dd-4941-a058-359f89e567a8" />103 <classShapeMoniker Id="695bfc39-59f3-4e60-8644-f847964bf62c" />104 </nodes>105 </associationConnector>106 99 <associationConnector edgePoints="[(12.781252 : 2.57859537760417); (12.781252 : 3.54212367513021); (13.5 : 3.54212367513021)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 107 100 <AssociationMoniker Name="/HiveDataContext/Resource/Resource_UptimeCalendar" /> … … 111 104 </nodes> 112 105 </associationConnector> 113 <associationConnector edgePoints="[(6.5 : 3.65945556640625); (6.125 : 3.65945556640625)]" fixedFrom="NotFixed" fixedTo="NotFixed">106 <associationConnector edgePoints="[(6.5 : 2.98640055338542); (6.125 : 2.98640055338542)]" fixedFrom="Algorithm" fixedTo="Algorithm"> 114 107 <AssociationMoniker Name="/HiveDataContext/Job/Job_HiveExperiment" /> 115 108 <nodes> … … 124 117 </nestedChildShapes> 125 118 </classShape> 126 <classShape Id="ad25bd0f-80e8-4a06-abd8-190eb678eec7" absoluteBounds="11. 625, 5.5, 2, 1.5785953776041666">119 <classShape Id="ad25bd0f-80e8-4a06-abd8-190eb678eec7" absoluteBounds="11.25, 5.5, 2, 1.5785953776041666"> 127 120 <DataClassMoniker Name="/HiveDataContext/PluginData" /> 128 121 <nestedChildShapes> 129 <elementListCompartment Id="acddb513-7de6-4bb4-8335-d6982fb2ef35" absoluteBounds="11. 64, 5.9600000000000009, 1.9700000000000002, 1.0185953776041665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />122 <elementListCompartment Id="acddb513-7de6-4bb4-8335-d6982fb2ef35" absoluteBounds="11.265, 5.9600000000000009, 1.9700000000000002, 1.0185953776041665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" /> 130 123 </nestedChildShapes> 131 124 </classShape> 132 <associationConnector edgePoints="[(1 1 : 6.28929768880208); (11.625 : 6.28929768880208)]" fixedFrom="NotFixed" fixedTo="NotFixed">125 <associationConnector edgePoints="[(10.875 : 6.28929768880208); (11.25 : 6.28929768880208)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 133 126 <AssociationMoniker Name="/HiveDataContext/Plugin/Plugin_PluginData" /> 134 127 <nodes> … … 137 130 </nodes> 138 131 </associationConnector> 139 <associationConnector edgePoints="[(6.5 : 1.69314697265625); (6.125 : 1.69314697265625)]" fixedFrom=" NotFixed" fixedTo="NotFixed">132 <associationConnector edgePoints="[(6.5 : 1.69314697265625); (6.125 : 1.69314697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm"> 140 133 <AssociationMoniker Name="/HiveDataContext/Job/Job_JobData" /> 141 134 <nodes> … … 144 137 </nodes> 145 138 </associationConnector> 146 <associationConnector edgePoints="[( 9: 6.19314697265625); (8.5 : 6.19314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">139 <associationConnector edgePoints="[(8.875 : 6.19314697265625); (8.5 : 6.19314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 147 140 <AssociationMoniker Name="/HiveDataContext/Plugin/Plugin_RequiredPlugin" /> 148 141 <nodes> … … 158 151 </nodes> 159 152 </associationConnector> 153 <classShape Id="00352397-340e-449a-8e23-6ddd216e8617" absoluteBounds="1.75, 1, 2, 2.1554996744791666"> 154 <DataClassMoniker Name="/HiveDataContext/StateLog" /> 155 <nestedChildShapes> 156 <elementListCompartment Id="9a003897-deef-4bb5-b180-4c4bcdb7fadc" absoluteBounds="1.765, 1.46, 1.9700000000000002, 1.5954996744791665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" /> 157 </nestedChildShapes> 158 </classShape> 159 <classShape Id="4d800dc9-1b18-469f-b02c-d4554757c5e1" absoluteBounds="1.75, 3.625, 2, 1.5785953776041666"> 160 <DataClassMoniker Name="/HiveDataContext/HiveExperimentPermission" /> 161 <nestedChildShapes> 162 <elementListCompartment Id="dedd97d3-a9a2-45a2-9b95-d7366fb65a7f" absoluteBounds="1.765, 4.085, 1.9700000000000002, 1.0185953776041665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" /> 163 </nestedChildShapes> 164 </classShape> 165 <associationConnector edgePoints="[(6.5 : 2.50564697265625); (3.75 : 2.50564697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm"> 166 <AssociationMoniker Name="/HiveDataContext/Job/Job_StateLog" /> 167 <nodes> 168 <classShapeMoniker Id="695bfc39-59f3-4e60-8644-f847964bf62c" /> 169 <classShapeMoniker Id="00352397-340e-449a-8e23-6ddd216e8617" /> 170 </nodes> 171 </associationConnector> 172 <associationConnector edgePoints="[(11.25 : 1.78929768880208); (10.9375 : 1.78929768880208); (10.9375 : 0.6875); (2.75 : 0.6875); (2.75 : 1)]" fixedFrom="Algorithm" fixedTo="Algorithm"> 173 <AssociationMoniker Name="/HiveDataContext/Resource/Resource_StateLog" /> 174 <nodes> 175 <classShapeMoniker Id="706a4581-6daf-4e71-ae2a-87d50b27a051" /> 176 <classShapeMoniker Id="00352397-340e-449a-8e23-6ddd216e8617" /> 177 </nodes> 178 </associationConnector> 179 <associationConnector edgePoints="[(4.125 : 4.39505126953125); (3.75 : 4.39505126953125)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 180 <AssociationMoniker Name="/HiveDataContext/HiveExperiment/HiveExperiment_HiveExperimentPermission" /> 181 <nodes> 182 <classShapeMoniker Id="e6f840cc-2968-4be1-b234-eef624ccacbb" /> 183 <classShapeMoniker Id="4d800dc9-1b18-469f-b02c-d4554757c5e1" /> 184 </nodes> 185 </associationConnector> 160 186 </nestedChildShapes> 161 187 </ordesignerObjectsDiagram> -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.designer.cs ¶
r5405 r5511 58 58 partial void UpdatePluginData(PluginData instance); 59 59 partial void DeletePluginData(PluginData instance); 60 partial void InsertStateLog(StateLog instance); 61 partial void UpdateStateLog(StateLog instance); 62 partial void DeleteStateLog(StateLog instance); 63 partial void InsertHiveExperimentPermission(HiveExperimentPermission instance); 64 partial void UpdateHiveExperimentPermission(HiveExperimentPermission instance); 65 partial void DeleteHiveExperimentPermission(HiveExperimentPermission instance); 60 66 #endregion 61 67 … … 153 159 { 154 160 return this.GetTable<PluginData>(); 161 } 162 } 163 164 public System.Data.Linq.Table<StateLog> StateLogs 165 { 166 get 167 { 168 return this.GetTable<StateLog>(); 169 } 170 } 171 172 public System.Data.Linq.Table<HiveExperimentPermission> HiveExperimentPermissions 173 { 174 get 175 { 176 return this.GetTable<HiveExperimentPermission>(); 155 177 } 156 178 } … … 788 810 private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); 789 811 790 pr otectedSystem.Guid _ResourceId;812 private System.Guid _ResourceId; 791 813 792 814 private string _Name; … … 801 823 802 824 private EntitySet<UptimeCalendar> _UptimeCalendars; 825 826 private EntitySet<StateLog> _StateLogs; 803 827 804 828 private EntityRef<Resource> _ParentResource; … … 823 847 this._ChildResources = new EntitySet<Resource>(new Action<Resource>(this.attach_ChildResources), new Action<Resource>(this.detach_ChildResources)); 824 848 this._UptimeCalendars = new EntitySet<UptimeCalendar>(new Action<UptimeCalendar>(this.attach_UptimeCalendars), new Action<UptimeCalendar>(this.detach_UptimeCalendars)); 849 this._StateLogs = new EntitySet<StateLog>(new Action<StateLog>(this.attach_StateLogs), new Action<StateLog>(this.detach_StateLogs)); 825 850 this._ParentResource = default(EntityRef<Resource>); 826 851 OnCreated(); … … 950 975 } 951 976 977 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_StateLog", Storage="_StateLogs", ThisKey="ResourceId", OtherKey="SlaveId")] 978 public EntitySet<StateLog> StateLogs 979 { 980 get 981 { 982 return this._StateLogs; 983 } 984 set 985 { 986 this._StateLogs.Assign(value); 987 } 988 } 989 952 990 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_Resource", Storage="_ParentResource", ThisKey="ParentResourceId", OtherKey="ResourceId", IsForeignKey=true)] 953 991 public Resource ParentResource … … 1035 1073 1036 1074 private void detach_UptimeCalendars(UptimeCalendar entity) 1075 { 1076 this.SendPropertyChanging(); 1077 entity.Resource = null; 1078 } 1079 1080 private void attach_StateLogs(StateLog entity) 1081 { 1082 this.SendPropertyChanging(); 1083 entity.Resource = this; 1084 } 1085 1086 private void detach_StateLogs(StateLog entity) 1037 1087 { 1038 1088 this.SendPropertyChanging(); … … 1065 1115 1066 1116 private System.Nullable<System.DateTime> _LastHeartbeat; 1067 1068 private EntitySet<Job> _Jobs;1069 1117 1070 1118 #region Extensibility Method Definitions … … 1098 1146 public Slave() 1099 1147 { 1100 this._Jobs = new EntitySet<Job>(new Action<Job>(this.attach_Jobs), new Action<Job>(this.detach_Jobs));1101 1148 OnCreated(); 1102 1149 } … … 1320 1367 } 1321 1368 } 1322 }1323 1324 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Slave_Job", Storage="_Jobs", ThisKey="ResourceId", OtherKey="SlaveId")]1325 public EntitySet<Job> Jobs1326 {1327 get1328 {1329 return this._Jobs;1330 }1331 set1332 {1333 this._Jobs.Assign(value);1334 }1335 }1336 1337 private void attach_Jobs(Job entity)1338 {1339 this.SendPropertyChanging();1340 entity.Slave = this;1341 }1342 1343 private void detach_Jobs(Job entity)1344 {1345 this.SendPropertyChanging();1346 entity.Slave = null;1347 1369 } 1348 1370 } … … 1373 1395 private System.Nullable<System.Guid> _ParentJobId; 1374 1396 1375 private global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState _JobState; 1376 1377 private System.Nullable<System.Guid> _ResourceId; 1378 1379 private System.Nullable<System.TimeSpan> _ExecutionTime; 1380 1381 private string _Exception; 1382 1383 private System.DateTime _DateCreated; 1384 1385 private System.Nullable<System.DateTime> _DateCalculated; 1386 1387 private System.Nullable<System.DateTime> _DateFinished; 1397 private string _ExecutionTime; 1388 1398 1389 1399 private int _Priority; 1390 1400 1391 private System.Nullable<System.Guid> _ProjectId;1392 1393 private System.Guid _UserId;1394 1395 1401 private int _CoresNeeded; 1396 1402 … … 1399 1405 private System.Nullable<System.DateTime> _LastHeartbeat; 1400 1406 1407 private global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState _State; 1408 1401 1409 private EntitySet<AssignedResource> _AssignedResources; 1402 1410 … … 1407 1415 private EntityRef<JobData> _JobData; 1408 1416 1417 private EntitySet<StateLog> _StateLogs; 1418 1409 1419 private EntityRef<Job> _Job1; 1410 1411 private EntityRef<Slave> _Slave;1412 1420 1413 1421 #region Extensibility Method Definitions … … 1419 1427 partial void OnParentJobIdChanging(System.Nullable<System.Guid> value); 1420 1428 partial void OnParentJobIdChanged(); 1421 partial void OnJobStateChanging(global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState value); 1422 partial void OnJobStateChanged(); 1423 partial void OnSlaveIdChanging(System.Nullable<System.Guid> value); 1424 partial void OnSlaveIdChanged(); 1425 partial void OnExecutionTimeChanging(System.Nullable<System.TimeSpan> value); 1429 partial void OnExecutionTimeChanging(string value); 1426 1430 partial void OnExecutionTimeChanged(); 1427 partial void OnExceptionChanging(string value);1428 partial void OnExceptionChanged();1429 partial void OnDateCreatedChanging(System.DateTime value);1430 partial void OnDateCreatedChanged();1431 partial void OnDateCalculatedChanging(System.Nullable<System.DateTime> value);1432 partial void OnDateCalculatedChanged();1433 partial void OnDateFinishedChanging(System.Nullable<System.DateTime> value);1434 partial void OnDateFinishedChanged();1435 1431 partial void OnPriorityChanging(int value); 1436 1432 partial void OnPriorityChanged(); 1437 partial void OnProjectIdChanging(System.Nullable<System.Guid> value);1438 partial void OnProjectIdChanged();1439 partial void OnUserIdChanging(System.Guid value);1440 partial void OnUserIdChanged();1441 1433 partial void OnCoresNeededChanging(int value); 1442 1434 partial void OnCoresNeededChanged(); … … 1445 1437 partial void OnLastHeartbeatChanging(System.Nullable<System.DateTime> value); 1446 1438 partial void OnLastHeartbeatChanged(); 1439 partial void OnStateChanging(global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState value); 1440 partial void OnStateChanged(); 1447 1441 #endregion 1448 1442 … … 1453 1447 this._Jobs = new EntitySet<Job>(new Action<Job>(this.attach_Jobs), new Action<Job>(this.detach_Jobs)); 1454 1448 this._JobData = default(EntityRef<JobData>); 1449 this._StateLogs = new EntitySet<StateLog>(new Action<StateLog>(this.attach_StateLogs), new Action<StateLog>(this.detach_StateLogs)); 1455 1450 this._Job1 = default(EntityRef<Job>); 1456 this._Slave = default(EntityRef<Slave>);1457 1451 OnCreated(); 1458 1452 } … … 1502 1496 } 1503 1497 1504 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_JobState", DbType="VarChar(15)", CanBeNull=false)] 1505 public global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState JobState 1506 { 1507 get 1508 { 1509 return this._JobState; 1510 } 1511 set 1512 { 1513 if ((this._JobState != value)) 1514 { 1515 this.OnJobStateChanging(value); 1516 this.SendPropertyChanging(); 1517 this._JobState = value; 1518 this.SendPropertyChanged("JobState"); 1519 this.OnJobStateChanged(); 1520 } 1521 } 1522 } 1523 1524 [global::System.Data.Linq.Mapping.ColumnAttribute(Name="ResourceId", Storage="_ResourceId", DbType="UniqueIdentifier")] 1525 public System.Nullable<System.Guid> SlaveId 1526 { 1527 get 1528 { 1529 return this._ResourceId; 1530 } 1531 set 1532 { 1533 if ((this._ResourceId != value)) 1534 { 1535 this.OnSlaveIdChanging(value); 1536 this.SendPropertyChanging(); 1537 this._ResourceId = value; 1538 this.SendPropertyChanged("SlaveId"); 1539 this.OnSlaveIdChanged(); 1540 } 1541 } 1542 } 1543 1544 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="Time")] 1545 public System.Nullable<System.TimeSpan> ExecutionTime 1498 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="VarChar(30)")] 1499 public string ExecutionTime 1546 1500 { 1547 1501 get … … 1562 1516 } 1563 1517 1564 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Exception", DbType="VarChar(MAX)")]1565 public string Exception1566 {1567 get1568 {1569 return this._Exception;1570 }1571 set1572 {1573 if ((this._Exception != value))1574 {1575 this.OnExceptionChanging(value);1576 this.SendPropertyChanging();1577 this._Exception = value;1578 this.SendPropertyChanged("Exception");1579 this.OnExceptionChanged();1580 }1581 }1582 }1583 1584 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DateCreated", DbType="DateTime")]1585 public System.DateTime DateCreated1586 {1587 get1588 {1589 return this._DateCreated;1590 }1591 set1592 {1593 if ((this._DateCreated != value))1594 {1595 this.OnDateCreatedChanging(value);1596 this.SendPropertyChanging();1597 this._DateCreated = value;1598 this.SendPropertyChanged("DateCreated");1599 this.OnDateCreatedChanged();1600 }1601 }1602 }1603 1604 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DateCalculated", DbType="DateTime")]1605 public System.Nullable<System.DateTime> DateCalculated1606 {1607 get1608 {1609 return this._DateCalculated;1610 }1611 set1612 {1613 if ((this._DateCalculated != value))1614 {1615 this.OnDateCalculatedChanging(value);1616 this.SendPropertyChanging();1617 this._DateCalculated = value;1618 this.SendPropertyChanged("DateCalculated");1619 this.OnDateCalculatedChanged();1620 }1621 }1622 }1623 1624 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DateFinished", DbType="DateTime")]1625 public System.Nullable<System.DateTime> DateFinished1626 {1627 get1628 {1629 return this._DateFinished;1630 }1631 set1632 {1633 if ((this._DateFinished != value))1634 {1635 this.OnDateFinishedChanging(value);1636 this.SendPropertyChanging();1637 this._DateFinished = value;1638 this.SendPropertyChanged("DateFinished");1639 this.OnDateFinishedChanged();1640 }1641 }1642 }1643 1644 1518 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Priority", DbType="Int NOT NULL")] 1645 1519 public int Priority … … 1662 1536 } 1663 1537 1664 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="UniqueIdentifier")]1665 public System.Nullable<System.Guid> ProjectId1666 {1667 get1668 {1669 return this._ProjectId;1670 }1671 set1672 {1673 if ((this._ProjectId != value))1674 {1675 this.OnProjectIdChanging(value);1676 this.SendPropertyChanging();1677 this._ProjectId = value;1678 this.SendPropertyChanged("ProjectId");1679 this.OnProjectIdChanged();1680 }1681 }1682 }1683 1684 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserId", DbType="UniqueIdentifier")]1685 public System.Guid UserId1686 {1687 get1688 {1689 return this._UserId;1690 }1691 set1692 {1693 if ((this._UserId != value))1694 {1695 this.OnUserIdChanging(value);1696 this.SendPropertyChanging();1697 this._UserId = value;1698 this.SendPropertyChanged("UserId");1699 this.OnUserIdChanged();1700 }1701 }1702 }1703 1704 1538 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CoresNeeded", DbType="Int NOT NULL")] 1705 1539 public int CoresNeeded … … 1762 1596 } 1763 1597 1598 [global::System.Data.Linq.Mapping.ColumnAttribute(Name="JobState", Storage="_State", DbType="VarChar(30)", CanBeNull=false)] 1599 public global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState State 1600 { 1601 get 1602 { 1603 return this._State; 1604 } 1605 set 1606 { 1607 if ((this._State != value)) 1608 { 1609 this.OnStateChanging(value); 1610 this.SendPropertyChanging(); 1611 this._State = value; 1612 this.SendPropertyChanged("State"); 1613 this.OnStateChanged(); 1614 } 1615 } 1616 } 1617 1764 1618 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_AssignedResource", Storage="_AssignedResources", ThisKey="JobId", OtherKey="JobId")] 1765 1619 public EntitySet<AssignedResource> AssignedResources … … 1830 1684 } 1831 1685 1686 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_StateLog", Storage="_StateLogs", ThisKey="JobId", OtherKey="JobId")] 1687 public EntitySet<StateLog> StateLogs 1688 { 1689 get 1690 { 1691 return this._StateLogs; 1692 } 1693 set 1694 { 1695 this._StateLogs.Assign(value); 1696 } 1697 } 1698 1832 1699 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_Job", Storage="_Job1", ThisKey="ParentJobId", OtherKey="JobId", IsForeignKey=true)] 1833 1700 public Job ParentJob … … 1864 1731 } 1865 1732 1866 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Slave_Job", Storage="_Slave", ThisKey="SlaveId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="SET NULL")]1867 public Slave Slave1868 {1869 get1870 {1871 return this._Slave.Entity;1872 }1873 set1874 {1875 Slave previousValue = this._Slave.Entity;1876 if (((previousValue != value)1877 || (this._Slave.HasLoadedOrAssignedValue == false)))1878 {1879 this.SendPropertyChanging();1880 if ((previousValue != null))1881 {1882 this._Slave.Entity = null;1883 previousValue.Jobs.Remove(this);1884 }1885 this._Slave.Entity = value;1886 if ((value != null))1887 {1888 value.Jobs.Add(this);1889 this._ResourceId = value.ResourceId;1890 }1891 else1892 {1893 this._ResourceId = default(Nullable<System.Guid>);1894 }1895 this.SendPropertyChanged("Slave");1896 }1897 }1898 }1899 1900 1733 public event PropertyChangingEventHandler PropertyChanging; 1901 1734 … … 1952 1785 this.SendPropertyChanging(); 1953 1786 entity.ParentJob = null; 1787 } 1788 1789 private void attach_StateLogs(StateLog entity) 1790 { 1791 this.SendPropertyChanging(); 1792 entity.Job = this; 1793 } 1794 1795 private void detach_StateLogs(StateLog entity) 1796 { 1797 this.SendPropertyChanging(); 1798 entity.Job = null; 1954 1799 } 1955 1800 } … … 2222 2067 private System.DateTime _DateCreated; 2223 2068 2069 private System.Nullable<System.DateTime> _LastAccessed; 2070 2071 private bool _IsHiveEngine; 2072 2073 private EntitySet<HiveExperimentPermission> _HiveExperimentPermissions; 2074 2224 2075 private EntityRef<Job> _Job; 2225 2076 … … 2236 2087 partial void OnResourceIdsChanging(string value); 2237 2088 partial void OnResourceIdsChanged(); 2238 partial void On UserIdChanging(System.Guid value);2239 partial void On UserIdChanged();2089 partial void OnOwnerUserIdChanging(System.Guid value); 2090 partial void OnOwnerUserIdChanged(); 2240 2091 partial void OnRootJobIdChanging(System.Guid value); 2241 2092 partial void OnRootJobIdChanged(); 2242 2093 partial void OnDateCreatedChanging(System.DateTime value); 2243 2094 partial void OnDateCreatedChanged(); 2095 partial void OnLastAccessedChanging(System.Nullable<System.DateTime> value); 2096 partial void OnLastAccessedChanged(); 2097 partial void OnIsHiveEngineChanging(bool value); 2098 partial void OnIsHiveEngineChanged(); 2244 2099 #endregion 2245 2100 2246 2101 public HiveExperiment() 2247 2102 { 2103 this._HiveExperimentPermissions = new EntitySet<HiveExperimentPermission>(new Action<HiveExperimentPermission>(this.attach_HiveExperimentPermissions), new Action<HiveExperimentPermission>(this.detach_HiveExperimentPermissions)); 2248 2104 this._Job = default(EntityRef<Job>); 2249 2105 OnCreated(); … … 2331 2187 2332 2188 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserId", DbType="UniqueIdentifier")] 2333 public System.Guid UserId2189 public System.Guid OwnerUserId 2334 2190 { 2335 2191 get … … 2341 2197 if ((this._UserId != value)) 2342 2198 { 2343 this.On UserIdChanging(value);2199 this.OnOwnerUserIdChanging(value); 2344 2200 this.SendPropertyChanging(); 2345 2201 this._UserId = value; 2346 this.SendPropertyChanged(" UserId");2347 this.On UserIdChanged();2202 this.SendPropertyChanged("OwnerUserId"); 2203 this.OnOwnerUserIdChanged(); 2348 2204 } 2349 2205 } … … 2394 2250 } 2395 2251 2252 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_LastAccessed", DbType="DateTime")] 2253 public System.Nullable<System.DateTime> LastAccessed 2254 { 2255 get 2256 { 2257 return this._LastAccessed; 2258 } 2259 set 2260 { 2261 if ((this._LastAccessed != value)) 2262 { 2263 this.OnLastAccessedChanging(value); 2264 this.SendPropertyChanging(); 2265 this._LastAccessed = value; 2266 this.SendPropertyChanged("LastAccessed"); 2267 this.OnLastAccessedChanged(); 2268 } 2269 } 2270 } 2271 2272 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsHiveEngine", DbType="Bit")] 2273 public bool IsHiveEngine 2274 { 2275 get 2276 { 2277 return this._IsHiveEngine; 2278 } 2279 set 2280 { 2281 if ((this._IsHiveEngine != value)) 2282 { 2283 this.OnIsHiveEngineChanging(value); 2284 this.SendPropertyChanging(); 2285 this._IsHiveEngine = value; 2286 this.SendPropertyChanged("IsHiveEngine"); 2287 this.OnIsHiveEngineChanged(); 2288 } 2289 } 2290 } 2291 2292 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="HiveExperiment_HiveExperimentPermission", Storage="_HiveExperimentPermissions", ThisKey="HiveExperimentId", OtherKey="HiveExperimentId")] 2293 public EntitySet<HiveExperimentPermission> HiveExperimentPermissions 2294 { 2295 get 2296 { 2297 return this._HiveExperimentPermissions; 2298 } 2299 set 2300 { 2301 this._HiveExperimentPermissions.Assign(value); 2302 } 2303 } 2304 2396 2305 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_HiveExperiment", Storage="_Job", ThisKey="RootJobId", OtherKey="JobId", IsForeignKey=true, DeleteRule="CASCADE")] 2397 2306 public Job RootJob … … 2431 2340 } 2432 2341 } 2342 2343 private void attach_HiveExperimentPermissions(HiveExperimentPermission entity) 2344 { 2345 this.SendPropertyChanging(); 2346 entity.HiveExperiment = this; 2347 } 2348 2349 private void detach_HiveExperimentPermissions(HiveExperimentPermission entity) 2350 { 2351 this.SendPropertyChanging(); 2352 entity.HiveExperiment = null; 2353 } 2433 2354 } 2434 2355 2435 [global::System.Data.Linq.Mapping.TableAttribute(Name=" ")]2356 [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.JobData")] 2436 2357 public partial class JobData : INotifyPropertyChanging, INotifyPropertyChanged 2437 2358 { … … 2584 2505 } 2585 2506 2586 [global::System.Data.Linq.Mapping.TableAttribute(Name=" ")]2507 [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.PluginData")] 2587 2508 public partial class PluginData : INotifyPropertyChanging, INotifyPropertyChanged 2588 2509 { … … 2758 2679 } 2759 2680 } 2681 2682 [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.StateLog")] 2683 public partial class StateLog : INotifyPropertyChanging, INotifyPropertyChanged 2684 { 2685 2686 private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); 2687 2688 private System.Guid _StateLogId; 2689 2690 private global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState _State; 2691 2692 private System.DateTime _DateTime; 2693 2694 private System.Guid _JobId; 2695 2696 private System.Nullable<System.Guid> _UserId; 2697 2698 private System.Nullable<System.Guid> _SlaveId; 2699 2700 private string _Exception; 2701 2702 private EntityRef<Job> _Job; 2703 2704 private EntityRef<Resource> _Resource; 2705 2706 #region Extensibility Method Definitions 2707 partial void OnLoaded(); 2708 partial void OnValidate(System.Data.Linq.ChangeAction action); 2709 partial void OnCreated(); 2710 partial void OnStateLogIdChanging(System.Guid value); 2711 partial void OnStateLogIdChanged(); 2712 partial void OnStateChanging(global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState value); 2713 partial void OnStateChanged(); 2714 partial void OnDateTimeChanging(System.DateTime value); 2715 partial void OnDateTimeChanged(); 2716 partial void OnJobIdChanging(System.Guid value); 2717 partial void OnJobIdChanged(); 2718 partial void OnUserIdChanging(System.Nullable<System.Guid> value); 2719 partial void OnUserIdChanged(); 2720 partial void OnSlaveIdChanging(System.Nullable<System.Guid> value); 2721 partial void OnSlaveIdChanged(); 2722 partial void OnExceptionChanging(string value); 2723 partial void OnExceptionChanged(); 2724 #endregion 2725 2726 public StateLog() 2727 { 2728 this._Job = default(EntityRef<Job>); 2729 this._Resource = default(EntityRef<Resource>); 2730 OnCreated(); 2731 } 2732 2733 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StateLogId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)] 2734 public System.Guid StateLogId 2735 { 2736 get 2737 { 2738 return this._StateLogId; 2739 } 2740 set 2741 { 2742 if ((this._StateLogId != value)) 2743 { 2744 this.OnStateLogIdChanging(value); 2745 this.SendPropertyChanging(); 2746 this._StateLogId = value; 2747 this.SendPropertyChanged("StateLogId"); 2748 this.OnStateLogIdChanged(); 2749 } 2750 } 2751 } 2752 2753 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_State", DbType="VarChar(30) NOT NULL", CanBeNull=false)] 2754 public global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState State 2755 { 2756 get 2757 { 2758 return this._State; 2759 } 2760 set 2761 { 2762 if ((this._State != value)) 2763 { 2764 this.OnStateChanging(value); 2765 this.SendPropertyChanging(); 2766 this._State = value; 2767 this.SendPropertyChanged("State"); 2768 this.OnStateChanged(); 2769 } 2770 } 2771 } 2772 2773 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DateTime", DbType="DateTime NOT NULL")] 2774 public System.DateTime DateTime 2775 { 2776 get 2777 { 2778 return this._DateTime; 2779 } 2780 set 2781 { 2782 if ((this._DateTime != value)) 2783 { 2784 this.OnDateTimeChanging(value); 2785 this.SendPropertyChanging(); 2786 this._DateTime = value; 2787 this.SendPropertyChanged("DateTime"); 2788 this.OnDateTimeChanged(); 2789 } 2790 } 2791 } 2792 2793 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_JobId", DbType="UniqueIdentifier NOT NULL")] 2794 public System.Guid JobId 2795 { 2796 get 2797 { 2798 return this._JobId; 2799 } 2800 set 2801 { 2802 if ((this._JobId != value)) 2803 { 2804 if (this._Job.HasLoadedOrAssignedValue) 2805 { 2806 throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); 2807 } 2808 this.OnJobIdChanging(value); 2809 this.SendPropertyChanging(); 2810 this._JobId = value; 2811 this.SendPropertyChanged("JobId"); 2812 this.OnJobIdChanged(); 2813 } 2814 } 2815 } 2816 2817 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserId", DbType="UniqueIdentifier")] 2818 public System.Nullable<System.Guid> UserId 2819 { 2820 get 2821 { 2822 return this._UserId; 2823 } 2824 set 2825 { 2826 if ((this._UserId != value)) 2827 { 2828 this.OnUserIdChanging(value); 2829 this.SendPropertyChanging(); 2830 this._UserId = value; 2831 this.SendPropertyChanged("UserId"); 2832 this.OnUserIdChanged(); 2833 } 2834 } 2835 } 2836 2837 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SlaveId", DbType="UniqueIdentifier")] 2838 public System.Nullable<System.Guid> SlaveId 2839 { 2840 get 2841 { 2842 return this._SlaveId; 2843 } 2844 set 2845 { 2846 if ((this._SlaveId != value)) 2847 { 2848 if (this._Resource.HasLoadedOrAssignedValue) 2849 { 2850 throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); 2851 } 2852 this.OnSlaveIdChanging(value); 2853 this.SendPropertyChanging(); 2854 this._SlaveId = value; 2855 this.SendPropertyChanged("SlaveId"); 2856 this.OnSlaveIdChanged(); 2857 } 2858 } 2859 } 2860 2861 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Exception", DbType="VarChar(MAX)", CanBeNull=false)] 2862 public string Exception 2863 { 2864 get 2865 { 2866 return this._Exception; 2867 } 2868 set 2869 { 2870 if ((this._Exception != value)) 2871 { 2872 this.OnExceptionChanging(value); 2873 this.SendPropertyChanging(); 2874 this._Exception = value; 2875 this.SendPropertyChanged("Exception"); 2876 this.OnExceptionChanged(); 2877 } 2878 } 2879 } 2880 2881 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_StateLog", Storage="_Job", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true)] 2882 public Job Job 2883 { 2884 get 2885 { 2886 return this._Job.Entity; 2887 } 2888 set 2889 { 2890 Job previousValue = this._Job.Entity; 2891 if (((previousValue != value) 2892 || (this._Job.HasLoadedOrAssignedValue == false))) 2893 { 2894 this.SendPropertyChanging(); 2895 if ((previousValue != null)) 2896 { 2897 this._Job.Entity = null; 2898 previousValue.StateLogs.Remove(this); 2899 } 2900 this._Job.Entity = value; 2901 if ((value != null)) 2902 { 2903 value.StateLogs.Add(this); 2904 this._JobId = value.JobId; 2905 } 2906 else 2907 { 2908 this._JobId = default(System.Guid); 2909 } 2910 this.SendPropertyChanged("Job"); 2911 } 2912 } 2913 } 2914 2915 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_StateLog", Storage="_Resource", ThisKey="SlaveId", OtherKey="ResourceId", IsForeignKey=true)] 2916 public Resource Resource 2917 { 2918 get 2919 { 2920 return this._Resource.Entity; 2921 } 2922 set 2923 { 2924 Resource previousValue = this._Resource.Entity; 2925 if (((previousValue != value) 2926 || (this._Resource.HasLoadedOrAssignedValue == false))) 2927 { 2928 this.SendPropertyChanging(); 2929 if ((previousValue != null)) 2930 { 2931 this._Resource.Entity = null; 2932 previousValue.StateLogs.Remove(this); 2933 } 2934 this._Resource.Entity = value; 2935 if ((value != null)) 2936 { 2937 value.StateLogs.Add(this); 2938 this._SlaveId = value.ResourceId; 2939 } 2940 else 2941 { 2942 this._SlaveId = default(Nullable<System.Guid>); 2943 } 2944 this.SendPropertyChanged("Resource"); 2945 } 2946 } 2947 } 2948 2949 public event PropertyChangingEventHandler PropertyChanging; 2950 2951 public event PropertyChangedEventHandler PropertyChanged; 2952 2953 protected virtual void SendPropertyChanging() 2954 { 2955 if ((this.PropertyChanging != null)) 2956 { 2957 this.PropertyChanging(this, emptyChangingEventArgs); 2958 } 2959 } 2960 2961 protected virtual void SendPropertyChanged(String propertyName) 2962 { 2963 if ((this.PropertyChanged != null)) 2964 { 2965 this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); 2966 } 2967 } 2968 } 2969 2970 [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.HiveExperimentPermission")] 2971 public partial class HiveExperimentPermission : INotifyPropertyChanging, INotifyPropertyChanged 2972 { 2973 2974 private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); 2975 2976 private System.Guid _HiveExperimentId; 2977 2978 private System.Guid _GrantedUserId; 2979 2980 private System.Guid _GrantedByUserId; 2981 2982 private global::HeuristicLab.Services.Hive.Common.DataTransfer.Permission _Permission; 2983 2984 private EntityRef<HiveExperiment> _HiveExperiment; 2985 2986 #region Extensibility Method Definitions 2987 partial void OnLoaded(); 2988 partial void OnValidate(System.Data.Linq.ChangeAction action); 2989 partial void OnCreated(); 2990 partial void OnHiveExperimentIdChanging(System.Guid value); 2991 partial void OnHiveExperimentIdChanged(); 2992 partial void OnGrantedUserIdChanging(System.Guid value); 2993 partial void OnGrantedUserIdChanged(); 2994 partial void OnGrantedByUserIdChanging(System.Guid value); 2995 partial void OnGrantedByUserIdChanged(); 2996 partial void OnPermissionChanging(global::HeuristicLab.Services.Hive.Common.DataTransfer.Permission value); 2997 partial void OnPermissionChanged(); 2998 #endregion 2999 3000 public HiveExperimentPermission() 3001 { 3002 this._HiveExperiment = default(EntityRef<HiveExperiment>); 3003 OnCreated(); 3004 } 3005 3006 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_HiveExperimentId", DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)] 3007 public System.Guid HiveExperimentId 3008 { 3009 get 3010 { 3011 return this._HiveExperimentId; 3012 } 3013 set 3014 { 3015 if ((this._HiveExperimentId != value)) 3016 { 3017 if (this._HiveExperiment.HasLoadedOrAssignedValue) 3018 { 3019 throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); 3020 } 3021 this.OnHiveExperimentIdChanging(value); 3022 this.SendPropertyChanging(); 3023 this._HiveExperimentId = value; 3024 this.SendPropertyChanged("HiveExperimentId"); 3025 this.OnHiveExperimentIdChanged(); 3026 } 3027 } 3028 } 3029 3030 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_GrantedUserId", DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)] 3031 public System.Guid GrantedUserId 3032 { 3033 get 3034 { 3035 return this._GrantedUserId; 3036 } 3037 set 3038 { 3039 if ((this._GrantedUserId != value)) 3040 { 3041 this.OnGrantedUserIdChanging(value); 3042 this.SendPropertyChanging(); 3043 this._GrantedUserId = value; 3044 this.SendPropertyChanged("GrantedUserId"); 3045 this.OnGrantedUserIdChanged(); 3046 } 3047 } 3048 } 3049 3050 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_GrantedByUserId", DbType="UniqueIdentifier NOT NULL")] 3051 public System.Guid GrantedByUserId 3052 { 3053 get 3054 { 3055 return this._GrantedByUserId; 3056 } 3057 set 3058 { 3059 if ((this._GrantedByUserId != value)) 3060 { 3061 this.OnGrantedByUserIdChanging(value); 3062 this.SendPropertyChanging(); 3063 this._GrantedByUserId = value; 3064 this.SendPropertyChanged("GrantedByUserId"); 3065 this.OnGrantedByUserIdChanged(); 3066 } 3067 } 3068 } 3069 3070 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Permission", DbType="VarChar(15) NOT NULL", CanBeNull=false)] 3071 public global::HeuristicLab.Services.Hive.Common.DataTransfer.Permission Permission 3072 { 3073 get 3074 { 3075 return this._Permission; 3076 } 3077 set 3078 { 3079 if ((this._Permission != value)) 3080 { 3081 this.OnPermissionChanging(value); 3082 this.SendPropertyChanging(); 3083 this._Permission = value; 3084 this.SendPropertyChanged("Permission"); 3085 this.OnPermissionChanged(); 3086 } 3087 } 3088 } 3089 3090 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="HiveExperiment_HiveExperimentPermission", Storage="_HiveExperiment", ThisKey="HiveExperimentId", OtherKey="HiveExperimentId", IsForeignKey=true)] 3091 public HiveExperiment HiveExperiment 3092 { 3093 get 3094 { 3095 return this._HiveExperiment.Entity; 3096 } 3097 set 3098 { 3099 HiveExperiment previousValue = this._HiveExperiment.Entity; 3100 if (((previousValue != value) 3101 || (this._HiveExperiment.HasLoadedOrAssignedValue == false))) 3102 { 3103 this.SendPropertyChanging(); 3104 if ((previousValue != null)) 3105 { 3106 this._HiveExperiment.Entity = null; 3107 previousValue.HiveExperimentPermissions.Remove(this); 3108 } 3109 this._HiveExperiment.Entity = value; 3110 if ((value != null)) 3111 { 3112 value.HiveExperimentPermissions.Add(this); 3113 this._HiveExperimentId = value.HiveExperimentId; 3114 } 3115 else 3116 { 3117 this._HiveExperimentId = default(System.Guid); 3118 } 3119 this.SendPropertyChanged("HiveExperiment"); 3120 } 3121 } 3122 } 3123 3124 public event PropertyChangingEventHandler PropertyChanging; 3125 3126 public event PropertyChangedEventHandler PropertyChanged; 3127 3128 protected virtual void SendPropertyChanging() 3129 { 3130 if ((this.PropertyChanging != null)) 3131 { 3132 this.PropertyChanging(this, emptyChangingEventArgs); 3133 } 3134 } 3135 3136 protected virtual void SendPropertyChanged(String propertyName) 3137 { 3138 if ((this.PropertyChanged != null)) 3139 { 3140 this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); 3141 } 3142 } 3143 } 2760 3144 } 2761 3145 #pragma warning restore 1591 -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Interfaces/IHiveDao.cs ¶
r5404 r5511 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Linq;4 using System.Text;5 3 using System.Linq.Expressions; 6 4 7 5 namespace HeuristicLab.Services.Hive.DataAccess { 6 using HeuristicLab.Services.Hive.Common.DataTransfer; 8 7 using DT = HeuristicLab.Services.Hive.Common.DataTransfer; 9 8 … … 32 31 void UpdateHiveExperiment(DT.HiveExperiment dto); 33 32 void DeleteHiveExperiment(Guid id); 33 #endregion 34 35 #region HiveExperimentPermission Methods 36 DT.HiveExperimentPermission GetHiveExperimentPermission(Guid hiveExperimentId, Guid grantedUserId); 37 IEnumerable<DT.HiveExperimentPermission> GetHiveExperimentPermissions(Expression<Func<HiveExperimentPermission, bool>> predicate); 38 void AddHiveExperimentPermission(DT.HiveExperimentPermission dto); 39 void UpdateHiveExperimentPermission(DT.HiveExperimentPermission dto); 40 void DeleteHiveExperimentPermission(Guid hiveExperimentId, Guid grantedUserId); 34 41 #endregion 35 42 … … 80 87 81 88 #region Authorization Methods 82 bool IsUserAuthorizedForJobs(Guid userId, params Guid[] jobIds); 89 Permission GetPermissionForJob(Guid jobId, Guid userId); 90 Permission GetPermissionForExperiment(Guid experimentId, Guid userId); 91 Guid GetExperimentForJob(Guid jobId); 83 92 #endregion 84 93 } -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/CreateHiveDatabaseApplication.cs ¶
r5106 r5511 28 28 class CreateHiveDatabaseApplication : ApplicationBase { 29 29 30 public override void Run() { 30 public override void Run() { 31 31 using (var db = HiveDao.CreateContext()) { 32 32 if (db.DatabaseExists()) -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/prepareHiveDatabase.sql ¶
r5404 r5511 40 40 ALTER TABLE dbo.Job ALTER COLUMN JobId ADD ROWGUIDCOL; 41 41 ALTER TABLE dbo.Job WITH NOCHECK ADD CONSTRAINT [DF_Job_JobId] DEFAULT (newid()) FOR JobId; 42 GO 42 43 43 --ALTER TABLE [dbo].[Job] DROP CONSTRAINT [Slave_Job]44 --ALTER TABLE [dbo].[Job] WITH CHECK ADD CONSTRAINT [Slave_Job] FOREIGN KEY([ResourceId])45 --REFERENCES [dbo].[Resource] ([ResourceId])46 --ON UPDATE CASCADE47 --ON DELETE SET NULL 48 --GO44 ALTER TABLE [dbo].[StateLog] DROP CONSTRAINT [Job_StateLog] 45 ALTER TABLE [dbo].[StateLog] WITH CHECK ADD CONSTRAINT [Job_StateLog] FOREIGN KEY([JobId]) 46 REFERENCES [dbo].[Job] ([JobId]) 47 ON UPDATE CASCADE 48 ON DELETE CASCADE 49 GO 49 50 50 51 ALTER TABLE dbo.Plugin ALTER COLUMN PluginId ADD ROWGUIDCOL; … … 79 80 ALTER TABLE dbo.HiveExperiment ALTER COLUMN HiveExperimentId ADD ROWGUIDCOL; 80 81 ALTER TABLE dbo.HiveExperiment WITH NOCHECK ADD CONSTRAINT [DF_HiveExperiment_HiveExperimentId] DEFAULT (newid()) FOR HiveExperimentId; 82 83 ALTER TABLE dbo.StateLog ALTER COLUMN StateLogId ADD ROWGUIDCOL; 84 ALTER TABLE dbo.StateLog WITH NOCHECK ADD CONSTRAINT [DF_StateLog_StateLogId] DEFAULT (newid()) FOR StateLogId; 85 86 ALTER TABLE [dbo].[HiveExperimentPermission] DROP CONSTRAINT [HiveExperiment_HiveExperimentPermission] 87 ALTER TABLE [dbo].[HiveExperimentPermission] WITH CHECK ADD CONSTRAINT [HiveExperiment_HiveExperimentPermission] FOREIGN KEY([HiveExperimentId]) 88 REFERENCES [dbo].[HiveExperiment] ([HiveExperimentId]) 89 ON UPDATE CASCADE 90 ON DELETE CASCADE 91 GO 81 92 82 93 /* create indices */ -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/DaoTests.cs ¶
r5405 r5511 1 1 using System; 2 using System.Text;3 using System.Collections.Generic;4 2 using System.Linq; 5 using Microsoft.VisualStudio.TestTools.UnitTesting;6 3 using HeuristicLab.Services.Hive.Common.DataTransfer; 7 4 using HeuristicLab.Services.Hive.Common.ServiceContracts; 8 using HeuristicLab.Clients.Hive.Slave.Tests;9 using HeuristicLab.Clients.Hive;10 5 using HeuristicLab.Services.Hive.DataAccess; 6 using Microsoft.VisualStudio.TestTools.UnitTesting; 11 7 12 8 namespace HeuristicLab.Services.Hive.Tests { 13 using DA = HeuristicLab.Services.Hive.DataAccess;14 9 using DT = HeuristicLab.Services.Hive.Common.DataTransfer; 15 10 … … 32 27 33 28 DT.Job job1 = new DT.Job(); 34 job1. DateCreated = DateTime.Now;29 job1.SetState(JobState.Offline, Guid.NewGuid()); 35 30 36 31 DT.Plugin plugin1 = new DT.Plugin(); … … 57 52 Assert.AreEqual(job1.Id, job1loaded.Id); 58 53 Assert.AreEqual(job1.CoresNeeded, job1loaded.CoresNeeded); 59 Assert.AreEqual(null, job1loaded.DateCalculated);60 54 Assert.AreEqual(job1.DateCreated.ToString(), job1loaded.DateCreated.ToString()); 61 55 Assert.AreEqual(null, job1loaded.DateFinished); 62 56 Assert.IsTrue(job1.PluginsNeededIds.SequenceEqual(job1loaded.PluginsNeededIds)); 63 57 Assert.AreEqual(job1.StateLog.Count, job1loaded.StateLog.Count); 58 for (int i = 0; i < job1.StateLog.Count; i++) { 59 Assert.AreEqual(job1.Id, job1loaded.StateLog[i].JobId); 60 Assert.AreEqual(job1.StateLog[i].State, job1loaded.StateLog[i].State); 61 Assert.AreEqual(job1.StateLog[i].SlaveId, job1loaded.StateLog[i].SlaveId); 62 Assert.AreEqual(job1.StateLog[i].UserId, job1loaded.StateLog[i].UserId); 63 Assert.AreEqual(job1.StateLog[i].Exception, job1loaded.StateLog[i].Exception); 64 Assert.IsTrue(Math.Abs((job1.StateLog[i].DateTime - job1loaded.StateLog[i].DateTime).TotalSeconds) < 1); 65 } 66 64 67 dao.DeleteJob(job1.Id); 65 68 … … 96 99 dao.DeleteSlave(slave.Id); 97 100 dao.DeleteSlaveGroup(slaveGroup.Id); 98 }99 100 [TestMethod]101 public void TestJobDaoWaiting() {102 IHiveDao dao = ServiceLocator.Instance.HiveDao;103 104 DT.Job job = new DT.Job();105 job.DateCreated = DateTime.Now;106 job.JobState = JobState.Waiting;107 job.Id = dao.AddJob(job);108 109 // todo110 101 } 111 102 … … 152 143 } 153 144 145 [TestMethod] 146 public void TestHiveExperimentDao() { 147 IHiveDao dao = ServiceLocator.Instance.HiveDao; 148 149 DT.HiveExperiment he = new DT.HiveExperiment(); 150 151 DT.Job job = new DT.Job(); 152 job.SetState(JobState.Offline, Guid.NewGuid()); 153 job.Id = dao.AddJob(job); 154 155 he.RootJobId = job.Id; 156 he.DateCreated = DateTime.Now; 157 he.Name = "TestExperiment"; 158 he.OwnerUserId = Guid.NewGuid(); 159 he.ResourceNames = "HEAL"; 160 161 he.Id = dao.AddHiveExperiment(he); 162 163 DT.HiveExperimentPermission perm = new DT.HiveExperimentPermission(); 164 perm.HiveExperimentId = he.Id; 165 perm.GrantedByUserId = he.OwnerUserId; 166 perm.GrantedUserId = Guid.NewGuid(); 167 perm.Permission = Permission.Write; 168 dao.AddHiveExperimentPermission(perm); 169 170 DT.HiveExperiment heLoaded = dao.GetHiveExperiment(he.Id); 171 Assert.AreEqual(he.Id, heLoaded.Id); 172 Assert.AreEqual(he.Name, heLoaded.Name); 173 Assert.AreEqual(he.ResourceNames, heLoaded.ResourceNames); 174 Assert.AreEqual(he.RootJobId, heLoaded.RootJobId); 175 //Assert.AreEqual(he.LastAccessed, heLoaded.LastAccessed); 176 //Assert.AreEqual(he.DateCreated, heLoaded.DateCreated); 177 178 DT.Job jobLoaded = dao.GetJob(he.RootJobId); 179 Assert.AreEqual(job.Id, jobLoaded.Id); 180 Assert.AreEqual(job.State, jobLoaded.State); 181 182 DT.HiveExperimentPermission permLoaded = dao.GetHiveExperimentPermission(he.Id, perm.GrantedUserId); 183 Assert.AreEqual(perm.HiveExperimentId, permLoaded.HiveExperimentId); 184 Assert.AreEqual(perm.GrantedUserId, permLoaded.GrantedUserId); 185 Assert.AreEqual(perm.GrantedByUserId, permLoaded.GrantedByUserId); 186 Assert.AreEqual(perm.Permission, permLoaded.Permission); 187 188 dao.DeleteHiveExperiment(he.Id); 189 Assert.AreEqual(null, dao.GetHiveExperiment(he.Id)); 190 Assert.AreEqual(null, dao.GetJob(he.RootJobId)); 191 Assert.AreEqual(null, dao.GetHiveExperimentPermission(perm.HiveExperimentId, perm.GrantedUserId)); 192 193 } 154 194 } 155 195 } -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/ServiceTests.cs ¶
r5404 r5511 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using System.Threading; 25 26 using HeuristicLab.Clients.Hive; 26 27 using HeuristicLab.Clients.Hive.Slave.Tests; 28 using HeuristicLab.Hive; 29 using HeuristicLab.Services.Hive.Common; 27 30 using HeuristicLab.Services.Hive.Common.DataTransfer; 28 31 using HeuristicLab.Services.Hive.Common.ServiceContracts; 29 32 using Microsoft.VisualStudio.TestTools.UnitTesting; 30 using System.Threading;31 using HeuristicLab.Hive;32 using HeuristicLab.Services.Hive.Common;33 33 34 34 namespace HeuristicLab.Services.Hive.Tests { 35 35 36 using System.Diagnostics; 36 37 using DT = HeuristicLab.Services.Hive.Common.DataTransfer; 37 using System.Diagnostics;38 38 39 39 [TestClass] … … 54 54 var service = GetLocalService(); 55 55 56 // create hive experiment 56 57 DT.HiveExperiment experiment = new DT.HiveExperiment() { 57 58 Name = "TestExperiment", … … 59 60 }; 60 61 62 // create job 61 63 DT.Job job = new DT.Job() { 62 64 CoresNeeded = 1, … … 64 66 Priority = 0 65 67 }; 68 job.SetState(JobState.Offline); 66 69 67 70 DT.JobData jobData = new DT.JobData() { 68 Data = PersistenceUtil.Serialize(new MockJob(500, true)) 71 //Data = PersistenceUtil.Serialize(new MockJob(500, true)) 72 Data = new byte[10000000] 69 73 }; 70 74 75 // create plugin 71 76 DT.Plugin plugin1 = new DT.Plugin(); 72 77 plugin1.Name = "Tests.MyPlugin"; … … 77 82 78 83 DT.PluginData pluginData1 = new DT.PluginData(); 79 pluginData1.PluginId = plugin1.Id;80 84 pluginData1.FileName = "Tests.MyPlugin-1.0.dll"; 81 85 pluginData1.Data = new byte[] { 0, 1, 2, 3, 4, 5 }; 82 86 87 plugin1.Id = service.AddPlugin(plugin1, new List<PluginData> { pluginData1 }); 88 pluginData1.PluginId = plugin1.Id; 89 90 // add plugin 83 91 job.PluginsNeededIds.Add(plugin1.Id); 84 92 85 job.Id = service.AddJob(job, jobData, null); 93 // create slave 94 DT.Slave slave = new Slave(); 95 slave.Id = Guid.NewGuid(); 96 slave.Name = "TestSlave"; 97 slave.Memory = 1024; 98 slave.Cores = 4; 99 slave.CpuSpeed = 2800; 100 slave.OperatingSystem = "Windows 3.11"; 101 slave.CpuArchitecture = CpuArchitecture.x64; 102 103 // add slave 104 service.AddSlave(slave); 105 106 // add job 107 job.Id = service.AddJob(job, jobData, new List<Guid> { slave.Id }); 86 108 experiment.RootJobId = job.Id; 87 109 110 // add hive experiment 111 experiment.Id = service.AddHiveExperiment(experiment); 112 113 // test job 88 114 DT.Job jobLoaded = service.GetJob(job.Id); 89 115 Assert.AreEqual(job.Id, jobLoaded.Id); … … 91 117 Assert.AreEqual(job.MemoryNeeded, jobLoaded.MemoryNeeded); 92 118 Assert.AreEqual(job.Priority, jobLoaded.Priority); 93 Assert.AreEqual(JobState.Waiting, jobLoaded.JobState); 94 Assert.AreEqual(ServiceLocator.Instance.AuthorizationManager.UserId, job.UserId); 119 Assert.AreEqual(JobState.Waiting, jobLoaded.State); 95 120 Assert.IsTrue(job.PluginsNeededIds.SequenceEqual(jobLoaded.PluginsNeededIds)); 96 121 97 122 DT.JobData jobDataLoaded = service.GetJobData(job.Id); 98 123 Assert.AreEqual(job.Id, jobDataLoaded.JobId); 99 124 Assert.IsTrue(jobData.Data.SequenceEqual(jobDataLoaded.Data)); 100 125 101 experiment.Id = service.AddHiveExperiment(experiment); 102 126 // test hive experiment 103 127 DT.HiveExperiment experimentLoaded = service.GetHiveExperiment(experiment.Id); 104 128 Assert.AreEqual(experiment.Id, experimentLoaded.Id); … … 107 131 Assert.AreEqual(experiment.RootJobId, experimentLoaded.RootJobId); 108 132 133 // test assigned ressources 134 var actions = service.Heartbeat(new Heartbeat() { SlaveId = slave.Id, AssignJob = true, FreeCores = 4, FreeMemory = 1024, JobProgress = new Dictionary<Guid,TimeSpan>() }); 135 Assert.AreEqual(1, actions.Count); 136 Assert.AreEqual(MessageContainer.MessageType.CalculateJob, actions[0].Message); 137 Assert.AreEqual(job.Id, actions[0].JobId); 138 139 jobLoaded = service.GetJob(job.Id); 140 Assert.AreEqual(JobState.Transferring, jobLoaded.State); 141 142 // send progress 143 var progress = new Dictionary<Guid, TimeSpan>(); 144 progress.Add(job.Id, new TimeSpan(1, 5, 10, 20, 30)); 145 actions = service.Heartbeat(new Heartbeat() { SlaveId = slave.Id, AssignJob = true, FreeCores = 3, FreeMemory = 1024, JobProgress = progress }); 146 Assert.AreEqual(0, actions.Count); 147 148 // the job should be in state 'Calculating' now 149 jobLoaded = service.GetJob(job.Id); 150 Assert.AreEqual(JobState.Calculating, jobLoaded.State); 151 Assert.AreEqual(new TimeSpan(1, 5, 10, 20, 30), jobLoaded.ExecutionTime.Value); 152 153 // delete 109 154 service.DeleteHiveExperiment(experiment.Id); 110 155 Assert.AreEqual(null, service.GetHiveExperiment(experiment.Id)); 111 156 Assert.AreEqual(null, service.GetJob(job.Id)); 112 157 Assert.AreEqual(null, service.GetJobData(job.Id)); 158 159 // send another heartbeat with the deleted job; the server should command the abortion of the job 160 actions = service.Heartbeat(new Heartbeat() { SlaveId = slave.Id, AssignJob = true, FreeCores = 3, FreeMemory = 1024, JobProgress = progress }); 161 Assert.AreEqual(1, actions.Count); 162 Assert.AreEqual(MessageContainer.MessageType.AbortJob, actions[0].Message); 163 Assert.AreEqual(job.Id, actions[0].JobId); 164 165 // delete slave 166 service.DeleteSlave(slave.Id); 113 167 } 114 168 … … 185 239 Thread.Sleep(500); 186 240 lightweightJobs = service.GetLightweightJobs(jobs.Select(x => x.Id)); 187 } while (!lightweightJobs.All(x => x. JobState == JobState.Finished));241 } while (!lightweightJobs.All(x => x.State == JobState.Finished)); 188 242 189 243 // delete slaves … … 239 293 IJob deserializedJob = PersistenceUtil.Deserialize<IJob>(jobData.Data); 240 294 deserializedJob.Start(); 241 job. JobState = JobState.Finished;242 jobs.Where(x => x.Id == job.Id).Single(). JobState = JobState.Finished;295 job.SetState(JobState.Finished); 296 jobs.Where(x => x.Id == job.Id).Single().SetState(JobState.Finished); 243 297 jobData.Data = PersistenceUtil.Serialize(deserializedJob); 244 service.UpdateJob (job, jobData);298 service.UpdateJobData(job, jobData); 245 299 Debug.WriteLine("finished calculating"); 246 300 } -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Web/Hive-3.4/App_Code/HiveServerModule.cs ¶
r5405 r5511 28 28 using HeuristicLab.Services.Hive; 29 29 using HeuristicLab.Tracing; 30 using HeuristicLab.Services.Hive.Common; 30 31 31 32 namespace HeuristicLab.Hive.Server.Core.IISModules { 32 33 public class HiveServerModule : IHttpModule { 33 34 34 private static IHiveService hiveService; 35 35 private static ILifecycleManager lifecycleManager; 36 36 37 37 public void Init(HttpApplication context) { 38 if (lifecycleManager == null) 38 if (lifecycleManager == null) { 39 39 lifecycleManager = new LifecycleManager(); 40 lifecycleManager.Start(); 40 lifecycleManager.Start(); 41 LogFactory.GetLogger(this.GetType().Name).Log("Init(): LifecycleManager started"); 42 } 41 43 } 42 44 43 45 public void Dispose() { 44 46 lifecycleManager.Stop(); 47 lifecycleManager = null; 48 LogFactory.GetLogger(this.GetType().Name).Log("Init(): LifecycleManager stopped"); 45 49 } 46 50 } -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/AuthorizationManager.cs ¶
r5264 r5511 21 21 22 22 using System; 23 using System.Linq;24 23 using System.Security; 25 24 using System.Web.Security; … … 35 34 } 36 35 37 public void AuthorizeJobs(params Guid[] jobIds) {38 if (!IsAuthorizedForJobs(jobIds)) {39 throw new SecurityException("User '" + Identity.UserName + "' is not authorized to access job (Id: " + string.Join(", ", jobIds.Select(x => x.ToString()).ToArray()) + ")");40 }41 }36 //public void AuthorizeJobs(params Guid[] jobIds) { 37 // if (!IsAuthorizedForJobs(jobIds)) { 38 // throw new SecurityException("User '" + Identity.UserName + "' is not authorized to access job (Id: " + string.Join(", ", jobIds.Select(x => x.ToString()).ToArray()) + ")"); 39 // } 40 //} 42 41 43 private bool IsAuthorizedForJobs(params Guid[] jobIds) {44 return ServiceLocator.Instance.HiveDao.IsUserAuthorizedForJobs(UserId, jobIds);45 }42 //private bool IsAuthorizedForJobs(params Guid[] jobIds) { 43 // return ServiceLocator.Instance.HiveDao.IsUserAuthorizedForJobs(UserId, jobIds); 44 //} 46 45 47 46 public void Authorize(Guid userId) { -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeartbeatManager.cs ¶
r5405 r5511 2 2 using System.Collections.Generic; 3 3 using System.Linq; 4 using System.Text;5 4 using HeuristicLab.Services.Hive.Common; 6 5 using HeuristicLab.Services.Hive.Common.DataTransfer; … … 54 53 55 54 private void AssignJob(Slave slave, Job job) { 56 job.SlaveId = slave.Id; 57 job.JobState = JobState.Calculating; // Todo: Maybe use State = Transferring (?) 58 job.DateCalculated = DateTime.Now; // Todo: use statelog instead 55 job.SetState(JobState.Transferring, slave.Id, ""); 59 56 dao.UpdateJob(job); 60 57 dao.UpdateSlave(slave); … … 79 76 Logger.Error("Job does not exist in DB: " + jobProgress.Key); 80 77 } else { 81 if (curJob. SlaveId == Guid.Empty || curJob.SlaveId != heartbeat.SlaveId) {78 if (curJob.CurrentStateLog.SlaveId == Guid.Empty || curJob.CurrentStateLog.SlaveId != heartbeat.SlaveId) { 82 79 // assigned slave does not match heartbeat 83 80 actions.Add(new MessageContainer(MessageContainer.MessageType.AbortJob, curJob.Id)); … … 88 85 curJob.LastHeartbeat = DateTime.Now; 89 86 90 if (curJob. JobState == JobState.Aborted) {87 if (curJob.State == JobState.Aborted) { 91 88 // a request to abort the job has been set 92 89 actions.Add(new MessageContainer(MessageContainer.MessageType.AbortJob, curJob.Id)); 90 } else if (curJob.State != JobState.Calculating) { 91 // jobstate was 'Transferring' before, now calculating 92 curJob.SetState(JobState.Calculating, heartbeat.SlaveId, ""); 93 93 } 94 94 dao.UpdateJob(curJob); -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs ¶
r5458 r5511 33 33 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 34 34 //[PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 35 public Guid AddJob(Job job, JobData jobData, IEnumerable<Guid> slaveGroupIds) { 36 using (trans.OpenTransaction()) { 37 job.UserId = auth.UserId; 38 job.DateCreated = DateTime.Now; 39 job.JobState = JobState.Waiting; 35 public Guid AddJob(Job job, JobData jobData, IEnumerable<Guid> resourceIds) { 36 using (trans.OpenTransaction()) { 37 job.SetState(JobState.Waiting, auth.UserId); 40 38 job.Id = dao.AddJob(job); 41 39 jobData.JobId = job.Id; 42 40 jobData.LastUpdate = DateTime.Now; 43 if ( slaveGroupIds != null) {44 foreach (Guid slaveGroupId in slaveGroupIds) {41 if (resourceIds != null) { 42 foreach (Guid slaveGroupId in resourceIds) { 45 43 dao.AssignJobToResource(job.Id, slaveGroupId); 46 44 } … … 80 78 } 81 79 82 public void UpdateJob(Job job, JobData jobData) { 80 public void UpdateJob(Job job) { 81 using (trans.OpenTransaction()) { 82 dao.UpdateJob(job); 83 } 84 } 85 86 public void UpdateJobData(Job job, JobData jobData) { 83 87 using (trans.OpenTransaction()) { 84 88 jobData.LastUpdate = DateTime.Now; … … 122 126 123 127 public HiveExperiment GetHiveExperiment(Guid id) { 124 return dao.GetHiveExperiments(x => x.UserId == auth.UserId && x.HiveExperimentId == id).FirstOrDefault(); 128 return dao.GetHiveExperiments(x => 129 x.HiveExperimentId == id 130 && (x.OwnerUserId == auth.UserId || x.HiveExperimentPermissions.Count(hep => hep.Permission != Permission.NotAllowed && hep.GrantedUserId == auth.UserId) > 0) 131 ).FirstOrDefault(); 125 132 } 126 133 127 134 public IEnumerable<HiveExperiment> GetHiveExperiments() { 128 return dao.GetHiveExperiments(x => x. UserId == auth.UserId);135 return dao.GetHiveExperiments(x => x.OwnerUserId == auth.UserId || x.HiveExperimentPermissions.Count(hep => hep.Permission != Permission.NotAllowed && hep.GrantedUserId == auth.UserId) > 0); 129 136 } 130 137 131 138 public Guid AddHiveExperiment(HiveExperiment hiveExperimentDto) { 132 139 using (trans.OpenTransaction()) { 133 hiveExperimentDto. UserId = auth.UserId;140 hiveExperimentDto.OwnerUserId = auth.UserId; 134 141 hiveExperimentDto.DateCreated = DateTime.Now; 135 142 return dao.AddHiveExperiment(hiveExperimentDto); -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Interfaces/IAuthorizationManager.cs ¶
r5043 r5511 33 33 /// </summary> 34 34 /// <exception cref="SecurityException">thrown when access denied</exception> 35 void AuthorizeJobs(params Guid[] jobId);35 //void AuthorizeJobs(params Guid[] jobId); 36 36 37 37 /// <summary> -
TabularUnified branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/LifecycleManager.cs ¶
r5405 r5511 1 1 using System; 2 using System.Collections.Generic;3 2 using System.Linq; 4 using System.Text; 5 using System.Transactions; 3 using HeuristicLab.Core; 6 4 using HeuristicLab.Services.Hive.Common; 7 5 using HeuristicLab.Services.Hive.Common.DataTransfer; 8 using HeuristicLab.Tracing;9 using HeuristicLab.Core;10 6 11 7 namespace HeuristicLab.Services.Hive { … … 27 23 28 24 // Windows-Forms timer is single threaded, so callbacks will be synchron 29 System.Windows.Forms.Timer timer;25 private System.Windows.Forms.Timer timer; 30 26 31 27 public ExecutionState ExecutionState { … … 40 36 public void Start() { 41 37 if (ExecutionState == Core.ExecutionState.Stopped) { 42 this.timer.Interval = (int)new TimeSpan(0, 0, 10).TotalMilliseconds;38 this.timer.Interval = (int)new TimeSpan(0, 0, 30).TotalMilliseconds; 43 39 this.timer.Start(); 44 40 } … … 71 67 72 68 private void AbortJobs(Guid slaveId) { 73 var jobs = dao.GetJobs(x => x.S lave.ResourceId == slaveId);69 var jobs = dao.GetJobs(x => x.StateLogs.Last().SlaveId == slaveId); 74 70 foreach (var j in jobs) { 75 j.JobState = JobState.Waiting; 71 j.StateLog.Add(new StateLog() { 72 UserId = auth.UserId, 73 State = JobState.Waiting, 74 JobId = j.Id, 75 DateTime = DateTime.Now, 76 Exception = "Slave timed out" 77 }); 76 78 dao.UpdateJob(j); 77 79 }
Note: See TracChangeset
for help on using the changeset viewer.