Changeset 6743
- Timestamp:
- 09/12/11 18:04:25 (11 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources
- Files:
-
- 55 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/Common/UpdateControl.cs
r6734 r6743 40 40 if (imgBoxProgress.InvokeRequired) { 41 41 imgBoxProgress.Invoke(new MethodInvoker(() => imgBoxProgress.Visible = false)); 42 btnRefresh.Invoke(new MethodInvoker(() => btnRefresh.Enabled = true)); 42 43 } else { 43 44 imgBoxProgress.Visible = false; 45 btnRefresh.Enabled = true; 44 46 } 45 47 } … … 49 51 if (imgBoxProgress.InvokeRequired) { 50 52 imgBoxProgress.Invoke(new MethodInvoker(() => imgBoxProgress.Visible = true)); 53 btnRefresh.Invoke(new MethodInvoker(() => btnRefresh.Enabled = false)); 51 54 } else { 52 55 imgBoxProgress.Visible = true; 56 btnRefresh.Enabled = false; 53 57 } 54 58 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.3/Views/RefreshableHiveExperimentView.cs
r6725 r6743 93 93 94 94 private void RegisterHiveJobEvents() { 95 Content.Hive Jobs.ItemsAdded += new CollectionItemsChangedEventHandler<HiveTask>(HiveJobs_ItemsAdded_Removed_Reset);96 Content.Hive Jobs.ItemsRemoved += new CollectionItemsChangedEventHandler<HiveTask>(HiveJobs_ItemsAdded_Removed_Reset);97 Content.Hive Jobs.CollectionReset += new CollectionItemsChangedEventHandler<HiveTask>(HiveJobs_ItemsAdded_Removed_Reset);95 Content.HiveTasks.ItemsAdded += new CollectionItemsChangedEventHandler<HiveTask>(HiveJobs_ItemsAdded_Removed_Reset); 96 Content.HiveTasks.ItemsRemoved += new CollectionItemsChangedEventHandler<HiveTask>(HiveJobs_ItemsAdded_Removed_Reset); 97 Content.HiveTasks.CollectionReset += new CollectionItemsChangedEventHandler<HiveTask>(HiveJobs_ItemsAdded_Removed_Reset); 98 98 } 99 99 private void DeregisterHiveJobEvents() { 100 Content.Hive Jobs.ItemsAdded -= new CollectionItemsChangedEventHandler<HiveTask>(HiveJobs_ItemsAdded_Removed_Reset);101 Content.Hive Jobs.ItemsRemoved -= new CollectionItemsChangedEventHandler<HiveTask>(HiveJobs_ItemsAdded_Removed_Reset);102 Content.Hive Jobs.CollectionReset -= new CollectionItemsChangedEventHandler<HiveTask>(HiveJobs_ItemsAdded_Removed_Reset);100 Content.HiveTasks.ItemsAdded -= new CollectionItemsChangedEventHandler<HiveTask>(HiveJobs_ItemsAdded_Removed_Reset); 101 Content.HiveTasks.ItemsRemoved -= new CollectionItemsChangedEventHandler<HiveTask>(HiveJobs_ItemsAdded_Removed_Reset); 102 Content.HiveTasks.CollectionReset -= new CollectionItemsChangedEventHandler<HiveTask>(HiveJobs_ItemsAdded_Removed_Reset); 103 103 } 104 104 … … 140 140 if (Content != null) { 141 141 bool alreadyUploaded = Content.Id != Guid.Empty; 142 bool jobsLoaded = Content.Hive Jobs != null && Content.HiveJobs.All(x => x.Task.Id != Guid.Empty);142 bool jobsLoaded = Content.HiveTasks != null && Content.HiveTasks.All(x => x.Task.Id != Guid.Empty); 143 143 144 144 this.nameTextBox.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded; … … 229 229 Invoke(new EventHandler(Content_HiveJobChanged), sender, e); 230 230 else { 231 if (Content != null && Content.Hive Jobs != null) {232 jobsTreeView.Content = Content.Hive Jobs;231 if (Content != null && Content.HiveTasks != null) { 232 jobsTreeView.Content = Content.HiveTasks; 233 233 RegisterHiveJobEvents(); 234 234 } else { … … 297 297 #region Control events 298 298 private void startButton_Click(object sender, EventArgs e) { 299 HiveClient.Start Experiment((Exception ex) => ErrorHandling.ShowErrorDialog(this, "Start failed.", ex), Content, new CancellationToken());299 HiveClient.StartJob((Exception ex) => ErrorHandling.ShowErrorDialog(this, "Start failed.", ex), Content, new CancellationToken()); 300 300 } 301 301 private void pauseButton_Click(object sender, EventArgs e) { 302 HiveClient.Pause Experiment(Content);302 HiveClient.PauseJob(Content); 303 303 } 304 304 private void stopButton_Click(object sender, EventArgs e) { 305 HiveClient.Stop Experiment(Content);305 HiveClient.StopJob(Content); 306 306 } 307 307 private void resetButton_Click(object sender, EventArgs e) { } … … 326 326 327 327 private void refreshButton_Click(object sender, EventArgs e) { 328 var invoker = new Action<RefreshableJob>(HiveClient.Load Experiment);328 var invoker = new Action<RefreshableJob>(HiveClient.LoadJob); 329 329 invoker.BeginInvoke(Content, (ar) => { 330 330 try { … … 338 338 339 339 private void refreshPermissionsButton_Click(object sender, EventArgs e) { 340 hiveExperimentPermissionListView.Content = HiveClient.Get HiveExperimentPermissions(this.Content.Job.Id);340 hiveExperimentPermissionListView.Content = HiveClient.GetJobPermissions(this.Content.Job.Id); 341 341 } 342 342 … … 349 349 startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false; 350 350 } else { 351 startButton.Enabled = Content.IsControllable && Content.Hive Jobs != null && Content.HiveJobs.Count > 0 && Content.ExecutionState == ExecutionState.Prepared;351 startButton.Enabled = Content.IsControllable && Content.HiveTasks != null && Content.HiveTasks.Count > 0 && Content.ExecutionState == ExecutionState.Prepared; 352 352 pauseButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started; 353 353 stopButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started; … … 406 406 var optimizer = obj as IOptimizer; 407 407 if (optimizer != null) { 408 Content.Hive Jobs.Add(new OptimizerHiveTask(e.Effect.HasFlag(DragDropEffects.Copy) ? (IOptimizer)optimizer.Clone() : optimizer));408 Content.HiveTasks.Add(new OptimizerHiveTask(e.Effect.HasFlag(DragDropEffects.Copy) ? (IOptimizer)optimizer.Clone() : optimizer)); 409 409 } 410 410 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.App/3.3/HiveSlaveApplication.cs
r6730 r6743 34 34 coreThread.Start(); 35 35 36 SlaveItem item = new SlaveItem();37 36 MainWindow window = new MainWindow(); 38 window. SetContent(item);37 window.Content = new SlaveItem(); 39 38 Application.Run(window); 40 39 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.App/3.3/MainWindow.cs
r6734 r6743 40 40 } 41 41 42 public void SetContent(SlaveItem item) { 43 slaveMainView.Content = item; 42 public SlaveItem Content { 43 get { return slaveMainView.Content; } 44 set { 45 slaveMainView.Content = value; 46 } 44 47 } 45 48 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/JobsView.cs
r6734 r6743 59 59 #region Event Handlers 60 60 void Content_SlaveStatusChanged(object sender, Common.EventArgs<StatusCommons> e) { 61 lstJobs.Items.Clear(); 62 foreach (TaskStatus job in e.Value.Jobs) { 63 ListViewItem item = new ListViewItem(); 64 item.Text = job.TaskId.ToString(); 65 item.SubItems.Add(job.ExecutionTime.ToString()); 66 lstJobs.Items.Add(item); 61 if (InvokeRequired) { 62 Action<object, Common.EventArgs<StatusCommons>> action = new Action<object, Common.EventArgs<StatusCommons>>(Content_SlaveStatusChanged); 63 Invoke(action, sender, e); 64 } else { 65 lstJobs.Items.Clear(); 66 foreach (TaskStatus job in e.Value.Jobs) { 67 ListViewItem item = new ListViewItem(); 68 item.Text = job.TaskId.ToString(); 69 item.SubItems.Add(job.ExecutionTime.ToString()); 70 lstJobs.Items.Add(item); 71 } 72 lstJobs.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); 67 73 } 68 lstJobs.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);69 74 } 70 75 #endregion -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/LogView.cs
r6734 r6743 69 69 #region Event Handlers 70 70 void Content_SlaveMessageLogged(object sender, EventArgs<string> e) { 71 txtLog.AppendText(e.Value + Environment.NewLine); 71 if (txtLog.InvokeRequired) { 72 txtLog.Invoke(new Action<string>(txtLog.AppendText), e.Value + Environment.NewLine); 73 } else { 74 txtLog.AppendText(e.Value + Environment.NewLine); 75 } 72 76 } 73 77 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/SlaveCmdsWithKill.cs
r6734 r6743 65 65 #region Register Content Events 66 66 protected override void DeregisterContentEvents() { 67 68 69 67 base.DeregisterContentEvents(); 70 68 } … … 173 171 protected override void SetEnabledStateOfControls() { 174 172 base.SetEnabledStateOfControls(); 175 //do nothing at the moment, we have nothing editable176 173 } 177 174 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/SlaveItem.cs
r6725 r6743 65 65 66 66 void pipeFactory_Opened(object sender, EventArgs e) { 67 OnMessageLogged("Connection to Slave core established");67 OnMessageLogged("Connection to Slave core opened"); 68 68 OnCoreConnectionChanged(CoreConnection.Connected); 69 69 } … … 188 188 var handler = SlaveDisplayStateChanged; 189 189 if (handler != null) handler(this, new EventArgs<SlaveDisplayStat>(stat)); 190 191 190 } 192 191 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/SlaveMainViewBase.cs
r6734 r6743 76 76 if (Content != null) { 77 77 Content.UserVisibleMessageFired += new System.EventHandler<Common.EventArgs<string>>(Content_UserVisibleMessageFired); 78 ((SlaveItem)base.Content).Open();79 78 Task.Factory.StartNew(Connector); 80 79 } … … 106 105 107 106 private void Connector() { 107 ((SlaveItem)base.Content).Open(); 108 108 bool connected = false; 109 109 while (!connected) { 110 this.Invoke(new Func<bool>(() => connected = ((SlaveItem)base.Content).ReconnectToSlaveCore()));110 connected = ((SlaveItem)base.Content).ReconnectToSlaveCore(); 111 111 112 112 if (!connected) { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/SlaveMainViewTray.cs
r6734 r6743 22 22 using System.Windows.Forms; 23 23 using HeuristicLab.MainForm; 24 25 24 26 25 namespace HeuristicLab.Clients.Hive.SlaveCore.Views { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/SlaveStats.cs
r6734 r6743 35 35 private SlaveDisplayStat lastSlaveDisplayStat; 36 36 37 38 37 public new SlaveItem Content { 39 38 get { return (SlaveItem)base.Content; } … … 56 55 Content.SlaveStatusChanged -= new System.EventHandler<EventArgs<StatusCommons>>(Content_SlaveStatusChanged); 57 56 Content.SlaveDisplayStateChanged -= new EventHandler<EventArgs<SlaveDisplayStat>>(Content_SlaveDisplayStateChanged); 58 Content.CoreConnectionChanged -= new EventHandler<EventArgs<CoreConnection>>(Content_CoreConnectionChanged);59 57 60 58 base.DeregisterContentEvents(); … … 66 64 Content.SlaveStatusChanged += new System.EventHandler<EventArgs<StatusCommons>>(Content_SlaveStatusChanged); 67 65 Content.SlaveDisplayStateChanged += new EventHandler<EventArgs<SlaveDisplayStat>>(Content_SlaveDisplayStateChanged); 68 Content.CoreConnectionChanged += new EventHandler<EventArgs<CoreConnection>>(Content_CoreConnectionChanged);69 66 } 70 67 #endregion … … 80 77 #region Event Handlers 81 78 void Content_SlaveStatusChanged(object sender, EventArgs<StatusCommons> e) { 82 RenderJobChart(e.Value); 83 RenderCoreChart(e.Value); 79 if (InvokeRequired) { 80 Action<object, EventArgs<StatusCommons>> action = new Action<object, EventArgs<StatusCommons>>(Content_SlaveStatusChanged); 81 Invoke(action, sender, e); 82 } else { 83 RenderJobChart(e.Value); 84 RenderCoreChart(e.Value); 85 } 84 86 } 85 87 86 88 void Content_SlaveDisplayStateChanged(object sender, EventArgs<SlaveDisplayStat> e) { 87 lblSlaveState.Text = e.Value.ToString(); 88 lastSlaveDisplayStat = e.Value; 89 } 90 91 void Content_CoreConnectionChanged(object sender, EventArgs<CoreConnection> e) { 92 89 if (InvokeRequired) { 90 Action<object, EventArgs<SlaveDisplayStat>> action = new Action<object, EventArgs<SlaveDisplayStat>>(Content_SlaveDisplayStateChanged); 91 Invoke(action, sender, e); 92 } else { 93 lblSlaveState.Text = e.Value.ToString(); 94 lastSlaveDisplayStat = e.Value; 95 } 93 96 } 94 97 #endregion 95 98 96 99 private void RenderJobChart(StatusCommons status) { 97 jobChart.Series[0].Points.Clear(); 98 jobChart.Series[1].Points.Clear(); 99 jobChart.Series[2].Points.Clear(); 100 jobChart.Series[3].Points.Clear(); 101 jobChart.Series[4].Points.Clear(); 100 if (InvokeRequired) { 101 Invoke(new Action<StatusCommons>(RenderJobChart), status); 102 } else { 103 jobChart.Series[0].Points.Clear(); 104 jobChart.Series[1].Points.Clear(); 105 jobChart.Series[2].Points.Clear(); 106 jobChart.Series[3].Points.Clear(); 107 jobChart.Series[4].Points.Clear(); 102 108 103 109 104 DataPoint pJobs = new DataPoint(1, status.Jobs.Count);105 DataPoint pJobsAborted = new DataPoint(2, status.JobsAborted);106 DataPoint pJobsDone = new DataPoint(3, status.JobsFinished);107 DataPoint pJobsFetched = new DataPoint(4, status.JobsFetched);108 DataPoint pJobsFailed = new DataPoint(5, status.JobsFailed);110 DataPoint pJobs = new DataPoint(1, status.Jobs.Count); 111 DataPoint pJobsAborted = new DataPoint(2, status.JobsAborted); 112 DataPoint pJobsDone = new DataPoint(3, status.JobsFinished); 113 DataPoint pJobsFetched = new DataPoint(4, status.JobsFetched); 114 DataPoint pJobsFailed = new DataPoint(5, status.JobsFailed); 109 115 110 pJobs.LegendText = "Current jobs: " + status.Jobs.Count;111 pJobs.Color = System.Drawing.Color.Yellow;112 pJobs.ToolTip = pJobs.LegendText;113 jobChart.Series[0].Color = System.Drawing.Color.Yellow;114 jobChart.Series[0].LegendText = pJobs.LegendText;115 jobChart.Series[0].Points.Add(pJobs);116 pJobs.LegendText = "Current jobs: " + status.Jobs.Count; 117 pJobs.Color = System.Drawing.Color.Yellow; 118 pJobs.ToolTip = pJobs.LegendText; 119 jobChart.Series[0].Color = System.Drawing.Color.Yellow; 120 jobChart.Series[0].LegendText = pJobs.LegendText; 121 jobChart.Series[0].Points.Add(pJobs); 116 122 117 pJobsAborted.LegendText = "Aborted jobs: " + status.JobsAborted;118 pJobsAborted.Color = System.Drawing.Color.Orange;119 pJobsAborted.ToolTip = pJobsAborted.LegendText;120 jobChart.Series[1].Color = System.Drawing.Color.Orange;121 jobChart.Series[1].LegendText = pJobsAborted.LegendText;122 jobChart.Series[1].Points.Add(pJobsAborted);123 pJobsAborted.LegendText = "Aborted jobs: " + status.JobsAborted; 124 pJobsAborted.Color = System.Drawing.Color.Orange; 125 pJobsAborted.ToolTip = pJobsAborted.LegendText; 126 jobChart.Series[1].Color = System.Drawing.Color.Orange; 127 jobChart.Series[1].LegendText = pJobsAborted.LegendText; 128 jobChart.Series[1].Points.Add(pJobsAborted); 123 129 124 pJobsDone.LegendText = "Finished jobs: " + status.JobsFinished;125 pJobsDone.Color = System.Drawing.Color.Green;126 pJobsDone.ToolTip = pJobsDone.LegendText;127 jobChart.Series[2].Color = System.Drawing.Color.Green;128 jobChart.Series[2].LegendText = pJobsDone.LegendText;129 jobChart.Series[2].Points.Add(pJobsDone);130 pJobsDone.LegendText = "Finished jobs: " + status.JobsFinished; 131 pJobsDone.Color = System.Drawing.Color.Green; 132 pJobsDone.ToolTip = pJobsDone.LegendText; 133 jobChart.Series[2].Color = System.Drawing.Color.Green; 134 jobChart.Series[2].LegendText = pJobsDone.LegendText; 135 jobChart.Series[2].Points.Add(pJobsDone); 130 136 131 pJobsFetched.LegendText = "Fetched jobs: " + status.JobsFetched;132 pJobsFetched.ToolTip = pJobsFetched.LegendText;133 pJobsFetched.Color = System.Drawing.Color.Blue;134 jobChart.Series[3].Color = System.Drawing.Color.Blue;135 jobChart.Series[3].LegendText = pJobsFetched.LegendText;136 jobChart.Series[3].Points.Add(pJobsFetched);137 pJobsFetched.LegendText = "Fetched jobs: " + status.JobsFetched; 138 pJobsFetched.ToolTip = pJobsFetched.LegendText; 139 pJobsFetched.Color = System.Drawing.Color.Blue; 140 jobChart.Series[3].Color = System.Drawing.Color.Blue; 141 jobChart.Series[3].LegendText = pJobsFetched.LegendText; 142 jobChart.Series[3].Points.Add(pJobsFetched); 137 143 138 pJobsFailed.LegendText = "Failed jobs: " + status.JobsFailed; 139 pJobsFailed.ToolTip = pJobsFailed.LegendText; 140 pJobsFailed.Color = System.Drawing.Color.Red; 141 jobChart.Series[4].Color = System.Drawing.Color.Red; 142 jobChart.Series[4].LegendText = pJobsFailed.LegendText; 143 jobChart.Series[4].Points.Add(pJobsFailed); 144 pJobsFailed.LegendText = "Failed jobs: " + status.JobsFailed; 145 pJobsFailed.ToolTip = pJobsFailed.LegendText; 146 pJobsFailed.Color = System.Drawing.Color.Red; 147 jobChart.Series[4].Color = System.Drawing.Color.Red; 148 jobChart.Series[4].LegendText = pJobsFailed.LegendText; 149 jobChart.Series[4].Points.Add(pJobsFailed); 150 } 144 151 } 145 152 146 153 private void RenderCoreChart(StatusCommons statusCommons) { 147 int usedCores = statusCommons.TotalCores - statusCommons.FreeCores; 148 DataPoint pFreeCores = new DataPoint(statusCommons.FreeCores, statusCommons.FreeCores); 149 DataPoint pUsedCores = new DataPoint(usedCores, usedCores); 154 if (InvokeRequired) { 155 Invoke(new Action<StatusCommons>(RenderCoreChart), statusCommons); 156 } else { 157 int usedCores = statusCommons.TotalCores - statusCommons.FreeCores; 158 DataPoint pFreeCores = new DataPoint(statusCommons.FreeCores, statusCommons.FreeCores); 159 DataPoint pUsedCores = new DataPoint(usedCores, usedCores); 150 160 151 coresChart.Series[0].Points.Clear();161 coresChart.Series[0].Points.Clear(); 152 162 153 pFreeCores.LegendText = "Free cores: " + statusCommons.FreeCores;154 pFreeCores.Color = System.Drawing.Color.Green;155 pUsedCores.LegendText = "Used cores: " + usedCores;156 pUsedCores.Color = System.Drawing.Color.Red;163 pFreeCores.LegendText = "Free cores: " + statusCommons.FreeCores; 164 pFreeCores.Color = System.Drawing.Color.Green; 165 pUsedCores.LegendText = "Used cores: " + usedCores; 166 pUsedCores.Color = System.Drawing.Color.Red; 157 167 158 coresChart.Series[0].Points.Add(pFreeCores); 159 coresChart.Series[0].Points.Add(pUsedCores); 168 coresChart.Series[0].Points.Add(pFreeCores); 169 coresChart.Series[0].Points.Add(pUsedCores); 170 } 160 171 } 161 172 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/SlaveViewTray.cs
r6734 r6743 37 37 #region Register Content Events 38 38 protected override void DeregisterContentEvents() { 39 40 39 base.DeregisterContentEvents(); 41 40 } … … 43 42 protected override void RegisterContentEvents() { 44 43 base.RegisterContentEvents(); 45 46 47 44 } 48 45 #endregion -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.3/Core.cs
r6725 r6743 232 232 int usedCores = 0; 233 233 try { 234 task = wcfService.Get Job(taskId);234 task = wcfService.GetTask(taskId); 235 235 if (task == null) throw new TaskNotFoundException(taskId); 236 236 if (ConfigManager.Instance.GetFreeCores() < task.CoresNeeded) throw new OutOfCoresException(); 237 237 if (ConfigManager.GetFreeMemory() < task.MemoryNeeded) throw new OutOfMemoryException(); 238 238 SlaveStatusInfo.IncrementUsedCores(task.CoresNeeded); usedCores = task.CoresNeeded; 239 TaskData taskData = wcfService.Get JobData(taskId);239 TaskData taskData = wcfService.GetTaskData(taskId); 240 240 if (taskData == null) throw new TaskDataNotFoundException(taskId); 241 241 task = wcfService.UpdateJobState(taskId, TaskState.Calculating, null); … … 273 273 Guid taskId = (Guid)taskIdObj; 274 274 try { 275 Task task = wcfService.Get Job(taskId);275 Task task = wcfService.GetTask(taskId); 276 276 if (task == null) throw new TaskNotFoundException(taskId); 277 277 taskManager.StopTaskAsync(taskId); … … 291 291 Guid taskId = (Guid)taskIdObj; 292 292 try { 293 Task task = wcfService.Get Job(taskId);293 Task task = wcfService.GetTask(taskId); 294 294 if (task == null) throw new TaskNotFoundException(taskId); 295 295 taskManager.PauseTaskAsync(taskId); … … 334 334 SlaveStatusInfo.DecrementUsedCores(e.Value.CoresNeeded); 335 335 heartbeatManager.AwakeHeartBeatThread(); 336 Task task = wcfService.Get Job(e.Value.TaskId);336 Task task = wcfService.GetTask(e.Value.TaskId); 337 337 if (task == null) throw new TaskNotFoundException(e.Value.TaskId); 338 338 task.ExecutionTime = e.Value.ExecutionTime; 339 339 TaskData taskData = e.Value.GetTaskData(); 340 wcfService.Update JobData(task, taskData, configManager.GetClientInfo().Id, TaskState.Paused);340 wcfService.UpdateTaskData(task, taskData, configManager.GetClientInfo().Id, TaskState.Paused); 341 341 } 342 342 catch (TaskNotFoundException ex) { … … 352 352 SlaveStatusInfo.DecrementUsedCores(e.Value.CoresNeeded); 353 353 heartbeatManager.AwakeHeartBeatThread(); 354 Task task = wcfService.Get Job(e.Value.TaskId);354 Task task = wcfService.GetTask(e.Value.TaskId); 355 355 if (task == null) throw new TaskNotFoundException(e.Value.TaskId); 356 356 task.ExecutionTime = e.Value.ExecutionTime; 357 357 TaskData taskData = e.Value.GetTaskData(); 358 wcfService.Update JobData(task, taskData, configManager.GetClientInfo().Id, TaskState.Finished);358 wcfService.UpdateTaskData(task, taskData, configManager.GetClientInfo().Id, TaskState.Finished); 359 359 } 360 360 catch (TaskNotFoundException ex) { … … 374 374 Exception exception = e.Value.Item3; 375 375 376 Task task = wcfService.Get Job(slaveTask.TaskId);376 Task task = wcfService.GetTask(slaveTask.TaskId); 377 377 if (task == null) throw new TaskNotFoundException(slaveTask.TaskId); 378 378 task.ExecutionTime = slaveTask.ExecutionTime; 379 379 if (taskData != null) { 380 wcfService.Update JobData(task, taskData, configManager.GetClientInfo().Id, TaskState.Failed, exception.ToString());380 wcfService.UpdateTaskData(task, taskData, configManager.GetClientInfo().Id, TaskState.Failed, exception.ToString()); 381 381 } else { 382 382 wcfService.UpdateJobState(task.Id, TaskState.Failed, exception.ToString()); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.3/WcfService.cs
r6725 r6743 55 55 56 56 #region Task Methods 57 public Task Get Job(Guid jobId) {58 return CallHiveService(s => s.Get Job(jobId));57 public Task GetTask(Guid taskId) { 58 return CallHiveService(s => s.GetTask(taskId)); 59 59 } 60 60 61 public void Update Job(Task job) {62 CallHiveService(s => s.Update Job(job));61 public void UpdateTask(Task task) { 62 CallHiveService(s => s.UpdateTask(task)); 63 63 } 64 64 #endregion 65 65 66 66 #region TaskData Methods 67 public TaskData Get JobData(Guid jobId) {68 return CallHiveService(s => s.Get JobData(jobId));67 public TaskData GetTaskData(Guid taskId) { 68 return CallHiveService(s => s.GetTaskData(taskId)); 69 69 } 70 70 71 71 /// <summary> 72 /// Uploads the taskData and sets a new jobState (while correctly setting Transferring state)72 /// Uploads the taskData and sets a new taskState (while correctly setting Transferring state) 73 73 /// </summary> 74 public void Update JobData(Task job, TaskData jobData, Guid slaveId, TaskState state, string exception = "") {74 public void UpdateTaskData(Task task, TaskData taskData, Guid slaveId, TaskState state, string exception = "") { 75 75 CallHiveService(service => { 76 service.Update Job(job);77 job = service.UpdateJobState(job.Id, TaskState.Transferring, slaveId, null, null);76 service.UpdateTask(task); 77 task = service.UpdateTaskState(task.Id, TaskState.Transferring, slaveId, null, null); 78 78 HiveClient.TryAndRepeat(() => { 79 service.Update JobData(job, jobData);79 service.UpdateTaskData(task, taskData); 80 80 }, Settings.Default.PluginDeletionRetries, "Could not upload jobdata."); 81 service.Update JobState(job.Id, state, slaveId, null, exception);81 service.UpdateTaskState(task.Id, state, slaveId, null, exception); 82 82 }); 83 83 } 84 84 85 public Task UpdateJobState(Guid jobId, TaskState jobState, string exception) {86 return CallHiveService(s => s.Update JobState(jobId, jobState, ConfigManager.Instance.GetClientInfo().Id, null, exception));85 public Task UpdateJobState(Guid taskId, TaskState taskState, string exception) { 86 return CallHiveService(s => s.UpdateTaskState(taskId, taskState, ConfigManager.Instance.GetClientInfo().Id, null, exception)); 87 87 } 88 88 #endregion -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Tests/ExperimentManagerTests.cs
r6725 r6743 45 45 var rhc = new RefreshableJob(); 46 46 var optimizer = CreateOptimizer(); 47 rhc.Hive Jobs.Add(new OptimizerHiveTask(optimizer));47 rhc.HiveTasks.Add(new OptimizerHiveTask(optimizer)); 48 48 49 HiveClient.Start Experiment((Exception ex) => TestContext.WriteLine(ex.ToString()), rhc, new CancellationToken());49 HiveClient.StartJob((Exception ex) => TestContext.WriteLine(ex.ToString()), rhc, new CancellationToken()); 50 50 51 51 while (rhc.ExecutionState != Core.ExecutionState.Stopped) { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.3/HiveTasks/HiveTaskView.cs
r6727 r6743 129 129 this.dateFinishedTextBox.Text = Content.Task.DateFinished.ToString(); 130 130 this.exceptionTextBox.Text = Content.Task.CurrentStateLog != null ? Content.Task.CurrentStateLog.Exception : string.Empty; 131 this.lastUpdatedTextBox.Text = Content.Task.Last JobDataUpdate.ToString();131 this.lastUpdatedTextBox.Text = Content.Task.LastTaskDataUpdate.ToString(); 132 132 } else { 133 133 this.stateTextBox.Text = string.Empty; -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/ConcurrentTaskDownloader.cs
r6725 r6743 42 42 } 43 43 44 public void Download Job(Task job, Action<Task, T> onFinishedAction) {45 Task<T> task = Task<TaskData>.Factory.StartNew((x) => Download Job(x), job.Id)46 .ContinueWith((x) => Deserialize Job(x.Result));47 task.ContinueWith((x) => On JobFinished(job, x, onFinishedAction), TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnRanToCompletion);48 task.ContinueWith((x) => On JobFailed(job, x, onFinishedAction), TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnFaulted);44 public void DownloadTask(Task job, Action<Task, T> onFinishedAction) { 45 Task<T> task = Task<TaskData>.Factory.StartNew((x) => DownloadTask(x), job.Id) 46 .ContinueWith((x) => DeserializeTask(x.Result)); 47 task.ContinueWith((x) => OnTaskFinished(job, x, onFinishedAction), TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnRanToCompletion); 48 task.ContinueWith((x) => OnTaskFailed(job, x, onFinishedAction), TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnFaulted); 49 49 } 50 50 51 private void On JobFinished(Task job, Task<T> task, Action<Task, T> onFinishedAction) {51 private void OnTaskFinished(Task job, Task<T> task, Action<Task, T> onFinishedAction) { 52 52 onFinishedAction(job, task.Result); 53 53 } 54 private void On JobFailed(Task job, Task<T> task, Action<Task, T> onFinishedAction) {54 private void OnTaskFailed(Task job, Task<T> task, Action<Task, T> onFinishedAction) { 55 55 task.Exception.Flatten().Handle((e) => { return true; }); 56 56 OnExceptionOccured(task.Exception.Flatten()); … … 58 58 } 59 59 60 protected TaskData Download Job(object jobId) {60 protected TaskData DownloadTask(object taskId) { 61 61 downloadSemaphore.WaitOne(); 62 62 deserializeSemaphore.WaitOne(); … … 64 64 try { 65 65 if (abort) return null; 66 result = ServiceLocator.Instance.CallHiveService(s => s.Get JobData((Guid)jobId));66 result = ServiceLocator.Instance.CallHiveService(s => s.GetTaskData((Guid)taskId)); 67 67 } 68 68 finally { … … 72 72 } 73 73 74 protected T Deserialize Job(TaskData jobData) {74 protected T DeserializeTask(TaskData taskData) { 75 75 try { 76 if (abort || jobData == null) return null;77 Task job = ServiceLocator.Instance.CallHiveService(s => s.GetJob(jobData.TaskId));78 if ( job== null) return null;79 var deserializedJob = PersistenceUtil.Deserialize<T>( jobData.Data);80 jobData.Data = null; // reduce memory consumption.76 if (abort || taskData == null) return null; 77 Task task = ServiceLocator.Instance.CallHiveService(s => s.GetTask(taskData.TaskId)); 78 if (task == null) return null; 79 var deserializedJob = PersistenceUtil.Deserialize<T>(taskData.Data); 80 taskData.Data = null; // reduce memory consumption. 81 81 return deserializedJob; 82 82 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/HiveClient.cs
r6725 r6743 86 86 var oldExperiments = jobs ?? new ItemCollection<RefreshableJob>(); 87 87 jobs = new HiveItemCollection<RefreshableJob>(); 88 var experimentsLoaded = ServiceLocator.Instance.CallHiveService<IEnumerable<Job>>(s => s.Get HiveExperiments());88 var experimentsLoaded = ServiceLocator.Instance.CallHiveService<IEnumerable<Job>>(s => s.GetJobs()); 89 89 90 90 foreach (var he in experimentsLoaded) { 91 var hiveExperiment= oldExperiments.SingleOrDefault(x => x.Id == he.Id);92 if ( hiveExperiment== null) {91 var job = oldExperiments.SingleOrDefault(x => x.Id == he.Id); 92 if (job == null) { 93 93 // new 94 94 jobs.Add(new RefreshableJob(he) { IsAllowedPrivileged = this.isAllowedPrivileged }); 95 95 } else { 96 96 // update 97 hiveExperiment.Job = he;98 hiveExperiment.IsAllowedPrivileged = this.isAllowedPrivileged;99 jobs.Add( hiveExperiment);97 job.Job = he; 98 job.IsAllowedPrivileged = this.isAllowedPrivileged; 99 jobs.Add(job); 100 100 } 101 101 } … … 139 139 if (item.Id == Guid.Empty) { 140 140 if (item is RefreshableJob) { 141 HiveClient.Instance.Upload Experiment((RefreshableJob)item, cancellationToken);141 HiveClient.Instance.UploadJob((RefreshableJob)item, cancellationToken); 142 142 } 143 143 if (item is JobPermission) { … … 151 151 } else { 152 152 if (item is Job) 153 ServiceLocator.Instance.CallHiveService(s => s.Update HiveExperiment((Job)item));153 ServiceLocator.Instance.CallHiveService(s => s.UpdateJob((Job)item)); 154 154 } 155 155 } … … 177 177 178 178 if (item is Job) 179 ServiceLocator.Instance.CallHiveService(s => s.Delete HiveExperiment(item.Id));179 ServiceLocator.Instance.CallHiveService(s => s.DeleteJob(item.Id)); 180 180 if (item is RefreshableJob) 181 ServiceLocator.Instance.CallHiveService(s => s.Delete HiveExperiment(item.Id));181 ServiceLocator.Instance.CallHiveService(s => s.DeleteJob(item.Id)); 182 182 if (item is JobPermission) { 183 183 var hep = (JobPermission)item; … … 206 206 #endregion 207 207 208 public static void Start Experiment(Action<Exception> exceptionCallback, RefreshableJob refreshableJob, CancellationToken cancellationToken) {208 public static void StartJob(Action<Exception> exceptionCallback, RefreshableJob refreshableJob, CancellationToken cancellationToken) { 209 209 HiveClient.StoreAsync( 210 210 new Action<Exception>((Exception ex) => { … … 215 215 } 216 216 217 public static void Pause Experiment(RefreshableJob refreshableHiveExperiment) {217 public static void PauseJob(RefreshableJob refreshableJob) { 218 218 ServiceLocator.Instance.CallHiveService(service => { 219 foreach (HiveTask job in refreshableHiveExperiment.GetAllHiveJobs()) {220 if ( job.Task.State != TaskState.Finished && job.Task.State != TaskState.Aborted && job.Task.State != TaskState.Failed)221 service.Pause Job(job.Task.Id);219 foreach (HiveTask task in refreshableJob.GetAllHiveTasks()) { 220 if (task.Task.State != TaskState.Finished && task.Task.State != TaskState.Aborted && task.Task.State != TaskState.Failed) 221 service.PauseTask(task.Task.Id); 222 222 } 223 223 }); 224 refreshable HiveExperiment.ExecutionState = ExecutionState.Paused;225 } 226 227 public static void Stop Experiment(RefreshableJob refreshableJob) {224 refreshableJob.ExecutionState = ExecutionState.Paused; 225 } 226 227 public static void StopJob(RefreshableJob refreshableJob) { 228 228 ServiceLocator.Instance.CallHiveService(service => { 229 foreach (HiveTask job in refreshableJob.GetAllHiveJobs()) {230 if ( job.Task.State != TaskState.Finished && job.Task.State != TaskState.Aborted && job.Task.State != TaskState.Failed)231 service.Stop Job(job.Task.Id);229 foreach (HiveTask task in refreshableJob.GetAllHiveTasks()) { 230 if (task.Task.State != TaskState.Finished && task.Task.State != TaskState.Aborted && task.Task.State != TaskState.Failed) 231 service.StopTask(task.Task.Id); 232 232 } 233 233 }); … … 235 235 } 236 236 237 #region Upload Experiment237 #region Upload Job 238 238 private Semaphore jobUploadSemaphore = new Semaphore(4, 4); // todo: take magic number into config 239 239 private static object jobCountLocker = new object(); 240 240 private static object pluginLocker = new object(); 241 private void Upload Experiment(RefreshableJob refreshableJob, CancellationToken cancellationToken) {241 private void UploadJob(RefreshableJob refreshableJob, CancellationToken cancellationToken) { 242 242 try { 243 243 refreshableJob.Progress = new Progress("Connecting to server..."); … … 254 254 } 255 255 256 foreach (OptimizerHiveTask hiveJob in refreshableJob.Hive Jobs.OfType<OptimizerHiveTask>()) {256 foreach (OptimizerHiveTask hiveJob in refreshableJob.HiveTasks.OfType<OptimizerHiveTask>()) { 257 257 hiveJob.SetIndexInParentOptimizerList(null); 258 258 } … … 260 260 // upload Task 261 261 refreshableJob.Progress.Status = "Uploading Task..."; 262 refreshableJob.Job.Id = ServiceLocator.Instance.CallHiveService((s) => s.Add HiveExperiment(refreshableJob.Job));262 refreshableJob.Job.Id = ServiceLocator.Instance.CallHiveService((s) => s.AddJob(refreshableJob.Job)); 263 263 bool isPrivileged = refreshableJob.Job.IsPrivileged; 264 refreshableJob.Job = ServiceLocator.Instance.CallHiveService((s) => s.Get HiveExperiment(refreshableJob.Job.Id)); // update owner and permissions264 refreshableJob.Job = ServiceLocator.Instance.CallHiveService((s) => s.GetJob(refreshableJob.Job.Id)); // update owner and permissions 265 265 refreshableJob.Job.IsPrivileged = isPrivileged; 266 266 cancellationToken.ThrowIfCancellationRequested(); 267 267 268 int totalJobCount = refreshableJob.GetAllHive Jobs().Count();268 int totalJobCount = refreshableJob.GetAllHiveTasks().Count(); 269 269 int[] jobCount = new int[1]; // use a reference type (int-array) instead of value type (int) in order to pass the value via a delegate to task-parallel-library 270 270 cancellationToken.ThrowIfCancellationRequested(); … … 284 284 285 285 var tasks = new List<TS.Task>(); 286 foreach (HiveTask hiveJob in refreshableJob.Hive Jobs) {286 foreach (HiveTask hiveJob in refreshableJob.HiveTasks) { 287 287 tasks.Add(TS.Task.Factory.StartNew((hj) => { 288 Upload JobWithChildren(refreshableJob.Progress, (HiveTask)hj, null, resourceIds, jobCount, totalJobCount, configFilePlugin.Id, refreshableJob.Job.Id, refreshableJob.Log, refreshableJob.Job.IsPrivileged, cancellationToken);288 UploadTaskWithChildren(refreshableJob.Progress, (HiveTask)hj, null, resourceIds, jobCount, totalJobCount, configFilePlugin.Id, refreshableJob.Job.Id, refreshableJob.Log, refreshableJob.Job.IsPrivileged, cancellationToken); 289 289 }, hiveJob) 290 290 .ContinueWith((x) => refreshableJob.Log.LogException(x.Exception), TaskContinuationOptions.OnlyOnFaulted)); … … 334 334 /// </summary> 335 335 /// <param name="parentHiveTask">shall be null if its the root task</param> 336 private void Upload JobWithChildren(IProgress progress, HiveTask hiveJob, HiveTask parentHiveJob, IEnumerable<Guid> groups, int[] jobCount, int totalJobCount, Guid configPluginId, Guid hiveExperimentId, ILog log, bool isPrivileged, CancellationToken cancellationToken) {336 private void UploadTaskWithChildren(IProgress progress, HiveTask hiveTask, HiveTask parentHiveJob, IEnumerable<Guid> groups, int[] taskCount, int totalJobCount, Guid configPluginId, Guid jobId, ILog log, bool isPrivileged, CancellationToken cancellationToken) { 337 337 jobUploadSemaphore.WaitOne(); 338 338 bool semaphoreReleased = false; … … 340 340 cancellationToken.ThrowIfCancellationRequested(); 341 341 lock (jobCountLocker) { 342 jobCount[0]++;342 taskCount[0]++; 343 343 } 344 344 TaskData jobData; 345 345 List<IPluginDescription> plugins; 346 346 347 if (hive Job.ItemTask.ComputeInParallel && (hiveJob.ItemTask.Item is Optimization.Experiment || hiveJob.ItemTask.Item is Optimization.BatchRun)) {348 hive Job.Task.IsParentTask = true;349 hive Job.Task.FinishWhenChildJobsFinished = true;350 jobData = hive Job.GetAsTaskData(true, out plugins);347 if (hiveTask.ItemTask.ComputeInParallel && (hiveTask.ItemTask.Item is Optimization.Experiment || hiveTask.ItemTask.Item is Optimization.BatchRun)) { 348 hiveTask.Task.IsParentTask = true; 349 hiveTask.Task.FinishWhenChildJobsFinished = true; 350 jobData = hiveTask.GetAsTaskData(true, out plugins); 351 351 } else { 352 hive Job.Task.IsParentTask = false;353 hive Job.Task.FinishWhenChildJobsFinished = false;354 jobData = hive Job.GetAsTaskData(false, out plugins);352 hiveTask.Task.IsParentTask = false; 353 hiveTask.Task.FinishWhenChildJobsFinished = false; 354 jobData = hiveTask.GetAsTaskData(false, out plugins); 355 355 } 356 356 cancellationToken.ThrowIfCancellationRequested(); … … 359 359 if (!cancellationToken.IsCancellationRequested) { 360 360 lock (pluginLocker) { 361 ServiceLocator.Instance.CallHiveService((s) => hive Job.Task.PluginsNeededIds = PluginUtil.GetPluginDependencies(s, this.onlinePlugins, this.alreadyUploadedPlugins, plugins));361 ServiceLocator.Instance.CallHiveService((s) => hiveTask.Task.PluginsNeededIds = PluginUtil.GetPluginDependencies(s, this.onlinePlugins, this.alreadyUploadedPlugins, plugins)); 362 362 } 363 363 } 364 364 }, -1, "Failed to upload plugins"); 365 365 cancellationToken.ThrowIfCancellationRequested(); 366 hive Job.Task.PluginsNeededIds.Add(configPluginId);367 hive Job.Task.JobId = hiveExperimentId;368 hive Job.Task.IsPrivileged = isPrivileged;369 370 log.LogMessage(string.Format("Uploading task ({0} kb, {1} objects)", jobData.Data.Count() / 1024, hive Job.ItemTask.GetObjectGraphObjects().Count()));366 hiveTask.Task.PluginsNeededIds.Add(configPluginId); 367 hiveTask.Task.JobId = jobId; 368 hiveTask.Task.IsPrivileged = isPrivileged; 369 370 log.LogMessage(string.Format("Uploading task ({0} kb, {1} objects)", jobData.Data.Count() / 1024, hiveTask.ItemTask.GetObjectGraphObjects().Count())); 371 371 TryAndRepeat(() => { 372 372 if (!cancellationToken.IsCancellationRequested) { 373 373 if (parentHiveJob != null) { 374 hive Job.Task.Id = ServiceLocator.Instance.CallHiveService((s) => s.AddChildJob(parentHiveJob.Task.Id, hiveJob.Task, jobData));374 hiveTask.Task.Id = ServiceLocator.Instance.CallHiveService((s) => s.AddChildTask(parentHiveJob.Task.Id, hiveTask.Task, jobData)); 375 375 } else { 376 hive Job.Task.Id = ServiceLocator.Instance.CallHiveService((s) => s.AddJob(hiveJob.Task, jobData, groups.ToList()));376 hiveTask.Task.Id = ServiceLocator.Instance.CallHiveService((s) => s.AddTask(hiveTask.Task, jobData, groups.ToList())); 377 377 } 378 378 } … … 381 381 382 382 lock (jobCountLocker) { 383 progress.ProgressValue = (double) jobCount[0] / totalJobCount;384 progress.Status = string.Format("Uploaded task ({0} of {1})", jobCount[0], totalJobCount);383 progress.ProgressValue = (double)taskCount[0] / totalJobCount; 384 progress.Status = string.Format("Uploaded task ({0} of {1})", taskCount[0], totalJobCount); 385 385 } 386 386 387 387 var tasks = new List<TS.Task>(); 388 foreach (HiveTask child in hive Job.ChildHiveTasks) {388 foreach (HiveTask child in hiveTask.ChildHiveTasks) { 389 389 tasks.Add(TS.Task.Factory.StartNew((tuple) => { 390 390 var arguments = (Tuple<HiveTask, HiveTask>)tuple; 391 Upload JobWithChildren(progress, arguments.Item1, arguments.Item2, groups, jobCount, totalJobCount, configPluginId, hiveExperimentId, log, isPrivileged, cancellationToken);392 }, new Tuple<HiveTask, HiveTask>(child, hive Job))391 UploadTaskWithChildren(progress, arguments.Item1, arguments.Item2, groups, taskCount, totalJobCount, configPluginId, jobId, log, isPrivileged, cancellationToken); 392 }, new Tuple<HiveTask, HiveTask>(child, hiveTask)) 393 393 .ContinueWith((x) => log.LogException(x.Exception), TaskContinuationOptions.OnlyOnFaulted)); 394 394 } … … 408 408 409 409 #region Download Experiment 410 public static void Load Experiment(RefreshableJob refreshableJob) {410 public static void LoadJob(RefreshableJob refreshableJob) { 411 411 var hiveExperiment = refreshableJob.Job; 412 412 refreshableJob.Progress = new Progress(); … … 415 415 refreshableJob.IsProgressing = true; 416 416 int totalJobCount = 0; 417 IEnumerable<LightweightTask> all Jobs;417 IEnumerable<LightweightTask> allTasks; 418 418 419 419 refreshableJob.Progress.Status = "Connecting to Server..."; 420 420 // fetch all Task objects to create the full tree of tree of HiveTask objects 421 421 refreshableJob.Progress.Status = "Downloading list of jobs..."; 422 all Jobs = ServiceLocator.Instance.CallHiveService(s => s.GetLightweightExperimentJobs(hiveExperiment.Id));423 totalJobCount = all Jobs.Count();424 425 TaskDownloader downloader = new TaskDownloader(all Jobs.Select(x => x.Id));422 allTasks = ServiceLocator.Instance.CallHiveService(s => s.GetLightweightJobTasks(hiveExperiment.Id)); 423 totalJobCount = allTasks.Count(); 424 425 TaskDownloader downloader = new TaskDownloader(allTasks.Select(x => x.Id)); 426 426 downloader.StartAsync(); 427 427 … … 435 435 } 436 436 } 437 IDictionary<Guid, HiveTask> allHive Jobs = downloader.Results;438 439 refreshableJob.Hive Jobs = new ItemCollection<HiveTask>(allHiveJobs.Values.Where(x => !x.Task.ParentTaskId.HasValue));437 IDictionary<Guid, HiveTask> allHiveTasks = downloader.Results; 438 439 refreshableJob.HiveTasks = new ItemCollection<HiveTask>(allHiveTasks.Values.Where(x => !x.Task.ParentTaskId.HasValue)); 440 440 441 441 if (refreshableJob.IsFinished()) { … … 446 446 447 447 // build child-task tree 448 foreach (HiveTask hive Job in refreshableJob.HiveJobs) {449 BuildHiveJobTree(hive Job, allJobs, allHiveJobs);448 foreach (HiveTask hiveTask in refreshableJob.HiveTasks) { 449 BuildHiveJobTree(hiveTask, allTasks, allHiveTasks); 450 450 } 451 451 … … 482 482 483 483 public static ItemTask LoadItemJob(Guid jobId) { 484 TaskData jobData = ServiceLocator.Instance.CallHiveService(s => s.Get JobData(jobId));484 TaskData jobData = ServiceLocator.Instance.CallHiveService(s => s.GetTaskData(jobId)); 485 485 try { 486 486 return PersistenceUtil.Deserialize<ItemTask>(jobData.Data); … … 506 506 } 507 507 508 public static HiveItemCollection<JobPermission> Get HiveExperimentPermissions(Guid hiveExperimentId) {508 public static HiveItemCollection<JobPermission> GetJobPermissions(Guid jobId) { 509 509 return ServiceLocator.Instance.CallHiveService((service) => { 510 IEnumerable<JobPermission> heps = service.GetHiveExperimentPermissions(hiveExperimentId);511 foreach (var hep in heps) {510 IEnumerable<JobPermission> jps = service.GetJobPermissions(jobId); 511 foreach (var hep in jps) { 512 512 hep.GrantedUserName = service.GetUsernameByUserId(hep.GrantedUserId); 513 513 } 514 return new HiveItemCollection<JobPermission>( heps);514 return new HiveItemCollection<JobPermission>(jps); 515 515 }); 516 516 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/HiveJobs/HiveTask.cs
r6727 r6743 341 341 342 342 /// <summary> 343 /// Returns a list of Hive Jobs including this and all its child-jobs recursively343 /// Returns a list of HiveTasks including this and all its child-jobs recursively 344 344 /// </summary> 345 345 public IEnumerable<HiveTask> GetAllHiveTasks() { … … 453 453 try { 454 454 foreach (var child in childHiveTasks) { 455 ServiceLocator.Instance.CallHiveService(s => s.Pause Job(child.task.Id));455 ServiceLocator.Instance.CallHiveService(s => s.PauseTask(child.task.Id)); 456 456 } 457 457 } 458 458 finally { childHiveTasksLock.ExitReadLock(); } 459 459 } else { 460 ServiceLocator.Instance.CallHiveService(s => s.Pause Job(this.task.Id));460 ServiceLocator.Instance.CallHiveService(s => s.PauseTask(this.task.Id)); 461 461 } 462 462 } … … 467 467 try { 468 468 foreach (var child in childHiveTasks) { 469 ServiceLocator.Instance.CallHiveService(s => s.Stop Job(child.task.Id));469 ServiceLocator.Instance.CallHiveService(s => s.StopTask(child.task.Id)); 470 470 } 471 471 } 472 472 finally { childHiveTasksLock.ExitReadLock(); } 473 473 } else { 474 ServiceLocator.Instance.CallHiveService(s => s.Stop Job(this.task.Id));474 ServiceLocator.Instance.CallHiveService(s => s.StopTask(this.task.Id)); 475 475 } 476 476 } … … 481 481 taskData.TaskId = this.task.Id; 482 482 taskData.Data = PersistenceUtil.Serialize(this.itemTask); 483 service.Update JobData(this.Task, taskData);484 service.Restart Job(this.task.Id);485 Task job = service.GetJob(this.task.Id);486 this.task.Last JobDataUpdate = job.LastJobDataUpdate;483 service.UpdateTaskData(this.Task, taskData); 484 service.RestartTask(this.task.Id); 485 Task task = service.GetTask(this.task.Id); 486 this.task.LastTaskDataUpdate = task.LastTaskDataUpdate; 487 487 }); 488 488 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/JobResultPoller.cs
r6726 r6743 108 108 return ServiceLocator.Instance.CallHiveService(service => { 109 109 var responses = new List<LightweightTask>(); 110 responses.AddRange(service.GetLightweight ExperimentJobs(jobId));110 responses.AddRange(service.GetLightweightJobTasks(jobId)); 111 111 OnJobResultsReceived(responses); 112 112 return responses; -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/RefreshableJob.cs
r6725 r6743 55 55 } 56 56 57 private ItemCollection<HiveTask> hive Jobs;58 public ItemCollection<HiveTask> Hive Jobs {59 get { return hive Jobs; }57 private ItemCollection<HiveTask> hiveTasks; 58 public ItemCollection<HiveTask> HiveTasks { 59 get { return hiveTasks; } 60 60 set { 61 if (hive Jobs != value) {62 if (hive Jobs != null) DeregisterHiveJobsEvents();63 hive Jobs = value;64 if (hive Jobs != null) RegisterHiveJobsEvents();61 if (hiveTasks != value) { 62 if (hiveTasks != null) DeregisterHiveJobsEvents(); 63 hiveTasks = value; 64 if (hiveTasks != null) RegisterHiveJobsEvents(); 65 65 OnHiveJobsChanged(); 66 66 } … … 100 100 } 101 101 if (RefreshAutomatically) { 102 if (this.Hive Jobs != null && this.HiveJobs.Count > 0 && (jobResultPoller == null || !jobResultPoller.IsPolling)) {102 if (this.HiveTasks != null && this.HiveTasks.Count > 0 && (jobResultPoller == null || !jobResultPoller.IsPolling)) { 103 103 StartResultPolling(); 104 104 } … … 130 130 isControllable = value; 131 131 OnIsControllableChanged(); 132 if (this.hive Jobs != null) {133 foreach (var hiveJob in this.hive Jobs) {132 if (this.hiveTasks != null) { 133 foreach (var hiveJob in this.hiveTasks) { 134 134 hiveJob.IsControllable = value; 135 135 } … … 186 186 187 187 public StateLogListList StateLogList { 188 get { return new StateLogListList(this.GetAllHive Jobs().Select(x => x.StateLog)); }188 get { return new StateLogListList(this.GetAllHiveTasks().Select(x => x.StateLog)); } 189 189 } 190 190 … … 196 196 this.jobDownloader = new ConcurrentTaskDownloader<ItemTask>(2, 2); 197 197 this.jobDownloader.ExceptionOccured += new EventHandler<EventArgs<Exception>>(jobDownloader_ExceptionOccured); 198 this.Hive Jobs = new ItemCollection<HiveTask>();198 this.HiveTasks = new ItemCollection<HiveTask>(); 199 199 } 200 200 public RefreshableJob(Job hiveExperiment) { … … 204 204 this.jobDownloader = new ConcurrentTaskDownloader<ItemTask>(2, 2); 205 205 this.jobDownloader.ExceptionOccured += new EventHandler<EventArgs<Exception>>(jobDownloader_ExceptionOccured); 206 this.Hive Jobs = new ItemCollection<HiveTask>();206 this.HiveTasks = new ItemCollection<HiveTask>(); 207 207 } 208 208 protected RefreshableJob(RefreshableJob original, Cloner cloner) { … … 214 214 this.jobDownloader = new ConcurrentTaskDownloader<ItemTask>(2, 2); 215 215 this.jobDownloader.ExceptionOccured += new EventHandler<EventArgs<Exception>>(jobDownloader_ExceptionOccured); 216 this.Hive Jobs = cloner.Clone(original.HiveJobs);216 this.HiveTasks = cloner.Clone(original.HiveTasks); 217 217 this.ExecutionTime = original.ExecutionTime; 218 218 this.ExecutionState = original.ExecutionState; … … 263 263 } 264 264 private void jobResultPoller_JobResultReceived(object sender, EventArgs<IEnumerable<LightweightTask>> e) { 265 foreach (LightweightTask lightweight Jobin e.Value) {266 HiveTask hive Job = GetHiveJobById(lightweightJob.Id);267 if (hive Job!= null) {265 foreach (LightweightTask lightweightTask in e.Value) { 266 HiveTask hiveTask = GetHiveJobById(lightweightTask.Id); 267 if (hiveTask != null) { 268 268 // lastJobDataUpdate equals DateTime.MinValue right after it was uploaded. When the first results are polled, this value is updated 269 if (hive Job.Task.State == TaskState.Offline && lightweightJob.State != TaskState.Finished && lightweightJob.State != TaskState.Failed && lightweightJob.State != TaskState.Aborted) {270 hive Job.Task.LastJobDataUpdate = lightweightJob.LastJobDataUpdate;269 if (hiveTask.Task.State == TaskState.Offline && lightweightTask.State != TaskState.Finished && lightweightTask.State != TaskState.Failed && lightweightTask.State != TaskState.Aborted) { 270 hiveTask.Task.LastTaskDataUpdate = lightweightTask.LastTaskDataUpdate; 271 271 } 272 272 273 hive Job.UpdateFromLightweightJob(lightweightJob);274 275 if (!hive Job.IsFinishedTaskDownloaded && !hiveJob.IsDownloading && hiveJob.Task.LastJobDataUpdate < lightweightJob.LastJobDataUpdate) {276 log.LogMessage(string.Format("Downloading task {0}", lightweight Job.Id));277 hive Job.IsDownloading = true;278 jobDownloader.Download Job(hiveJob.Task, (localJob, itemJob) => {273 hiveTask.UpdateFromLightweightJob(lightweightTask); 274 275 if (!hiveTask.IsFinishedTaskDownloaded && !hiveTask.IsDownloading && hiveTask.Task.LastTaskDataUpdate < lightweightTask.LastTaskDataUpdate) { 276 log.LogMessage(string.Format("Downloading task {0}", lightweightTask.Id)); 277 hiveTask.IsDownloading = true; 278 jobDownloader.DownloadTask(hiveTask.Task, (localJob, itemJob) => { 279 279 log.LogMessage(string.Format("Finished downloading task {0}", localJob.Id)); 280 HiveTask localHive Job= GetHiveJobById(localJob.Id);280 HiveTask localHiveTask = GetHiveJobById(localJob.Id); 281 281 282 282 if (itemJob == null) { 283 localHive Job.IsDownloading = false;283 localHiveTask.IsDownloading = false; 284 284 } 285 285 … … 290 290 291 291 if (localJob.State == TaskState.Paused) { 292 localHive Job.ItemTask = itemJob;292 localHiveTask.ItemTask = itemJob; 293 293 } else { 294 294 if (localJob.ParentTaskId.HasValue) { 295 HiveTask parentHive Job= GetHiveJobById(localJob.ParentTaskId.Value);296 parentHive Job.IntegrateChild(itemJob, localJob.Id);295 HiveTask parentHiveTask = GetHiveJobById(localJob.ParentTaskId.Value); 296 parentHiveTask.IntegrateChild(itemJob, localJob.Id); 297 297 } else { 298 localHive Job.ItemTask = itemJob;298 localHiveTask.ItemTask = itemJob; 299 299 } 300 300 } 301 localHive Job.IsDownloading = false;302 localHive Job.Task.LastJobDataUpdate = localJob.LastJobDataUpdate;301 localHiveTask.IsDownloading = false; 302 localHiveTask.Task.LastTaskDataUpdate = localJob.LastTaskDataUpdate; 303 303 } 304 304 }); … … 317 317 318 318 public HiveTask GetHiveJobById(Guid jobId) { 319 foreach (HiveTask job in this.Hive Jobs) {319 foreach (HiveTask job in this.HiveTasks) { 320 320 var hj = job.GetHiveTaskByTaskId(jobId); 321 321 if (hj != null) … … 325 325 } 326 326 private void UpdateStatistics() { 327 var jobs = this.GetAllHive Jobs();327 var jobs = this.GetAllHiveTasks(); 328 328 job.JobCount = jobs.Count(); 329 329 job.CalculatingCount = jobs.Count(j => j.Task.State == TaskState.Calculating); … … 333 333 334 334 public bool AllJobsFinished() { 335 return this.GetAllHive Jobs().All(j => (j.Task.State == TaskState.Finished335 return this.GetAllHiveTasks().All(j => (j.Task.State == TaskState.Finished 336 336 || j.Task.State == TaskState.Aborted 337 337 || j.Task.State == TaskState.Failed) … … 346 346 } 347 347 public void UpdateTotalExecutionTime() { 348 this.ExecutionTime = TimeSpan.FromMilliseconds(this.GetAllHive Jobs().Sum(x => x.Task.ExecutionTime.TotalMilliseconds));348 this.ExecutionTime = TimeSpan.FromMilliseconds(this.GetAllHiveTasks().Sum(x => x.Task.ExecutionTime.TotalMilliseconds)); 349 349 } 350 350 #endregion … … 468 468 #endregion 469 469 470 #region Hive Jobs Events470 #region HiveTasks Events 471 471 private void RegisterHiveJobsEvents() { 472 this.hive Jobs.ItemsAdded += new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_ItemsAdded);473 this.hive Jobs.ItemsRemoved += new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_ItemsRemoved);474 this.hive Jobs.CollectionReset += new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_CollectionReset);472 this.hiveTasks.ItemsAdded += new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_ItemsAdded); 473 this.hiveTasks.ItemsRemoved += new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_ItemsRemoved); 474 this.hiveTasks.CollectionReset += new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_CollectionReset); 475 475 } 476 476 477 477 private void DeregisterHiveJobsEvents() { 478 this.hive Jobs.ItemsAdded -= new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_ItemsAdded);479 this.hive Jobs.ItemsRemoved -= new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_ItemsRemoved);480 this.hive Jobs.CollectionReset -= new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_CollectionReset);478 this.hiveTasks.ItemsAdded -= new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_ItemsAdded); 479 this.hiveTasks.ItemsRemoved -= new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_ItemsRemoved); 480 this.hiveTasks.CollectionReset -= new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_CollectionReset); 481 481 } 482 482 … … 514 514 DeregisterResultPollingEvents(); 515 515 } 516 if (this.Hive Jobs != null && this.HiveJobs.Count > 0 && this.GetAllHiveJobs().All(x => x.Task.Id != Guid.Empty)) {516 if (this.HiveTasks != null && this.HiveTasks.Count > 0 && this.GetAllHiveTasks().All(x => x.Task.Id != Guid.Empty)) { 517 517 if (this.RefreshAutomatically) 518 518 StartResultPolling(); … … 581 581 582 582 public bool IsFinished() { 583 return Hive Jobs != null584 && Hive Jobs.All(x => x.Task.DateFinished.HasValue && x.Task.DateCreated.HasValue);585 } 586 587 public IEnumerable<HiveTask> GetAllHive Jobs() {588 if (hive Jobs == null) return Enumerable.Empty<HiveTask>();589 590 var jobs = new List<HiveTask>();591 foreach (HiveTask job in HiveJobs) {592 jobs.AddRange(job.GetAllHiveTasks());593 } 594 return jobs;583 return HiveTasks != null 584 && HiveTasks.All(x => x.Task.DateFinished.HasValue && x.Task.DateCreated.HasValue); 585 } 586 587 public IEnumerable<HiveTask> GetAllHiveTasks() { 588 if (hiveTasks == null) return Enumerable.Empty<HiveTask>(); 589 590 var tasks = new List<HiveTask>(); 591 foreach (HiveTask task in HiveTasks) { 592 tasks.AddRange(task.GetAllHiveTasks()); 593 } 594 return tasks; 595 595 } 596 596 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/ServiceClients/HiveServiceClient.cs
r6725 r6743 59 59 60 60 public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; 61 62 63 61 } 64 62 … … 77 75 78 76 [System.Runtime.Serialization.OptionalFieldAttribute()] 79 private System.DateTime Last JobDataUpdateField;77 private System.DateTime LastTaskDataUpdateField; 80 78 81 79 [System.Runtime.Serialization.OptionalFieldAttribute()] … … 115 113 116 114 [System.Runtime.Serialization.DataMemberAttribute()] 117 public System.DateTime Last JobDataUpdate {118 get { 119 return this.Last JobDataUpdateField;120 } 121 set { 122 if ((this.Last JobDataUpdateField.Equals(value) != true)) {123 this.Last JobDataUpdateField = value;124 this.RaisePropertyChanged("Last JobDataUpdate");115 public System.DateTime LastTaskDataUpdate { 116 get { 117 return this.LastTaskDataUpdateField; 118 } 119 set { 120 if ((this.LastTaskDataUpdateField.Equals(value) != true)) { 121 this.LastTaskDataUpdateField = value; 122 this.RaisePropertyChanged("LastTaskDataUpdate"); 125 123 } 126 124 } … … 1577 1575 System.Guid GetResourceId(string resourceName); 1578 1576 1579 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/Get JobsByResourceId", ReplyAction = "http://tempuri.org/IHiveService/GetJobsByResourceIdResponse")]1580 System.Collections.Generic.List<HeuristicLab.Clients.Hive.Task> Get JobsByResourceId(System.Guid resourceId);1577 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetTasksByResourceId", ReplyAction = "http://tempuri.org/IHiveService/GetTasksByResourceIdResponse")] 1578 System.Collections.Generic.List<HeuristicLab.Clients.Hive.Task> GetTasksByResourceId(System.Guid resourceId); 1581 1579 1582 1580 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/TriggerEventManager", ReplyAction = "http://tempuri.org/IHiveService/TriggerEventManagerResponse")] … … 1601 1599 System.Guid GetUserIdByUsername(string username); 1602 1600 1601 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/AddTask", ReplyAction = "http://tempuri.org/IHiveService/AddTaskResponse")] 1602 System.Guid AddTask(HeuristicLab.Clients.Hive.Task task, HeuristicLab.Clients.Hive.TaskData taskData, System.Collections.Generic.List<System.Guid> resourceIds); 1603 1604 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/AddChildTask", ReplyAction = "http://tempuri.org/IHiveService/AddChildTaskResponse")] 1605 System.Guid AddChildTask(System.Guid parentTaskId, HeuristicLab.Clients.Hive.Task task, HeuristicLab.Clients.Hive.TaskData taskData); 1606 1607 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetTask", ReplyAction = "http://tempuri.org/IHiveService/GetTaskResponse")] 1608 HeuristicLab.Clients.Hive.Task GetTask(System.Guid taskId); 1609 1610 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetTasks", ReplyAction = "http://tempuri.org/IHiveService/GetTasksResponse")] 1611 System.Collections.Generic.List<HeuristicLab.Clients.Hive.Task> GetTasks(); 1612 1613 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetLightweightTasks", ReplyAction = "http://tempuri.org/IHiveService/GetLightweightTasksResponse")] 1614 System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightTasks(System.Collections.Generic.List<System.Guid> taskIds); 1615 1616 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetLightweightChildTasks", ReplyAction = "http://tempuri.org/IHiveService/GetLightweightChildTasksResponse")] 1617 System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightChildTasks(System.Nullable<System.Guid> parentTaskId, bool recursive, bool includeParent); 1618 1619 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetLightweightJobTasks", ReplyAction = "http://tempuri.org/IHiveService/GetLightweightJobTasksResponse")] 1620 System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightJobTasks(System.Guid jobId); 1621 1622 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetTaskData", ReplyAction = "http://tempuri.org/IHiveService/GetTaskDataResponse")] 1623 HeuristicLab.Clients.Hive.TaskData GetTaskData(System.Guid taskId); 1624 1625 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/UpdateTask", ReplyAction = "http://tempuri.org/IHiveService/UpdateTaskResponse")] 1626 void UpdateTask(HeuristicLab.Clients.Hive.Task taskDto); 1627 1628 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/UpdateTaskData", ReplyAction = "http://tempuri.org/IHiveService/UpdateTaskDataResponse")] 1629 void UpdateTaskData(HeuristicLab.Clients.Hive.Task taskDto, HeuristicLab.Clients.Hive.TaskData taskDataDto); 1630 1631 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/DeleteTask", ReplyAction = "http://tempuri.org/IHiveService/DeleteTaskResponse")] 1632 void DeleteTask(System.Guid taskId); 1633 1634 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/DeleteChildTasks", ReplyAction = "http://tempuri.org/IHiveService/DeleteChildTasksResponse")] 1635 void DeleteChildTasks(System.Guid parentTaskId); 1636 1637 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/UpdateTaskState", ReplyAction = "http://tempuri.org/IHiveService/UpdateTaskStateResponse")] 1638 HeuristicLab.Clients.Hive.Task UpdateTaskState(System.Guid taskId, HeuristicLab.Clients.Hive.TaskState taskState, System.Nullable<System.Guid> slaveId, System.Nullable<System.Guid> userId, string exception); 1639 1640 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/StopTask", ReplyAction = "http://tempuri.org/IHiveService/StopTaskResponse")] 1641 void StopTask(System.Guid taskId); 1642 1643 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/PauseTask", ReplyAction = "http://tempuri.org/IHiveService/PauseTaskResponse")] 1644 void PauseTask(System.Guid taskId); 1645 1646 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/RestartTask", ReplyAction = "http://tempuri.org/IHiveService/RestartTaskResponse")] 1647 void RestartTask(System.Guid taskId); 1648 1649 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetJob", ReplyAction = "http://tempuri.org/IHiveService/GetJobResponse")] 1650 HeuristicLab.Clients.Hive.Job GetJob(System.Guid id); 1651 1652 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetJobs", ReplyAction = "http://tempuri.org/IHiveService/GetJobsResponse")] 1653 System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetJobs(); 1654 1655 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetAllJobs", ReplyAction = "http://tempuri.org/IHiveService/GetAllJobsResponse")] 1656 System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetAllJobs(); 1657 1603 1658 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/AddJob", ReplyAction = "http://tempuri.org/IHiveService/AddJobResponse")] 1604 System.Guid AddJob(HeuristicLab.Clients.Hive.Task job, HeuristicLab.Clients.Hive.TaskData jobData, System.Collections.Generic.List<System.Guid> resourceIds); 1605 1606 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/AddChildJob", ReplyAction = "http://tempuri.org/IHiveService/AddChildJobResponse")] 1607 System.Guid AddChildJob(System.Guid parentJobId, HeuristicLab.Clients.Hive.Task job, HeuristicLab.Clients.Hive.TaskData jobData); 1608 1609 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetJob", ReplyAction = "http://tempuri.org/IHiveService/GetJobResponse")] 1610 HeuristicLab.Clients.Hive.Task GetJob(System.Guid jobId); 1611 1612 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetJobs", ReplyAction = "http://tempuri.org/IHiveService/GetJobsResponse")] 1613 System.Collections.Generic.List<HeuristicLab.Clients.Hive.Task> GetJobs(); 1614 1615 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetLightweightJobs", ReplyAction = "http://tempuri.org/IHiveService/GetLightweightJobsResponse")] 1616 System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightJobs(System.Collections.Generic.List<System.Guid> jobIds); 1617 1618 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetLightweightChildJobs", ReplyAction = "http://tempuri.org/IHiveService/GetLightweightChildJobsResponse")] 1619 System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightChildJobs(System.Nullable<System.Guid> parentJobId, bool recursive, bool includeParent); 1620 1621 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetLightweightExperimentJobs", ReplyAction = "http://tempuri.org/IHiveService/GetLightweightExperimentJobsResponse")] 1622 System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightExperimentJobs(System.Guid experimentId); 1623 1624 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetJobData", ReplyAction = "http://tempuri.org/IHiveService/GetJobDataResponse")] 1625 HeuristicLab.Clients.Hive.TaskData GetJobData(System.Guid jobId); 1659 System.Guid AddJob(HeuristicLab.Clients.Hive.Job jobDto); 1626 1660 1627 1661 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/UpdateJob", ReplyAction = "http://tempuri.org/IHiveService/UpdateJobResponse")] 1628 void UpdateJob(HeuristicLab.Clients.Hive.Task jobDto); 1629 1630 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/UpdateJobData", ReplyAction = "http://tempuri.org/IHiveService/UpdateJobDataResponse")] 1631 void UpdateJobData(HeuristicLab.Clients.Hive.Task jobDto, HeuristicLab.Clients.Hive.TaskData jobDataDto); 1662 void UpdateJob(HeuristicLab.Clients.Hive.Job jobDto); 1632 1663 1633 1664 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/DeleteJob", ReplyAction = "http://tempuri.org/IHiveService/DeleteJobResponse")] 1634 void DeleteJob(System.Guid jobId); 1635 1636 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/DeleteChildJobs", ReplyAction = "http://tempuri.org/IHiveService/DeleteChildJobsResponse")] 1637 void DeleteChildJobs(System.Guid parentJobId); 1638 1639 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/UpdateJobState", ReplyAction = "http://tempuri.org/IHiveService/UpdateJobStateResponse")] 1640 HeuristicLab.Clients.Hive.Task UpdateJobState(System.Guid jobId, HeuristicLab.Clients.Hive.TaskState jobState, System.Nullable<System.Guid> slaveId, System.Nullable<System.Guid> userId, string exception); 1641 1642 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/StopJob", ReplyAction = "http://tempuri.org/IHiveService/StopJobResponse")] 1643 void StopJob(System.Guid jobId); 1644 1645 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/PauseJob", ReplyAction = "http://tempuri.org/IHiveService/PauseJobResponse")] 1646 void PauseJob(System.Guid jobId); 1647 1648 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/RestartJob", ReplyAction = "http://tempuri.org/IHiveService/RestartJobResponse")] 1649 void RestartJob(System.Guid jobId); 1650 1651 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetHiveExperiment", ReplyAction = "http://tempuri.org/IHiveService/GetHiveExperimentResponse")] 1652 HeuristicLab.Clients.Hive.Job GetHiveExperiment(System.Guid id); 1653 1654 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetHiveExperiments", ReplyAction = "http://tempuri.org/IHiveService/GetHiveExperimentsResponse")] 1655 System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetHiveExperiments(); 1656 1657 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetAllHiveExperiments", ReplyAction = "http://tempuri.org/IHiveService/GetAllHiveExperimentsResponse")] 1658 System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetAllHiveExperiments(); 1659 1660 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/AddHiveExperiment", ReplyAction = "http://tempuri.org/IHiveService/AddHiveExperimentResponse")] 1661 System.Guid AddHiveExperiment(HeuristicLab.Clients.Hive.Job hiveExperimentDto); 1662 1663 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/UpdateHiveExperiment", ReplyAction = "http://tempuri.org/IHiveService/UpdateHiveExperimentResponse")] 1664 void UpdateHiveExperiment(HeuristicLab.Clients.Hive.Job hiveExperimentDto); 1665 1666 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/DeleteHiveExperiment", ReplyAction = "http://tempuri.org/IHiveService/DeleteHiveExperimentResponse")] 1667 void DeleteHiveExperiment(System.Guid hiveExperimentId); 1665 void DeleteJob(System.Guid JobId); 1668 1666 1669 1667 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GrantPermission", ReplyAction = "http://tempuri.org/IHiveService/GrantPermissionResponse")] 1670 void GrantPermission(System.Guid hiveExperimentId, System.Guid grantedUserId, HeuristicLab.Clients.Hive.Permission permission);1668 void GrantPermission(System.Guid jobId, System.Guid grantedUserId, HeuristicLab.Clients.Hive.Permission permission); 1671 1669 1672 1670 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/RevokePermission", ReplyAction = "http://tempuri.org/IHiveService/RevokePermissionResponse")] 1673 1671 void RevokePermission(System.Guid hiveExperimentId, System.Guid grantedUserId); 1674 1672 1675 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/Get HiveExperimentPermissions", ReplyAction = "http://tempuri.org/IHiveService/GetHiveExperimentPermissionsResponse")]1676 System.Collections.Generic.List<HeuristicLab.Clients.Hive.JobPermission> Get HiveExperimentPermissions(System.Guid hiveExperimentId);1673 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetJobPermissions", ReplyAction = "http://tempuri.org/IHiveService/GetJobPermissionsResponse")] 1674 System.Collections.Generic.List<HeuristicLab.Clients.Hive.JobPermission> GetJobPermissions(System.Guid jobId); 1677 1675 1678 1676 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/IsAllowedPrivileged", ReplyAction = "http://tempuri.org/IHiveService/IsAllowedPrivilegedResponse")] … … 1780 1778 } 1781 1779 1782 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Task> Get JobsByResourceId(System.Guid resourceId) {1783 return base.Channel.Get JobsByResourceId(resourceId);1780 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Task> GetTasksByResourceId(System.Guid resourceId) { 1781 return base.Channel.GetTasksByResourceId(resourceId); 1784 1782 } 1785 1783 … … 1812 1810 } 1813 1811 1814 public System.Guid AddJob(HeuristicLab.Clients.Hive.Task job, HeuristicLab.Clients.Hive.TaskData jobData, System.Collections.Generic.List<System.Guid> resourceIds) { 1815 return base.Channel.AddJob(job, jobData, resourceIds); 1816 } 1817 1818 public System.Guid AddChildJob(System.Guid parentJobId, HeuristicLab.Clients.Hive.Task job, HeuristicLab.Clients.Hive.TaskData jobData) { 1819 return base.Channel.AddChildJob(parentJobId, job, jobData); 1820 } 1821 1822 public HeuristicLab.Clients.Hive.Task GetJob(System.Guid jobId) { 1823 return base.Channel.GetJob(jobId); 1824 } 1825 1826 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Task> GetJobs() { 1812 public System.Guid AddTask(HeuristicLab.Clients.Hive.Task task, HeuristicLab.Clients.Hive.TaskData taskData, System.Collections.Generic.List<System.Guid> resourceIds) { 1813 return base.Channel.AddTask(task, taskData, resourceIds); 1814 } 1815 1816 public System.Guid AddChildTask(System.Guid parentTaskId, HeuristicLab.Clients.Hive.Task task, HeuristicLab.Clients.Hive.TaskData taskData) { 1817 return base.Channel.AddChildTask(parentTaskId, task, taskData); 1818 } 1819 1820 public HeuristicLab.Clients.Hive.Task GetTask(System.Guid taskId) { 1821 return base.Channel.GetTask(taskId); 1822 } 1823 1824 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Task> GetTasks() { 1825 return base.Channel.GetTasks(); 1826 } 1827 1828 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightTasks(System.Collections.Generic.List<System.Guid> taskIds) { 1829 return base.Channel.GetLightweightTasks(taskIds); 1830 } 1831 1832 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightChildTasks(System.Nullable<System.Guid> parentTaskId, bool recursive, bool includeParent) { 1833 return base.Channel.GetLightweightChildTasks(parentTaskId, recursive, includeParent); 1834 } 1835 1836 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightJobTasks(System.Guid jobId) { 1837 return base.Channel.GetLightweightJobTasks(jobId); 1838 } 1839 1840 public HeuristicLab.Clients.Hive.TaskData GetTaskData(System.Guid taskId) { 1841 return base.Channel.GetTaskData(taskId); 1842 } 1843 1844 public void UpdateTask(HeuristicLab.Clients.Hive.Task taskDto) { 1845 base.Channel.UpdateTask(taskDto); 1846 } 1847 1848 public void UpdateTaskData(HeuristicLab.Clients.Hive.Task taskDto, HeuristicLab.Clients.Hive.TaskData taskDataDto) { 1849 base.Channel.UpdateTaskData(taskDto, taskDataDto); 1850 } 1851 1852 public void DeleteTask(System.Guid taskId) { 1853 base.Channel.DeleteTask(taskId); 1854 } 1855 1856 public void DeleteChildTasks(System.Guid parentTaskId) { 1857 base.Channel.DeleteChildTasks(parentTaskId); 1858 } 1859 1860 public HeuristicLab.Clients.Hive.Task UpdateTaskState(System.Guid taskId, HeuristicLab.Clients.Hive.TaskState taskState, System.Nullable<System.Guid> slaveId, System.Nullable<System.Guid> userId, string exception) { 1861 return base.Channel.UpdateTaskState(taskId, taskState, slaveId, userId, exception); 1862 } 1863 1864 public void StopTask(System.Guid taskId) { 1865 base.Channel.StopTask(taskId); 1866 } 1867 1868 public void PauseTask(System.Guid taskId) { 1869 base.Channel.PauseTask(taskId); 1870 } 1871 1872 public void RestartTask(System.Guid taskId) { 1873 base.Channel.RestartTask(taskId); 1874 } 1875 1876 public HeuristicLab.Clients.Hive.Job GetJob(System.Guid id) { 1877 return base.Channel.GetJob(id); 1878 } 1879 1880 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetJobs() { 1827 1881 return base.Channel.GetJobs(); 1828 1882 } 1829 1883 1830 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightJobs(System.Collections.Generic.List<System.Guid> jobIds) { 1831 return base.Channel.GetLightweightJobs(jobIds); 1832 } 1833 1834 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightChildJobs(System.Nullable<System.Guid> parentJobId, bool recursive, bool includeParent) { 1835 return base.Channel.GetLightweightChildJobs(parentJobId, recursive, includeParent); 1836 } 1837 1838 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightExperimentJobs(System.Guid experimentId) { 1839 return base.Channel.GetLightweightExperimentJobs(experimentId); 1840 } 1841 1842 public HeuristicLab.Clients.Hive.TaskData GetJobData(System.Guid jobId) { 1843 return base.Channel.GetJobData(jobId); 1844 } 1845 1846 public void UpdateJob(HeuristicLab.Clients.Hive.Task jobDto) { 1884 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetAllJobs() { 1885 return base.Channel.GetAllJobs(); 1886 } 1887 1888 public System.Guid AddJob(HeuristicLab.Clients.Hive.Job jobDto) { 1889 return base.Channel.AddJob(jobDto); 1890 } 1891 1892 public void UpdateJob(HeuristicLab.Clients.Hive.Job jobDto) { 1847 1893 base.Channel.UpdateJob(jobDto); 1848 1894 } 1849 1895 1850 public void UpdateJobData(HeuristicLab.Clients.Hive.Task jobDto, HeuristicLab.Clients.Hive.TaskData jobDataDto) { 1851 base.Channel.UpdateJobData(jobDto, jobDataDto); 1852 } 1853 1854 public void DeleteJob(System.Guid jobId) { 1855 base.Channel.DeleteJob(jobId); 1856 } 1857 1858 public void DeleteChildJobs(System.Guid parentJobId) { 1859 base.Channel.DeleteChildJobs(parentJobId); 1860 } 1861 1862 public HeuristicLab.Clients.Hive.Task UpdateJobState(System.Guid jobId, HeuristicLab.Clients.Hive.TaskState jobState, System.Nullable<System.Guid> slaveId, System.Nullable<System.Guid> userId, string exception) { 1863 return base.Channel.UpdateJobState(jobId, jobState, slaveId, userId, exception); 1864 } 1865 1866 public void StopJob(System.Guid jobId) { 1867 base.Channel.StopJob(jobId); 1868 } 1869 1870 public void PauseJob(System.Guid jobId) { 1871 base.Channel.PauseJob(jobId); 1872 } 1873 1874 public void RestartJob(System.Guid jobId) { 1875 base.Channel.RestartJob(jobId); 1876 } 1877 1878 public HeuristicLab.Clients.Hive.Job GetHiveExperiment(System.Guid id) { 1879 return base.Channel.GetHiveExperiment(id); 1880 } 1881 1882 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetHiveExperiments() { 1883 return base.Channel.GetHiveExperiments(); 1884 } 1885 1886 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetAllHiveExperiments() { 1887 return base.Channel.GetAllHiveExperiments(); 1888 } 1889 1890 public System.Guid AddHiveExperiment(HeuristicLab.Clients.Hive.Job hiveExperimentDto) { 1891 return base.Channel.AddHiveExperiment(hiveExperimentDto); 1892 } 1893 1894 public void UpdateHiveExperiment(HeuristicLab.Clients.Hive.Job hiveExperimentDto) { 1895 base.Channel.UpdateHiveExperiment(hiveExperimentDto); 1896 } 1897 1898 public void DeleteHiveExperiment(System.Guid hiveExperimentId) { 1899 base.Channel.DeleteHiveExperiment(hiveExperimentId); 1900 } 1901 1902 public void GrantPermission(System.Guid hiveExperimentId, System.Guid grantedUserId, HeuristicLab.Clients.Hive.Permission permission) { 1903 base.Channel.GrantPermission(hiveExperimentId, grantedUserId, permission); 1896 public void DeleteJob(System.Guid JobId) { 1897 base.Channel.DeleteJob(JobId); 1898 } 1899 1900 public void GrantPermission(System.Guid jobId, System.Guid grantedUserId, HeuristicLab.Clients.Hive.Permission permission) { 1901 base.Channel.GrantPermission(jobId, grantedUserId, permission); 1904 1902 } 1905 1903 … … 1908 1906 } 1909 1907 1910 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.JobPermission> Get HiveExperimentPermissions(System.Guid hiveExperimentId) {1911 return base.Channel.Get HiveExperimentPermissions(hiveExperimentId);1908 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.JobPermission> GetJobPermissions(System.Guid jobId) { 1909 return base.Channel.GetJobPermissions(jobId); 1912 1910 } 1913 1911 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/ServiceClients/LightweightTask.cs
r6721 r6743 42 42 this.State = job.State; 43 43 this.Command = job.Command; 44 this.Last JobDataUpdate = job.LastJobDataUpdate;44 this.LastTaskDataUpdate = job.LastTaskDataUpdate; 45 45 } 46 46 … … 52 52 this.State = original.State; 53 53 this.Command = original.Command; 54 this.Last JobDataUpdate = original.LastJobDataUpdate;54 this.LastTaskDataUpdate = original.LastTaskDataUpdate; 55 55 } 56 56 public override IDeepCloneable Clone(Cloner cloner) { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/TaskDownloader.cs
r6725 r6743 72 72 73 73 public void StartAsync() { 74 foreach (Guid jobId in taskIds) {75 Task job = ServiceLocator.Instance.CallHiveService(s => s.GetJob(jobId));74 foreach (Guid taskId in taskIds) { 75 Task task = ServiceLocator.Instance.CallHiveService(s => s.GetTask(taskId)); 76 76 77 taskDownloader.Download Job(job,77 taskDownloader.DownloadTask(task, 78 78 (localJob, itemJob) => { 79 79 if (localJob != null && itemJob != null) { 80 HiveTask hive Job;80 HiveTask hiveTask; 81 81 if (itemJob is OptimizerTask) { 82 hive Job= new OptimizerHiveTask((OptimizerTask)itemJob);82 hiveTask = new OptimizerHiveTask((OptimizerTask)itemJob); 83 83 } else { 84 hive Job= new HiveTask(itemJob, true);84 hiveTask = new HiveTask(itemJob, true); 85 85 } 86 hive Job.Task = localJob;87 this.results.Add(localJob.Id, hive Job);86 hiveTask.Task = localJob; 87 this.results.Add(localJob.Id, hiveTask); 88 88 } 89 89 }); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Hive/3.3/HeuristicLab.Hive-3.3.csproj
r6725 r6743 77 77 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Core-3.3.dll</HintPath> 78 78 </Reference> 79 <Reference Include="HeuristicLab.Persistence-3.3">80 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Persistence-3.3.dll</HintPath>81 </Reference>82 79 <Reference Include="HeuristicLab.PluginInfrastructure-3.3"> 83 80 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Hive/3.3/HeuristicLabHivePlugin.cs.frame
r6701 r6743 9 9 [PluginFile("HeuristicLab.Hive-3.3.dll", PluginFileType.Assembly)] 10 10 [PluginDependency("HeuristicLab.Common", "3.3")] 11 [PluginDependency("HeuristicLab.Core", "3.3")] 12 [PluginDependency("HeuristicLab.Persistence", "3.3")] 11 [PluginDependency("HeuristicLab.Core", "3.3")] 13 12 public class HeuristicLabHivePlugin : PluginBase { 14 13 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.3/HiveEngine.cs
r6725 r6743 252 252 var engineHiveJob = new EngineHiveTask(jobs[i], parentScopeClone); 253 253 engineHiveJob.Task.Priority = this.Priority; 254 refreshableJob.Hive Jobs.Add(engineHiveJob);254 refreshableJob.HiveTasks.Add(engineHiveJob); 255 255 256 256 // shuffle random variable to avoid the same random sequence in each operation; todo: does not yet work (it cannot find the random variable) … … 259 259 random.Reset(random.Next()); 260 260 } 261 HiveClient.Start Experiment((e) => { log.LogException(e); }, refreshableJob, cancellationToken);261 HiveClient.StartJob((e) => { log.LogException(e); }, refreshableJob, cancellationToken); 262 262 263 263 // do polling until experiment is finished and all jobs are downloaded … … 269 269 log.LogMessage(string.Format("{0} finished (TotalExecutionTime: {1}).", refreshableJob.ToString(), refreshableJob.ExecutionTime)); 270 270 271 var failedJobs = refreshableJob.Hive Jobs.Where(x => x.Task.State == TaskState.Failed);271 var failedJobs = refreshableJob.HiveTasks.Where(x => x.Task.State == TaskState.Failed); 272 272 if (failedJobs.Count() > 0) { 273 273 throw new HiveEngineException("Task failed: " + failedJobs.First().Task.StateLog.Last().Exception); … … 276 276 // get scopes 277 277 int j = 0; 278 foreach (var hiveJob in refreshableJob.Hive Jobs) {278 foreach (var hiveJob in refreshableJob.HiveTasks) { 279 279 var scope = ((IAtomicOperation)((EngineTask)hiveJob.ItemTask).InitialOperation).Scope; 280 280 scopes[j++] = scope; … … 315 315 316 316 private void ClearData(RefreshableJob refreshableJob) { 317 var jobs = refreshableJob.GetAllHive Jobs();317 var jobs = refreshableJob.GetAllHiveTasks(); 318 318 foreach (var job in jobs) { 319 319 job.ClearData(); … … 321 321 } 322 322 323 private void DeleteHiveExperiment(Guid hiveExperimentId) {323 private void DeleteHiveExperiment(Guid jobId) { 324 324 HiveClient.TryAndRepeat(() => { 325 ServiceLocator.Instance.CallHiveService(s => s.Delete HiveExperiment(hiveExperimentId));325 ServiceLocator.Instance.CallHiveService(s => s.DeleteJob(jobId)); 326 326 }, 5, string.Format("Could not delete jobs")); 327 327 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.3/HeuristicLab.Services.Hive.DataAccess-3.3.csproj
r6721 r6743 71 71 </PropertyGroup> 72 72 <ItemGroup> 73 <Reference Include="HeuristicLab.Common-3.3">74 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Common-3.3.dll</HintPath>75 </Reference>76 <Reference Include="HeuristicLab.Core-3.3">77 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Core-3.3.dll</HintPath>78 </Reference>79 <Reference Include="HeuristicLab.Persistence-3.3">80 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Persistence-3.3.dll</HintPath>81 </Reference>82 73 <Reference Include="HeuristicLab.PluginInfrastructure-3.3"> 83 74 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.3/HeuristicLabServicesHiveDataAccessPlugin.cs.frame
r6717 r6743 28 28 namespace HeuristicLab.Services.Hive.DataAccess { 29 29 [Plugin("HeuristicLab.Services.Hive.DataAccess", "3.3.5.$WCREV$")] 30 [PluginFile("HeuristicLab.Services.Hive.DataAccess-3.3.dll", PluginFileType.Assembly)] 31 [PluginDependency("HeuristicLab.Common", "3.3")] 32 [PluginDependency("HeuristicLab.Core", "3.3")] 33 [PluginDependency("HeuristicLab.Persistence", "3.3")] 30 [PluginFile("HeuristicLab.Services.Hive.DataAccess-3.3.dll", PluginFileType.Assembly)] 34 31 public class HeuristicLabServicesHiveDataAccessPlugin : PluginBase { 35 32 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.3/Logger.cs
r6717 r6743 28 28 public class LogFactory { 29 29 public static ILogger GetLogger(string source) { 30 return new Logger( "HL.Hive", source);30 return new Logger(Settings.Default.EventLogName, source); 31 31 } 32 32 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.3/Settings.Designer.cs
r6717 r6743 43 43 } 44 44 } 45 46 [global::System.Configuration.ApplicationScopedSettingAttribute()] 47 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 48 [global::System.Configuration.DefaultSettingValueAttribute("HL.Hive")] 49 public string EventLogName { 50 get { 51 return ((string)(this["EventLogName"])); 52 } 53 } 45 54 } 46 55 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.3/Settings.settings
r6712 r6743 14 14 <Value Profile="(Default)">00:05:00</Value> 15 15 </Setting> 16 <Setting Name="EventLogName" Type="System.String" Scope="Application"> 17 <Value Profile="(Default)">HL.Hive</Value> 18 </Setting> 16 19 </Settings> 17 20 </SettingsFile> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.3/app.config
r6712 r6743 6 6 </sectionGroup> 7 7 </configSections> 8 <connectionStrings> 8 <connectionStrings> 9 9 <add name="HeuristicLab.Services.Hive.DataAccess.Settings.HeuristicLab_Hive_LinqConnectionString" 10 10 connectionString="Data Source=localhost;Initial Catalog=HeuristicLab.Hive-3.3;Integrated Security=True;" … … 16 16 <value>00:05:00</value> 17 17 </setting> 18 <setting name="EventLogName" serializeAs="String"> 19 <value>HL.Hive</value> 20 </setting> 18 21 </HeuristicLab.Services.Hive.DataAccess.Settings> 19 22 </applicationSettings> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/DaoTests.cs
r6723 r6743 49 49 he.OwnerUserId = Guid.NewGuid(); 50 50 he.ResourceNames = "HEAL"; 51 he.Id = dao.Add HiveExperiment(he);51 he.Id = dao.AddJob(he); 52 52 53 53 DT.Task job1 = new DT.Task(); … … 80 80 job1.PluginsNeededIds.Add(plugin1.Id); 81 81 82 job1.Id = dao.Add Job(job1);82 job1.Id = dao.AddTask(job1); 83 83 jobData1.TaskId = job1.Id; 84 dao.Add JobData(jobData1);85 86 DT.Task job1loaded = dao.Get Job(job1.Id);84 dao.AddTaskData(jobData1); 85 86 DT.Task job1loaded = dao.GetTask(job1.Id); 87 87 Assert.AreEqual(job1.Id, job1loaded.Id); 88 88 Assert.AreEqual(job1.CoresNeeded, job1loaded.CoresNeeded); … … 94 94 Assert.AreEqual(job1.JobId, job1loaded.JobId); 95 95 Assert.AreEqual(job1.IsPrivileged, job1loaded.IsPrivileged); 96 Assert.IsTrue(Math.Abs((job1loaded.Last JobDataUpdate - jobData1.LastUpdate).TotalSeconds) < 1);96 Assert.IsTrue(Math.Abs((job1loaded.LastTaskDataUpdate - jobData1.LastUpdate).TotalSeconds) < 1); 97 97 for (int i = 0; i < job1.StateLog.Count; i++) { 98 98 Assert.AreEqual(job1.Id, job1loaded.StateLog[i].TaskId); … … 111 111 job1.StateLog.Add(new DT.StateLog { State = DT.TaskState.Transferring, DateTime = DateTime.Now }); Thread.Sleep(10); 112 112 job1.StateLog.Add(new DT.StateLog { State = DT.TaskState.Finished, DateTime = DateTime.Now }); Thread.Sleep(10); 113 dao.Update Job(job1);114 115 job1loaded = dao.Get Job(job1.Id);113 dao.UpdateTask(job1); 114 115 job1loaded = dao.GetTask(job1.Id); 116 116 for (int i = 0; i < job1.StateLog.Count; i++) { 117 117 Assert.AreEqual(job1.Id, job1loaded.StateLog[i].TaskId); … … 123 123 } 124 124 125 DT.TaskData jobData1Loaded = dao.Get JobData(job1.Id);125 DT.TaskData jobData1Loaded = dao.GetTaskData(job1.Id); 126 126 Assert.AreEqual(jobData1.TaskId, jobData1Loaded.TaskId); 127 127 Assert.IsTrue(Math.Abs((jobData1.LastUpdate - jobData1Loaded.LastUpdate).TotalSeconds) < 1); 128 128 Assert.IsTrue(jobData1.Data.SequenceEqual(jobData1Loaded.Data)); 129 129 130 dao.Delete HiveExperiment(he.Id);131 132 Assert.AreEqual(null, dao.Get Job(job1.Id));133 Assert.AreEqual(null, dao.Get JobData(job1.Id));134 Assert.AreEqual(null, dao.Get HiveExperiment(he.Id));130 dao.DeleteJob(he.Id); 131 132 Assert.AreEqual(null, dao.GetTask(job1.Id)); 133 Assert.AreEqual(null, dao.GetTaskData(job1.Id)); 134 Assert.AreEqual(null, dao.GetJob(he.Id)); 135 135 136 136 dao.DeletePlugin(plugin1.Id); … … 220 220 he.OwnerUserId = Guid.NewGuid(); 221 221 he.ResourceNames = "HEAL"; 222 he.Id = dao.Add HiveExperiment(he);222 he.Id = dao.AddJob(he); 223 223 224 224 DT.Task job = new DT.Task(); … … 226 226 job.StateLog.Add(new DT.StateLog { State = DT.TaskState.Offline, DateTime = DateTime.Now }); 227 227 job.JobId = he.Id; 228 job.Id = dao.Add Job(job);228 job.Id = dao.AddTask(job); 229 229 230 230 DT.JobPermission perm = new DT.JobPermission(); … … 233 233 perm.GrantedUserId = Guid.NewGuid(); 234 234 perm.Permission = DT.Permission.Full; 235 dao.Add HiveExperimentPermission(perm);236 237 DT.Job heLoaded = dao.Get HiveExperiment(he.Id);235 dao.AddJobPermission(perm); 236 237 DT.Job heLoaded = dao.GetJob(he.Id); 238 238 Assert.AreEqual(he.Id, heLoaded.Id); 239 239 Assert.AreEqual(he.Name, heLoaded.Name); 240 240 Assert.AreEqual(he.ResourceNames, heLoaded.ResourceNames); 241 //Assert.AreEqual( he.LastAccessed, heLoaded.LastAccessed);242 //Assert.AreEqual( he.DateCreated, heLoaded.DateCreated);243 244 DT.Task jobLoaded = dao.Get Job(job.Id);241 //Assert.AreEqual(job.LastAccessed, heLoaded.LastAccessed); 242 //Assert.AreEqual(job.DateCreated, heLoaded.DateCreated); 243 244 DT.Task jobLoaded = dao.GetTask(job.Id); 245 245 Assert.AreEqual(job.Id, jobLoaded.Id); 246 246 Assert.AreEqual(job.State, jobLoaded.State); 247 247 Assert.AreEqual(job.JobId, jobLoaded.JobId); 248 248 249 DT.JobPermission permLoaded = dao.Get HiveExperimentPermission(he.Id, perm.GrantedUserId);249 DT.JobPermission permLoaded = dao.GetJobPermission(he.Id, perm.GrantedUserId); 250 250 Assert.AreEqual(perm.JobId, permLoaded.JobId); 251 251 Assert.AreEqual(perm.GrantedUserId, permLoaded.GrantedUserId); … … 253 253 Assert.AreEqual(perm.Permission, permLoaded.Permission); 254 254 255 dao.Delete HiveExperiment(he.Id);256 Assert.AreEqual(null, dao.Get HiveExperiment(he.Id));257 Assert.AreEqual(null, dao.Get Job(job.Id));258 Assert.AreEqual(null, dao.Get HiveExperimentPermission(perm.JobId, perm.GrantedUserId));255 dao.DeleteJob(he.Id); 256 Assert.AreEqual(null, dao.GetJob(he.Id)); 257 Assert.AreEqual(null, dao.GetTask(job.Id)); 258 Assert.AreEqual(null, dao.GetJobPermission(perm.JobId, perm.GrantedUserId)); 259 259 260 260 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/HeuristicLab.Services.Hive.Tests-3.3.csproj
r6717 r6743 85 85 <SubType>Designer</SubType> 86 86 </None> 87 <Shadow Include="Test References\HeuristicLab.Services.Hive-3. 4.accessor" />87 <Shadow Include="Test References\HeuristicLab.Services.Hive-3.3.accessor" /> 88 88 </ItemGroup> 89 89 <ItemGroup /> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/Mocks/MockAuthorizationManager.cs
r6717 r6743 28 28 } 29 29 30 public void AuthorizeFor Job(Guid jobId, DataTransfer.Permission requiredPermission) {30 public void AuthorizeForTask(Guid jobId, DataTransfer.Permission requiredPermission) { 31 31 // ok. 32 32 } 33 33 34 public void AuthorizeFor Experiment(Guid experimentId, DataTransfer.Permission requiredPermission) {34 public void AuthorizeForJob(Guid experimentId, DataTransfer.Permission requiredPermission) { 35 35 // ok. 36 36 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/ServiceTests.cs
r6725 r6743 98 98 99 99 // add hive experiment 100 experiment.Id = service.Add HiveExperiment(experiment);100 experiment.Id = service.AddJob(experiment); 101 101 102 102 // add task 103 103 job.JobId = experiment.Id; 104 job.Id = service.Add Job(job, jobData, new List<Guid> { slave.Id });104 job.Id = service.AddTask(job, jobData, new List<Guid> { slave.Id }); 105 105 106 106 // test task 107 DT.Task jobLoaded = service.Get Job(job.Id);107 DT.Task jobLoaded = service.GetTask(job.Id); 108 108 Assert.AreEqual(job.Id, jobLoaded.Id); 109 109 Assert.AreEqual(job.CoresNeeded, jobLoaded.CoresNeeded); … … 114 114 Assert.AreEqual(job.JobId, jobLoaded.JobId); 115 115 116 DT.TaskData jobDataLoaded = service.Get JobData(job.Id);116 DT.TaskData jobDataLoaded = service.GetTaskData(job.Id); 117 117 Assert.AreEqual(job.Id, jobDataLoaded.TaskId); 118 118 Assert.IsTrue(jobData.Data.SequenceEqual(jobDataLoaded.Data)); 119 119 120 120 // test hive experiment 121 DT.Job experimentLoaded = service.Get HiveExperiment(experiment.Id);121 DT.Job experimentLoaded = service.GetJob(experiment.Id); 122 122 Assert.AreEqual(experiment.Id, experimentLoaded.Id); 123 123 Assert.AreEqual(experiment.Name, experimentLoaded.Name); … … 130 130 Assert.AreEqual(job.Id, actions[0].TaskId); 131 131 132 jobLoaded = service.Get Job(job.Id);132 jobLoaded = service.GetTask(job.Id); 133 133 Assert.AreEqual(TaskState.Transferring, jobLoaded.State); 134 134 135 135 // slave is responsible for updating state to 'Calculating' 136 service.Update JobState(jobLoaded.Id, DT.TaskState.Calculating, slave.Id, null, null);136 service.UpdateTaskState(jobLoaded.Id, DT.TaskState.Calculating, slave.Id, null, null); 137 137 138 138 // send progress … … 143 143 144 144 // the task should be in state 'Calculating' now 145 jobLoaded = service.Get Job(job.Id);145 jobLoaded = service.GetTask(job.Id); 146 146 Assert.AreEqual(TaskState.Calculating, jobLoaded.State); 147 147 Assert.AreEqual(new TimeSpan(1, 5, 10, 20, 30), jobLoaded.ExecutionTime); 148 148 149 149 // test if the task is returned for the resource 150 var jobsBySlave = service.Get JobsByResourceId(slave.Id);150 var jobsBySlave = service.GetTasksByResourceId(slave.Id); 151 151 Assert.AreEqual(1, jobsBySlave.Count()); 152 152 Assert.AreEqual(job.Id, jobsBySlave.Single().Id); 153 153 154 154 // set it to finished 155 service.Update JobState(jobLoaded.Id, DT.TaskState.Finished, slave.Id, null, null);155 service.UpdateTaskState(jobLoaded.Id, DT.TaskState.Finished, slave.Id, null, null); 156 156 157 157 // test if the task is returned for the resource (it should not be) 158 var jobsBySlave2 = service.Get JobsByResourceId(slave.Id);158 var jobsBySlave2 = service.GetTasksByResourceId(slave.Id); 159 159 Assert.AreEqual(0, jobsBySlave2.Count()); 160 160 161 161 // set task waiting again 162 service.Update JobState(job.Id, DT.TaskState.Waiting, null, null, string.Empty);162 service.UpdateTaskState(job.Id, DT.TaskState.Waiting, null, null, string.Empty); 163 163 164 164 // get task again … … 181 181 182 182 // delete 183 service.Delete HiveExperiment(experiment.Id);184 Assert.AreEqual(null, service.Get HiveExperiment(experiment.Id));185 Assert.AreEqual(null, service.Get Job(job.Id));186 Assert.AreEqual(null, service.Get JobData(job.Id));183 service.DeleteJob(experiment.Id); 184 Assert.AreEqual(null, service.GetJob(experiment.Id)); 185 Assert.AreEqual(null, service.GetTask(job.Id)); 186 Assert.AreEqual(null, service.GetTaskData(job.Id)); 187 187 188 188 // send another heartbeat with the deleted task; the server should command the abortion of the task … … 241 241 242 242 // add hive experiment 243 experiment.Id = service.Add HiveExperiment(experiment);243 experiment.Id = service.AddJob(experiment); 244 244 245 245 // add parent task 246 246 parentJob.JobId = experiment.Id; 247 parentJob.Id = service.Add Job(parentJob, parentJobData, new List<Guid> { slave.Id });247 parentJob.Id = service.AddTask(parentJob, parentJobData, new List<Guid> { slave.Id }); 248 248 249 249 // add child task 250 250 childJob.JobId = experiment.Id; 251 childJob.Id = service.AddChild Job(parentJob.Id, childJob, childJobData);251 childJob.Id = service.AddChildTask(parentJob.Id, childJob, childJobData); 252 252 childJob.ParentTaskId = parentJob.Id; 253 253 254 254 // test child task 255 var childJobLoaded = service.Get Job(childJob.Id);255 var childJobLoaded = service.GetTask(childJob.Id); 256 256 Assert.AreEqual(childJob.ParentTaskId, childJobLoaded.ParentTaskId); 257 257 Assert.AreEqual(childJob.JobId, childJobLoaded.JobId); … … 261 261 262 262 // test parent task 263 var parentJobLoaded = service.Get Job(parentJob.Id);263 var parentJobLoaded = service.GetTask(parentJob.Id); 264 264 Assert.AreEqual(parentJob.JobId, parentJobLoaded.JobId); 265 265 Assert.AreEqual(TaskState.Waiting, parentJobLoaded.State); … … 276 276 service.TriggerEventManager(true); 277 277 278 parentJobLoaded = service.Get Job(parentJob.Id);278 parentJobLoaded = service.GetTask(parentJob.Id); 279 279 Assert.AreEqual(TaskState.Waiting, parentJobLoaded.State); 280 280 281 281 // set child task to finished 282 childJobLoaded = service.Update JobState(childJobLoaded.Id, DT.TaskState.Finished, slave.Id, null, null);282 childJobLoaded = service.UpdateTaskState(childJobLoaded.Id, DT.TaskState.Finished, slave.Id, null, null); 283 283 284 284 // lifecycle - let it process one server-heartbeat; this should set the parent task to finished … … 286 286 287 287 // test if parent task is finished 288 parentJobLoaded = service.Get Job(parentJob.Id);288 parentJobLoaded = service.GetTask(parentJob.Id); 289 289 Assert.AreEqual(TaskState.Finished, parentJobLoaded.State); 290 290 291 291 // delete experiment 292 service.Delete HiveExperiment(experiment.Id);293 Assert.AreEqual(null, service.Get Job(parentJob.Id));294 Assert.AreEqual(null, service.Get Job(childJob.Id));292 service.DeleteJob(experiment.Id); 293 Assert.AreEqual(null, service.GetTask(parentJob.Id)); 294 Assert.AreEqual(null, service.GetTask(childJob.Id)); 295 295 296 296 service.DeleteSlave(slave.Id); … … 305 305 // create hive experiment 306 306 DT.Job e1 = new DT.Job() { Name = "TestExperiment", Description = "" }; 307 e1.Id = service.Add HiveExperiment(e1);308 309 var e1loaded = service.Get HiveExperiment(e1.Id);307 e1.Id = service.AddJob(e1); 308 309 var e1loaded = service.GetJob(e1.Id); 310 310 Assert.AreEqual(Permission.Full, e1loaded.Permission); 311 var allExp = service.Get HiveExperiments();311 var allExp = service.GetJobs(); 312 312 Assert.AreEqual(1, allExp.Count(x => x.Id == e1.Id)); 313 313 … … 315 315 mockServiceLocator.SetCurrentUserId(MockUserManager.MockUserId2); 316 316 try { 317 e1loaded = service.Get HiveExperiment(e1.Id);317 e1loaded = service.GetJob(e1.Id); 318 318 Assert.Fail("Access should not be possible"); 319 319 } 320 320 catch { /* ok, cool */ } 321 allExp = service.Get HiveExperiments();321 allExp = service.GetJobs(); 322 322 Assert.AreEqual(0, allExp.Count(x => x.Id == e1.Id)); 323 323 … … 335 335 // back to user2 336 336 mockServiceLocator.SetCurrentUserId(MockUserManager.MockUserId2); 337 e1loaded = service.Get HiveExperiment(e1.Id);337 e1loaded = service.GetJob(e1.Id); 338 338 Assert.AreEqual(Permission.Read, e1loaded.Permission); 339 allExp = service.Get HiveExperiments();339 allExp = service.GetJobs(); 340 340 Assert.AreEqual(1, allExp.Count(x => x.Id == e1.Id)); 341 341 … … 353 353 // back to user2 354 354 mockServiceLocator.SetCurrentUserId(MockUserManager.MockUserId2); 355 e1loaded = service.Get HiveExperiment(e1.Id);355 e1loaded = service.GetJob(e1.Id); 356 356 Assert.AreEqual(Permission.Full, e1loaded.Permission); 357 allExp = service.Get HiveExperiments();357 allExp = service.GetJobs(); 358 358 Assert.AreEqual(1, allExp.Count(x => x.Id == e1.Id)); 359 359 … … 368 368 mockServiceLocator.SetCurrentUserId(MockUserManager.MockUserId2); 369 369 try { 370 e1loaded = service.Get HiveExperiment(e1.Id);370 e1loaded = service.GetJob(e1.Id); 371 371 Assert.Fail("Access should not be possible"); 372 372 } 373 373 catch { /* ok, cool */ } 374 allExp = service.Get HiveExperiments();374 allExp = service.GetJobs(); 375 375 Assert.AreEqual(0, allExp.Count(x => x.Id == e1.Id)); 376 376 377 377 // back to user1 378 378 mockServiceLocator.SetCurrentUserId(MockUserManager.MockUserId1); 379 service.Delete HiveExperiment(e1.Id);379 service.DeleteJob(e1.Id); 380 380 } 381 381 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Web/Hive-3.4/Status.aspx.cs
r6721 r6743 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.Collections.Generic; 3 24 using System.Linq; … … 32 53 int currentlyAvailableCores = onlineSlaves.Sum(s => s.Cores.Value); 33 54 int currentlyUsedCores = currentlyAvailableCores - onlineSlaves.Sum(s => s.FreeCores.Value); 34 int currentlyJobsWaiting = ServiceLocator.Instance.HiveDao.Get Jobs(x => x.State == DA.TaskState.Waiting).Count();55 int currentlyJobsWaiting = ServiceLocator.Instance.HiveDao.GetTasks(x => x.State == DA.TaskState.Waiting).Count(); 35 56 36 57 this.availableCoresLabel.Text = currentlyAvailableCores.ToString(); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/Convert.cs
r6725 r6743 27 27 using DT = HeuristicLab.Services.Hive.DataTransfer; 28 28 29 30 29 namespace HeuristicLab.Services.Hive.DataTransfer { 31 30 public static class Convert { 32 #region Job31 #region Task 33 32 public static DT.Task ToDto(DB.Task source) { 34 33 if (source == null) return null; … … 47 46 FinishWhenChildJobsFinished = source.FinishWhenChildJobsFinished, 48 47 Command = Convert.ToDto(source.Command), 49 Last JobDataUpdate = (source.JobData == null ? DateTime.MinValue : source.JobData.LastUpdate),48 LastTaskDataUpdate = (source.JobData == null ? DateTime.MinValue : source.JobData.LastUpdate), 50 49 JobId = source.JobId, 51 50 IsPrivileged = source.IsPrivileged … … 150 149 #endregion 151 150 152 #region HiveExperimentPermission151 #region JobPermission 153 152 public static DT.JobPermission ToDto(DB.JobPermission source) { 154 153 if (source == null) return null; … … 363 362 } 364 363 #endregion 365 366 364 367 365 #region TaskData … … 433 431 #endregion 434 432 435 436 433 #region Command 437 434 public static DT.Command? ToDto(DB.Command? source) { … … 462 459 return null; 463 460 } 464 465 461 #endregion 466 462 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/DataTransfer/Heartbeat.cs
r6717 r6743 35 35 public int FreeCores { get; set; } 36 36 [DataMember] 37 public Dictionary<Guid, TimeSpan> JobProgress { get; set; } // TODO: define Type37 public Dictionary<Guid, TimeSpan> JobProgress { get; set; } 38 38 [DataMember] 39 public bool AssignJob { get; set; } // if false, the server will not assign a new job39 public bool AssignJob { get; set; } // if false, the server will not assign a new task 40 40 [DataMember] 41 41 public float CpuUtilization { get; set; } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/DataTransfer/LightweightTask.cs
r6721 r6743 40 40 public Command? Command { get; set; } 41 41 [DataMember] 42 public DateTime Last JobDataUpdate { get; set; }42 public DateTime LastTaskDataUpdate { get; set; } 43 43 44 44 public StateLog CurrentStateLog { get { return StateLog.LastOrDefault(); } } … … 50 50 } 51 51 52 public LightweightTask(Task job) {53 this.Id = job.Id;54 this.ExecutionTime = job.ExecutionTime;55 this.ParentTaskId = job.ParentTaskId;56 this.StateLog = new List<StateLog>( job.StateLog);57 this.State = job.State;58 this.Command = job.Command;59 this.Last JobDataUpdate = job.LastJobDataUpdate;52 public LightweightTask(Task task) { 53 this.Id = task.Id; 54 this.ExecutionTime = task.ExecutionTime; 55 this.ParentTaskId = task.ParentTaskId; 56 this.StateLog = new List<StateLog>(task.StateLog); 57 this.State = task.State; 58 this.Command = task.Command; 59 this.LastTaskDataUpdate = task.LastTaskDataUpdate; 60 60 } 61 61 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/DataTransfer/Permission.cs
r6717 r6743 28 28 29 29 /// <summary> 30 /// User can only download and view experiments30 /// User can only download and view jobs 31 31 /// </summary> 32 32 Read, 33 33 34 34 /// <summary> 35 /// User can pause, stop, restart, delete experiment. can also grant other35 /// User can pause, stop, restart, delete job. can also grant other 36 36 /// </summary> 37 37 Full -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/DataTransfer/TaskState.cs
r6721 r6743 26 26 public enum TaskState { 27 27 /// <summary> 28 /// A task is offline as long as heis not yet submitted to the hive28 /// A task is offline as long as job is not yet submitted to the hive 29 29 /// </summary> 30 30 Offline, … … 68 68 public static class TaskStateExtensions { 69 69 /// <summary> 70 /// This jobis not yet done70 /// This task is not yet done 71 71 /// </summary> 72 72 public static bool IsActive(this TaskState taskState) { … … 75 75 76 76 /// <summary> 77 /// This jobis Waiting77 /// This task is Waiting 78 78 /// </summary> 79 79 public static bool IsWaiting(this TaskState taskState) { … … 82 82 83 83 /// <summary> 84 /// This jobis Finished || Failed || Aborted84 /// This task is Finished || Failed || Aborted 85 85 /// </summary> 86 86 public static bool IsDone(this TaskState taskState) { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/HeuristicLab.Services.Hive-3.3.csproj
r6723 r6743 74 74 <Reference Include="HeuristicLab.Common-3.3"> 75 75 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Common-3.3.dll</HintPath> 76 </Reference>77 <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">78 <SpecificVersion>False</SpecificVersion>79 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Common.Resources-3.3.dll</HintPath>80 76 </Reference> 81 77 <Reference Include="HeuristicLab.Core-3.3"> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/HeuristicLabServicesHivePlugin.cs.frame
r6717 r6743 29 29 [Plugin("HeuristicLab.Services.Hive", "3.3.5.$WCREV$")] 30 30 [PluginFile("HeuristicLab.Services.Hive-3.3.dll", PluginFileType.Assembly)] 31 [PluginDependency("HeuristicLab.Common", "3.3")] 32 [PluginDependency("HeuristicLab.Common.Resources", "3.3")] 31 [PluginDependency("HeuristicLab.Common", "3.3")] 33 32 [PluginDependency("HeuristicLab.Core", "3.3")] 34 33 [PluginDependency("HeuristicLab.Persistence", "3.3")] -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/HiveDao.cs
r6725 r6743 36 36 public HiveDao() { } 37 37 38 #region JobMethods39 public DT.Task Get Job(Guid id) {38 #region Task Methods 39 public DT.Task GetTask(Guid id) { 40 40 using (var db = CreateContext()) { 41 41 return DT.Convert.ToDto(db.Tasks.SingleOrDefault(x => x.TaskId == id)); … … 43 43 } 44 44 45 public IEnumerable<DT.Task> Get Jobs(Expression<Func<Task, bool>> predicate) {45 public IEnumerable<DT.Task> GetTasks(Expression<Func<Task, bool>> predicate) { 46 46 using (var db = CreateContext()) { 47 47 return db.Tasks.Where(predicate).Select(x => DT.Convert.ToDto(x)).ToArray(); … … 49 49 } 50 50 51 public Guid Add Job(DT.Task dto) {51 public Guid AddTask(DT.Task dto) { 52 52 using (var db = CreateContext()) { 53 53 var entity = DT.Convert.ToEntity(dto); … … 62 62 } 63 63 64 public void Update Job(DT.Task dto) {64 public void UpdateTask(DT.Task dto) { 65 65 using (var db = CreateContext()) { 66 66 var entity = db.Tasks.FirstOrDefault(x => x.TaskId == dto.Id); … … 76 76 } 77 77 78 public void Delete Job(Guid id) {78 public void DeleteTask(Guid id) { 79 79 using (var db = CreateContext()) { 80 80 var entity = db.Tasks.FirstOrDefault(x => x.TaskId == id); 81 81 if (entity != null) db.Tasks.DeleteOnSubmit(entity); 82 db.SubmitChanges(); // JobData and child jobs are deleted by db-trigger82 db.SubmitChanges(); // taskData and child tasks are deleted by db-trigger 83 83 } 84 84 } 85 85 86 86 /// <summary> 87 /// returns all parent jobs which are waiting for their child jobs to finish87 /// returns all parent tasks which are waiting for their child tasks to finish 88 88 /// </summary> 89 /// <param name="resourceIds">list of resourceids which for which the jobsshould be valid</param>90 /// <param name="count">maximum number of jobsto return</param>91 /// <param name="finished">if true, all parent jobswhich have FinishWhenChildJobsFinished=true are returned, otherwise only FinishWhenChildJobsFinished=false are returned</param>89 /// <param name="resourceIds">list of resourceids which for which the task should be valid</param> 90 /// <param name="count">maximum number of task to return</param> 91 /// <param name="finished">if true, all parent task which have FinishWhenChildJobsFinished=true are returned, otherwise only FinishWhenChildJobsFinished=false are returned</param> 92 92 /// <returns></returns> 93 public IEnumerable<DT.Task> GetParent Jobs(IEnumerable<Guid> resourceIds, int count, bool finished) {93 public IEnumerable<DT.Task> GetParentTasks(IEnumerable<Guid> resourceIds, int count, bool finished) { 94 94 using (var db = CreateContext()) { 95 95 var query = from ar in db.AssignedResources … … 103 103 || child.State == TaskState.Aborted 104 104 || child.State == TaskState.Failed).All(x => x) 105 && (from child in db.Tasks // avoid returning WaitForChild Jobs jobs where no child-jobsexist (yet)105 && (from child in db.Tasks // avoid returning WaitForChildTasks task where no child-task exist (yet) 106 106 where child.ParentTaskId == ar.Task.TaskId 107 107 select child).Count() > 0 … … 112 112 } 113 113 114 public IEnumerable<DT.Task> GetWaiting Jobs(DT.Slave slave, int count) {114 public IEnumerable<DT.Task> GetWaitingTasks(DT.Slave slave, int count) { 115 115 using (var db = CreateContext()) { 116 116 var resourceIds = GetParentResources(slave.Id).Select(r => r.Id); 117 var waitingParentJobs = GetParent Jobs(resourceIds, count, false);117 var waitingParentJobs = GetParentTasks(resourceIds, count, false); 118 118 if (count > 0 && waitingParentJobs.Count() >= count) return waitingParentJobs.Take(count).ToArray(); 119 119 … … 124 124 && ar.Task.CoresNeeded <= slave.FreeCores 125 125 && ar.Task.MemoryNeeded <= slave.FreeMemory 126 orderby ar.Task.Priority descending, db.Random() // take random job to avoid the race condition that occurs when this method is called concurrently (the same jobwould be returned)126 orderby ar.Task.Priority descending, db.Random() // take random task to avoid the race condition that occurs when this method is called concurrently (the same task would be returned) 127 127 select DT.Convert.ToDto(ar.Task); 128 var waiting Jobs = (count == 0 ? query : query.Take(count)).ToArray();129 return waiting Jobs.Union(waitingParentJobs).OrderByDescending(x => x.Priority);130 } 131 } 132 133 public DT.Task Update JobState(Guid jobId, TaskState jobState, Guid? slaveId, Guid? userId, string exception) {134 using (var db = CreateContext()) { 135 var job = db.Tasks.SingleOrDefault(x => x.TaskId == jobId);136 job.State = jobState;128 var waitingTasks = (count == 0 ? query : query.Take(count)).ToArray(); 129 return waitingTasks.Union(waitingParentJobs).OrderByDescending(x => x.Priority); 130 } 131 } 132 133 public DT.Task UpdateTaskState(Guid taskId, TaskState taskState, Guid? slaveId, Guid? userId, string exception) { 134 using (var db = CreateContext()) { 135 var job = db.Tasks.SingleOrDefault(x => x.TaskId == taskId); 136 job.State = taskState; 137 137 db.StateLogs.InsertOnSubmit(new StateLog { 138 TaskId = jobId,139 State = jobState,138 TaskId = taskId, 139 State = taskState, 140 140 SlaveId = slaveId, 141 141 UserId = userId, … … 144 144 }); 145 145 db.SubmitChanges(); 146 job = db.Tasks.SingleOrDefault(x => x.TaskId == jobId);146 job = db.Tasks.SingleOrDefault(x => x.TaskId == taskId); 147 147 return DT.Convert.ToDto(job); 148 148 } … … 151 151 152 152 #region TaskData Methods 153 public DT.TaskData Get JobData(Guid id) {153 public DT.TaskData GetTaskData(Guid id) { 154 154 using (var db = CreateContext(true)) { 155 155 return DT.Convert.ToDto(db.TaskDatas.SingleOrDefault(x => x.TaskId == id)); … … 157 157 } 158 158 159 public IEnumerable<DT.TaskData> Get JobDatas(Expression<Func<TaskData, bool>> predicate) {159 public IEnumerable<DT.TaskData> GetTaskDatas(Expression<Func<TaskData, bool>> predicate) { 160 160 using (var db = CreateContext(true)) { 161 161 return db.TaskDatas.Where(predicate).Select(x => DT.Convert.ToDto(x)).ToArray(); … … 163 163 } 164 164 165 public Guid Add JobData(DT.TaskData dto) {165 public Guid AddTaskData(DT.TaskData dto) { 166 166 using (var db = CreateContext(true)) { 167 167 var entity = DT.Convert.ToEntity(dto); … … 172 172 } 173 173 174 public void Update JobData(DT.TaskData dto) {174 public void UpdateTaskData(DT.TaskData dto) { 175 175 using (var db = CreateContext(true)) { 176 176 var entity = db.TaskDatas.FirstOrDefault(x => x.TaskId == dto.TaskId); … … 181 181 } 182 182 183 public void Delete JobData(Guid id) {183 public void DeleteTaskData(Guid id) { 184 184 using (var db = CreateContext()) { 185 185 var entity = db.TaskDatas.FirstOrDefault(x => x.TaskId == id); // check if all the byte[] is loaded into memory here. otherwise work around to delete without loading it … … 231 231 232 232 #region Job Methods 233 public DT.Job Get HiveExperiment(Guid id) {233 public DT.Job GetJob(Guid id) { 234 234 using (var db = CreateContext()) { 235 235 return AddStatsToExperiment(db, DT.Convert.ToDto(db.Jobs.SingleOrDefault(x => x.JobId == id))); … … 248 248 } 249 249 250 public IEnumerable<DT.Job> Get HiveExperiments(Expression<Func<Job, bool>> predicate) {250 public IEnumerable<DT.Job> GetJobs(Expression<Func<Job, bool>> predicate) { 251 251 using (var db = CreateContext()) { 252 252 return db.Jobs.Where(predicate).Select(x => AddStatsToExperiment(db, DT.Convert.ToDto(x))).ToArray(); … … 254 254 } 255 255 256 public Guid Add HiveExperiment(DT.Job dto) {256 public Guid AddJob(DT.Job dto) { 257 257 using (var db = CreateContext()) { 258 258 var entity = DT.Convert.ToEntity(dto); … … 263 263 } 264 264 265 public void Update HiveExperiment(DT.Job dto) {265 public void UpdateJob(DT.Job dto) { 266 266 using (var db = CreateContext()) { 267 267 var entity = db.Jobs.FirstOrDefault(x => x.JobId == dto.Id); … … 272 272 } 273 273 274 public void Delete HiveExperiment(Guid id) {274 public void DeleteJob(Guid id) { 275 275 using (var db = CreateContext()) { 276 276 var entity = db.Jobs.FirstOrDefault(x => x.JobId == id); … … 282 282 283 283 #region JobPermission Methods 284 public DT.JobPermission Get HiveExperimentPermission(Guid hiveExperimentId, Guid grantedUserId) {285 using (var db = CreateContext()) { 286 return DT.Convert.ToDto(db.JobPermissions.SingleOrDefault(x => x.JobId == hiveExperimentId && x.GrantedUserId == grantedUserId));287 } 288 } 289 290 public IEnumerable<DT.JobPermission> Get HiveExperimentPermissions(Expression<Func<JobPermission, bool>> predicate) {284 public DT.JobPermission GetJobPermission(Guid jobId, Guid grantedUserId) { 285 using (var db = CreateContext()) { 286 return DT.Convert.ToDto(db.JobPermissions.SingleOrDefault(x => x.JobId == jobId && x.GrantedUserId == grantedUserId)); 287 } 288 } 289 290 public IEnumerable<DT.JobPermission> GetJobPermissions(Expression<Func<JobPermission, bool>> predicate) { 291 291 using (var db = CreateContext()) { 292 292 return db.JobPermissions.Where(predicate).Select(x => DT.Convert.ToDto(x)).ToArray(); … … 294 294 } 295 295 296 public void Add HiveExperimentPermission(DT.JobPermission dto) {296 public void AddJobPermission(DT.JobPermission dto) { 297 297 using (var db = CreateContext()) { 298 298 var entity = DT.Convert.ToEntity(dto); … … 302 302 } 303 303 304 public void Update HiveExperimentPermission(DT.JobPermission dto) {304 public void UpdateJobPermission(DT.JobPermission dto) { 305 305 using (var db = CreateContext()) { 306 306 var entity = db.JobPermissions.FirstOrDefault(x => x.JobId == dto.JobId && x.GrantedUserId == dto.GrantedUserId); … … 311 311 } 312 312 313 public void Delete HiveExperimentPermission(Guid hiveExperimentId, Guid grantedUserId) {314 using (var db = CreateContext()) { 315 var entity = db.JobPermissions.FirstOrDefault(x => x.JobId == hiveExperimentId && x.GrantedUserId == grantedUserId);313 public void DeleteJobPermission(Guid jobId, Guid grantedUserId) { 314 using (var db = CreateContext()) { 315 var entity = db.JobPermissions.FirstOrDefault(x => x.JobId == jobId && x.GrantedUserId == grantedUserId); 316 316 if (entity != null) db.JobPermissions.DeleteOnSubmit(entity); 317 317 db.SubmitChanges(); … … 322 322 /// Sets the permissions for a experiment. makes sure that only one permission per user exists. 323 323 /// </summary> 324 public void Set HiveExperimentPermission(Guid hiveExperimentId, Guid grantedByUserId, Guid grantedUserId, Permission permission) {325 using (var db = CreateContext()) { 326 JobPermission hiveExperimentPermission = db.JobPermissions.SingleOrDefault(x => x.JobId == hiveExperimentId && x.GrantedUserId == grantedUserId);327 if ( hiveExperimentPermission != null) {324 public void SetJobPermission(Guid jobId, Guid grantedByUserId, Guid grantedUserId, Permission permission) { 325 using (var db = CreateContext()) { 326 JobPermission jobPermission = db.JobPermissions.SingleOrDefault(x => x.JobId == jobId && x.GrantedUserId == grantedUserId); 327 if (jobPermission != null) { 328 328 if (permission == Permission.NotAllowed) { 329 329 // not allowed, delete 330 db.JobPermissions.DeleteOnSubmit( hiveExperimentPermission);330 db.JobPermissions.DeleteOnSubmit(jobPermission); 331 331 } else { 332 332 // update 333 hiveExperimentPermission.Permission = permission;334 hiveExperimentPermission.GrantedByUserId = grantedByUserId; // update grantedByUserId, always the last "granter" is stored333 jobPermission.Permission = permission; 334 jobPermission.GrantedByUserId = grantedByUserId; // update grantedByUserId, always the last "granter" is stored 335 335 } 336 336 } else { 337 337 // insert 338 338 if (permission != Permission.NotAllowed) { 339 hiveExperimentPermission = new JobPermission() { JobId = hiveExperimentId, GrantedByUserId = grantedByUserId, GrantedUserId = grantedUserId, Permission = permission };340 db.JobPermissions.InsertOnSubmit( hiveExperimentPermission);339 jobPermission = new JobPermission() { JobId = jobId, GrantedByUserId = grantedByUserId, GrantedUserId = grantedUserId, Permission = permission }; 340 db.JobPermissions.InsertOnSubmit(jobPermission); 341 341 } 342 342 } … … 613 613 614 614 #region Authorization Methods 615 public Permission GetPermissionForTask(Guid taskId, Guid userId) { 616 using (var db = CreateContext()) { 617 return GetPermissionForJob(GetJobForTask(taskId), userId); 618 } 619 } 620 615 621 public Permission GetPermissionForJob(Guid jobId, Guid userId) { 616 622 using (var db = CreateContext()) { 617 return GetPermissionForExperiment(GetExperimentForJob(jobId), userId); 618 } 619 } 620 621 public Permission GetPermissionForExperiment(Guid experimentId, Guid userId) { 622 using (var db = CreateContext()) { 623 Job hiveExperiment = db.Jobs.SingleOrDefault(x => x.JobId == experimentId); 624 if (hiveExperiment == null) return Permission.NotAllowed; 625 if (hiveExperiment.OwnerUserId == userId) return Permission.Full; 626 JobPermission permission = db.JobPermissions.SingleOrDefault(p => p.JobId == experimentId && p.GrantedUserId == userId); 623 Job job = db.Jobs.SingleOrDefault(x => x.JobId == jobId); 624 if (job == null) return Permission.NotAllowed; 625 if (job.OwnerUserId == userId) return Permission.Full; 626 JobPermission permission = db.JobPermissions.SingleOrDefault(p => p.JobId == jobId && p.GrantedUserId == userId); 627 627 return permission != null ? permission.Permission : Permission.NotAllowed; 628 628 } 629 629 } 630 630 631 public Guid Get ExperimentForJob(Guid jobId) {632 using (var db = CreateContext()) { 633 return db.Tasks.Single(j => j.TaskId == jobId).JobId;631 public Guid GetJobForTask(Guid taskId) { 632 using (var db = CreateContext()) { 633 return db.Tasks.Single(j => j.TaskId == taskId).JobId; 634 634 } 635 635 } … … 765 765 } 766 766 767 // execution times only of finished jobs- necessary to compute efficieny767 // execution times only of finished task - necessary to compute efficieny 768 768 var executionTimesFinishedJobs = from job in db.Tasks 769 769 where job.State == TaskState.Finished … … 778 778 } 779 779 780 // start to end times only of finished jobs- necessary to compute efficiency780 // start to end times only of finished task - necessary to compute efficiency 781 781 var startToEndTimesFinishedJobs = from job in db.Tasks 782 782 where job.State == TaskState.Finished … … 817 817 818 818 #region Helpers 819 private void CollectChild Jobs(HiveDataContext db, Guid parentJobId, List<Task> collection) {820 var jobs = db.Tasks.Where(j => j.ParentTaskId == parentJobId);821 foreach (var job in jobs) {822 collection.Add( job);823 if ( job.IsParentTask)824 CollectChild Jobs(db, job.TaskId, collection);819 private void CollectChildTasks(HiveDataContext db, Guid parentTaskId, List<Task> collection) { 820 var tasks = db.Tasks.Where(j => j.ParentTaskId == parentTaskId); 821 foreach (var task in tasks) { 822 collection.Add(task); 823 if (task.IsParentTask) 824 CollectChildTasks(db, task.TaskId, collection); 825 825 } 826 826 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/HiveService.cs
r6725 r6743 61 61 62 62 #region Job Methods 63 public Guid Add Job(Task job, TaskData jobData, IEnumerable<Guid> resourceIds) {64 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 65 return trans.UseTransaction(() => { 66 job.Id = dao.AddJob(job);67 jobData.TaskId = job.Id;68 jobData.LastUpdate = DateTime.Now;63 public Guid AddTask(Task task, TaskData taskData, IEnumerable<Guid> resourceIds) { 64 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 65 return trans.UseTransaction(() => { 66 task.Id = dao.AddTask(task); 67 taskData.TaskId = task.Id; 68 taskData.LastUpdate = DateTime.Now; 69 69 foreach (Guid slaveGroupId in resourceIds) { 70 dao.AssignJobToResource( job.Id, slaveGroupId);71 } 72 dao.Add JobData(jobData);73 dao.Update JobState(job.Id, DA.TaskState.Waiting, null, userManager.CurrentUserId, null);74 return jobData.TaskId;70 dao.AssignJobToResource(task.Id, slaveGroupId); 71 } 72 dao.AddTaskData(taskData); 73 dao.UpdateTaskState(task.Id, DA.TaskState.Waiting, null, userManager.CurrentUserId, null); 74 return taskData.TaskId; 75 75 }, false, true); 76 76 } 77 77 78 public Guid AddChild Job(Guid parentJobId, Task job, TaskData jobData) {79 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 80 return trans.UseTransaction(() => { 81 job.ParentTaskId = parentJobId;82 return Add Job(job, jobData, dao.GetAssignedResources(parentJobId).Select(x => x.Id));78 public Guid AddChildTask(Guid parentTaskId, Task task, TaskData taskData) { 79 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 80 return trans.UseTransaction(() => { 81 task.ParentTaskId = parentTaskId; 82 return AddTask(task, taskData, dao.GetAssignedResources(parentTaskId).Select(x => x.Id)); 83 83 }, false, true); 84 84 } 85 85 86 public Task GetJob(Guid jobId) { 87 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 86 public Task GetTask(Guid taskId) { 87 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 88 author.AuthorizeForTask(taskId, Permission.Read); 89 return dao.GetTask(taskId); 90 } 91 92 public IEnumerable<Task> GetTasks() { 93 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 94 var tasks = dao.GetTasks(x => true); 95 foreach (var task in tasks) 96 author.AuthorizeForTask(task.Id, Permission.Read); 97 return tasks; 98 } 99 100 public IEnumerable<LightweightTask> GetLightweightTasks(IEnumerable<Guid> taskIds) { 101 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 102 var tasks = dao.GetTasks(x => taskIds.Contains(x.TaskId)).Select(x => new LightweightTask(x)).ToArray(); 103 foreach (var task in tasks) 104 author.AuthorizeForTask(task.Id, Permission.Read); 105 return tasks; 106 } 107 108 public IEnumerable<LightweightTask> GetLightweightChildTasks(Guid? parentTaskId, bool recursive, bool includeParent) { 109 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 110 var tasks = GetChildTasks(parentTaskId, recursive, includeParent).Select(x => new LightweightTask(x)).ToArray(); 111 foreach (var task in tasks) 112 author.AuthorizeForTask(task.Id, Permission.Read); 113 return tasks; 114 } 115 116 public IEnumerable<LightweightTask> GetLightweightJobTasks(Guid jobId) { 117 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 88 118 author.AuthorizeForJob(jobId, Permission.Read); 89 return dao.GetJob(jobId); 90 } 91 92 public IEnumerable<Task> GetJobs() { 93 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 94 var jobs = dao.GetJobs(x => true); 95 foreach (var job in jobs) 96 author.AuthorizeForJob(job.Id, Permission.Read); 97 return jobs; 98 } 99 100 public IEnumerable<LightweightTask> GetLightweightJobs(IEnumerable<Guid> jobIds) { 101 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 102 var jobs = dao.GetJobs(x => jobIds.Contains(x.TaskId)).Select(x => new LightweightTask(x)).ToArray(); 103 foreach (var job in jobs) 104 author.AuthorizeForJob(job.Id, Permission.Read); 105 return jobs; 106 } 107 108 public IEnumerable<LightweightTask> GetLightweightChildJobs(Guid? parentJobId, bool recursive, bool includeParent) { 109 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 110 var jobs = GetChildJobs(parentJobId, recursive, includeParent).Select(x => new LightweightTask(x)).ToArray(); 111 foreach (var job in jobs) 112 author.AuthorizeForJob(job.Id, Permission.Read); 113 return jobs; 114 } 115 116 public IEnumerable<LightweightTask> GetLightweightExperimentJobs(Guid experimentId) { 117 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 118 author.AuthorizeForExperiment(experimentId, Permission.Read); 119 return dao.GetJobs(x => x.JobId == experimentId).Select(x => new LightweightTask(x)).ToArray(); 120 } 121 122 public TaskData GetJobData(Guid jobId) { 123 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 124 author.AuthorizeForJob(jobId, Permission.Read); 125 return dao.GetJobData(jobId); 126 } 127 128 public void UpdateJob(Task job) { 129 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 130 author.AuthorizeForJob(job.Id, Permission.Full); 131 trans.UseTransaction(() => { 132 dao.UpdateJob(job); 133 }); 134 } 135 136 public void UpdateJobData(Task job, TaskData jobData) { 137 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 138 author.AuthorizeForJob(job.Id, Permission.Full); 139 author.AuthorizeForJob(jobData.TaskId, Permission.Full); 119 return dao.GetTasks(x => x.JobId == jobId).Select(x => new LightweightTask(x)).ToArray(); 120 } 121 122 public TaskData GetTaskData(Guid taskId) { 123 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 124 author.AuthorizeForTask(taskId, Permission.Read); 125 return dao.GetTaskData(taskId); 126 } 127 128 public void UpdateTask(Task taskDto) { 129 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 130 author.AuthorizeForTask(taskDto.Id, Permission.Full); 131 trans.UseTransaction(() => { 132 dao.UpdateTask(taskDto); 133 }); 134 } 135 136 public void UpdateTaskData(Task task, TaskData taskData) { 137 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 138 author.AuthorizeForTask(task.Id, Permission.Full); 139 author.AuthorizeForTask(taskData.TaskId, Permission.Full); 140 140 //trans.UseTransaction(() => { // cneumuel: try without transaction 141 jobData.LastUpdate = DateTime.Now;142 dao.Update Job(job);143 dao.Update JobData(jobData);141 taskData.LastUpdate = DateTime.Now; 142 dao.UpdateTask(task); 143 dao.UpdateTaskData(taskData); 144 144 //}, false, true); 145 145 } 146 146 147 public void Delete Job(Guid jobId) {148 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 149 author.AuthorizeFor Job(jobId, Permission.Full);150 trans.UseTransaction(() => { 151 dao.Delete Job(jobId);152 }); 153 } 154 155 public void DeleteChild Jobs(Guid parentJobId) {156 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 157 author.AuthorizeFor Job(parentJobId, Permission.Full);158 trans.UseTransaction(() => { 159 var jobs = GetChildJobs(parentJobId, true, false);160 foreach (var job in jobs) {161 dao.Delete Job(job.Id);162 dao.Delete JobData(job.Id);147 public void DeleteTask(Guid taskId) { 148 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 149 author.AuthorizeForTask(taskId, Permission.Full); 150 trans.UseTransaction(() => { 151 dao.DeleteTask(taskId); 152 }); 153 } 154 155 public void DeleteChildTasks(Guid parentTaskId) { 156 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 157 author.AuthorizeForTask(parentTaskId, Permission.Full); 158 trans.UseTransaction(() => { 159 var tasks = GetChildTasks(parentTaskId, true, false); 160 foreach (var task in tasks) { 161 dao.DeleteTask(task.Id); 162 dao.DeleteTaskData(task.Id); 163 163 }; 164 164 }); 165 165 } 166 166 167 public Task Update JobState(Guid jobId, TaskState jobState, Guid? slaveId, Guid? userId, string exception) {168 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 169 author.AuthorizeFor Job(jobId, Permission.Full);170 return trans.UseTransaction(() => { 171 Task job = dao.UpdateJobState(jobId, DataTransfer.Convert.ToEntity(jobState), slaveId, userId, exception);172 173 if ( job.Command.HasValue && job.Command.Value == Command.Pause && job.State == TaskState.Paused) {174 job.Command = null;175 } else if ( job.Command.HasValue && job.Command.Value == Command.Abort && job.State == TaskState.Aborted) {176 job.Command = null;177 } else if ( job.Command.HasValue && job.Command.Value == Command.Stop && job.State == TaskState.Aborted) {178 job.Command = null;179 } else if ( jobState == TaskState.Paused && !job.Command.HasValue) {180 // slave paused and uploaded the job(no user-command) -> set waiting.181 job = dao.UpdateJobState(jobId, DataTransfer.Convert.ToEntity(TaskState.Waiting), slaveId, userId, exception);182 } 183 184 dao.Update Job(job);185 return job;186 }); 187 } 188 189 public IEnumerable<Task> Get JobsByResourceId(Guid resourceId) {190 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 191 var jobs = trans.UseTransaction(() => dao.GetJobsByResourceId(resourceId));192 foreach (var job in jobs)193 author.AuthorizeFor Job(job.Id, Permission.Read);194 return jobs;167 public Task UpdateTaskState(Guid taskId, TaskState taskState, Guid? slaveId, Guid? userId, string exception) { 168 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 169 author.AuthorizeForTask(taskId, Permission.Full); 170 return trans.UseTransaction(() => { 171 Task task = dao.UpdateTaskState(taskId, DataTransfer.Convert.ToEntity(taskState), slaveId, userId, exception); 172 173 if (task.Command.HasValue && task.Command.Value == Command.Pause && task.State == TaskState.Paused) { 174 task.Command = null; 175 } else if (task.Command.HasValue && task.Command.Value == Command.Abort && task.State == TaskState.Aborted) { 176 task.Command = null; 177 } else if (task.Command.HasValue && task.Command.Value == Command.Stop && task.State == TaskState.Aborted) { 178 task.Command = null; 179 } else if (taskState == TaskState.Paused && !task.Command.HasValue) { 180 // slave paused and uploaded the task (no user-command) -> set waiting. 181 task = dao.UpdateTaskState(taskId, DataTransfer.Convert.ToEntity(TaskState.Waiting), slaveId, userId, exception); 182 } 183 184 dao.UpdateTask(task); 185 return task; 186 }); 187 } 188 189 public IEnumerable<Task> GetTasksByResourceId(Guid resourceId) { 190 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 191 var tasks = trans.UseTransaction(() => dao.GetJobsByResourceId(resourceId)); 192 foreach (var task in tasks) 193 author.AuthorizeForTask(task.Id, Permission.Read); 194 return tasks; 195 195 } 196 196 #endregion 197 197 198 198 #region Task Control Methods 199 public void Stop Job(Guid jobId) {200 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 201 author.AuthorizeFor Job(jobId, Permission.Full);202 trans.UseTransaction(() => { 203 var job = dao.GetJob(jobId);204 if ( job.State == TaskState.Calculating || job.State == TaskState.Transferring) {205 job.Command = Command.Stop;206 dao.Update Job(job);199 public void StopTask(Guid taskId) { 200 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 201 author.AuthorizeForTask(taskId, Permission.Full); 202 trans.UseTransaction(() => { 203 var task = dao.GetTask(taskId); 204 if (task.State == TaskState.Calculating || task.State == TaskState.Transferring) { 205 task.Command = Command.Stop; 206 dao.UpdateTask(task); 207 207 } else { 208 if ( job.State != TaskState.Aborted && job.State != TaskState.Finished && job.State != TaskState.Failed) {209 job = UpdateJobState(jobId, TaskState.Aborted, null, null, string.Empty);208 if (task.State != TaskState.Aborted && task.State != TaskState.Finished && task.State != TaskState.Failed) { 209 task = UpdateTaskState(taskId, TaskState.Aborted, null, null, string.Empty); 210 210 } 211 211 } … … 213 213 } 214 214 215 public void Pause Job(Guid jobId) {216 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 217 author.AuthorizeFor Job(jobId, Permission.Full);218 trans.UseTransaction(() => { 219 var job = dao.Get Job(jobId);215 public void PauseTask(Guid taskId) { 216 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 217 author.AuthorizeForTask(taskId, Permission.Full); 218 trans.UseTransaction(() => { 219 var job = dao.GetTask(taskId); 220 220 if (job.State == TaskState.Calculating || job.State == TaskState.Transferring) { 221 221 job.Command = Command.Pause; 222 dao.Update Job(job);222 dao.UpdateTask(job); 223 223 } else { 224 job = Update JobState(jobId, TaskState.Paused, null, null, string.Empty);225 } 226 }); 227 } 228 229 public void Restart Job(Guid jobId) {230 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 231 author.AuthorizeFor Job(jobId, Permission.Full);232 trans.UseTransaction(() => { 233 Task job = dao.UpdateJobState(jobId, DA.TaskState.Waiting, null, userManager.CurrentUserId, string.Empty);234 job.Command = null;235 dao.Update Job(job);224 job = UpdateTaskState(taskId, TaskState.Paused, null, null, string.Empty); 225 } 226 }); 227 } 228 229 public void RestartTask(Guid taskId) { 230 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 231 author.AuthorizeForTask(taskId, Permission.Full); 232 trans.UseTransaction(() => { 233 Task task = dao.UpdateTaskState(taskId, DA.TaskState.Waiting, null, userManager.CurrentUserId, string.Empty); 234 task.Command = null; 235 dao.UpdateTask(task); 236 236 }); 237 237 } … … 239 239 240 240 #region Job Methods 241 public Job Get HiveExperiment(Guid id) {242 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 243 author.AuthorizeFor Experiment(id, Permission.Read);244 var hiveExperiment = dao.GetHiveExperiments(x =>241 public Job GetJob(Guid id) { 242 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 243 author.AuthorizeForJob(id, Permission.Read); 244 var job = dao.GetJobs(x => 245 245 x.JobId == id 246 246 && (x.OwnerUserId == userManager.CurrentUserId || x.JobPermissions.Count(hep => hep.Permission != DA.Permission.NotAllowed && hep.GrantedUserId == userManager.CurrentUserId) > 0) 247 247 ).FirstOrDefault(); 248 if ( hiveExperiment!= null) {249 hiveExperiment.Permission = DT.Convert.ToDto(dao.GetPermissionForExperiment(hiveExperiment.Id, userManager.CurrentUserId));250 hiveExperiment.OwnerUsername = userManager.GetUserById(hiveExperiment.OwnerUserId).UserName;248 if (job != null) { 249 job.Permission = DT.Convert.ToDto(dao.GetPermissionForJob(job.Id, userManager.CurrentUserId)); 250 job.OwnerUsername = userManager.GetUserById(job.OwnerUserId).UserName; 251 251 } 252 return hiveExperiment;253 } 254 255 public IEnumerable<Job> Get HiveExperiments() {256 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 257 var hiveExperiments = dao.GetHiveExperiments(x => x.OwnerUserId == userManager.CurrentUserId || x.JobPermissions.Count(hep => hep.Permission != DA.Permission.NotAllowed && hep.GrantedUserId == userManager.CurrentUserId) > 0);258 foreach (var he in hiveExperiments) {259 author.AuthorizeFor Experiment(he.Id, Permission.Read);260 he.Permission = DT.Convert.ToDto(dao.GetPermissionForExperiment(he.Id, userManager.CurrentUserId));261 he.OwnerUsername = userManager.GetUserById(he.OwnerUserId).UserName;252 return job; 253 } 254 255 public IEnumerable<Job> GetJobs() { 256 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 257 var jobs = dao.GetJobs(x => x.OwnerUserId == userManager.CurrentUserId || x.JobPermissions.Count(hep => hep.Permission != DA.Permission.NotAllowed && hep.GrantedUserId == userManager.CurrentUserId) > 0); 258 foreach (var job in jobs) { 259 author.AuthorizeForJob(job.Id, Permission.Read); 260 job.Permission = DT.Convert.ToDto(dao.GetPermissionForJob(job.Id, userManager.CurrentUserId)); 261 job.OwnerUsername = userManager.GetUserById(job.OwnerUserId).UserName; 262 262 } 263 return hiveExperiments;264 } 265 266 public IEnumerable<Job> GetAll HiveExperiments() {267 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 268 var hiveExperiments = dao.GetHiveExperiments(x => true);269 foreach (var he in hiveExperiments) { // no authorization here, since this method is admin-only! (admin is allowed to read all jobs)270 he.Permission = DT.Convert.ToDto(dao.GetPermissionForExperiment(he.Id, userManager.CurrentUserId));271 he.OwnerUsername = userManager.GetUserById(he.OwnerUserId).UserName;263 return jobs; 264 } 265 266 public IEnumerable<Job> GetAllJobs() { 267 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 268 var jobs = dao.GetJobs(x => true); 269 foreach (var job in jobs) { // no authorization here, since this method is admin-only! (admin is allowed to read all task) 270 job.Permission = DT.Convert.ToDto(dao.GetPermissionForJob(job.Id, userManager.CurrentUserId)); 271 job.OwnerUsername = userManager.GetUserById(job.OwnerUserId).UserName; 272 272 } 273 return hiveExperiments;274 } 275 276 public Guid Add HiveExperiment(Job hiveExperimentDto) {277 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 278 return trans.UseTransaction(() => { 279 hiveExperimentDto.OwnerUserId = userManager.CurrentUserId;280 hiveExperimentDto.DateCreated = DateTime.Now;281 return dao.Add HiveExperiment(hiveExperimentDto);282 }); 283 } 284 285 public void Update HiveExperiment(Job hiveExperimentDto) {286 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 287 author.AuthorizeFor Experiment(hiveExperimentDto.Id, Permission.Full);288 trans.UseTransaction(() => { 289 dao.Update HiveExperiment(hiveExperimentDto);290 }); 291 } 292 293 public void Delete HiveExperiment(Guid hiveExperimentId) {294 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 295 author.AuthorizeFor Experiment(hiveExperimentId, Permission.Full);296 trans.UseTransaction(() => { 297 dao.Delete HiveExperiment(hiveExperimentId); // child jobswill be deleted by db-trigger298 }); 299 } 300 #endregion 301 302 #region HiveExperimentPermission Methods303 public void GrantPermission(Guid hiveExperimentId, Guid grantedUserId, Permission permission) {304 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 305 trans.UseTransaction(() => { 306 Job he = dao.GetHiveExperiment(hiveExperimentId);307 if ( he == null) throw new FaultException<FaultReason>(new FaultReason("Could not find hiveExperiment with id " + hiveExperimentId));308 Permission perm = DT.Convert.ToDto(dao.GetPermissionFor Experiment(he.Id, userManager.CurrentUserId));273 return jobs; 274 } 275 276 public Guid AddJob(Job jobDto) { 277 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 278 return trans.UseTransaction(() => { 279 jobDto.OwnerUserId = userManager.CurrentUserId; 280 jobDto.DateCreated = DateTime.Now; 281 return dao.AddJob(jobDto); 282 }); 283 } 284 285 public void UpdateJob(Job jobDto) { 286 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 287 author.AuthorizeForJob(jobDto.Id, Permission.Full); 288 trans.UseTransaction(() => { 289 dao.UpdateJob(jobDto); 290 }); 291 } 292 293 public void DeleteJob(Guid jobId) { 294 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 295 author.AuthorizeForJob(jobId, Permission.Full); 296 trans.UseTransaction(() => { 297 dao.DeleteJob(jobId); // child task will be deleted by db-trigger 298 }); 299 } 300 #endregion 301 302 #region JobPermission Methods 303 public void GrantPermission(Guid jobId, Guid grantedUserId, Permission permission) { 304 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 305 trans.UseTransaction(() => { 306 Job job = dao.GetJob(jobId); 307 if (job == null) throw new FaultException<FaultReason>(new FaultReason("Could not find task with id " + jobId)); 308 Permission perm = DT.Convert.ToDto(dao.GetPermissionForJob(job.Id, userManager.CurrentUserId)); 309 309 if (perm != Permission.Full) throw new FaultException<FaultReason>(new FaultReason("Not allowed to grant permissions for this experiment")); 310 dao.Set HiveExperimentPermission(hiveExperimentId, userManager.CurrentUserId, grantedUserId, DT.Convert.ToEntity(permission));311 }); 312 } 313 314 public void RevokePermission(Guid hiveExperimentId, Guid grantedUserId) {315 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 316 trans.UseTransaction(() => { 317 Job he = dao.GetHiveExperiment(hiveExperimentId);318 if ( he == null) throw new FaultException<FaultReason>(new FaultReason("Could not find hiveExperiment with id " + hiveExperimentId));319 DA.Permission perm = dao.GetPermissionFor Experiment(he.Id, userManager.CurrentUserId);310 dao.SetJobPermission(jobId, userManager.CurrentUserId, grantedUserId, DT.Convert.ToEntity(permission)); 311 }); 312 } 313 314 public void RevokePermission(Guid jobId, Guid grantedUserId) { 315 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 316 trans.UseTransaction(() => { 317 Job job = dao.GetJob(jobId); 318 if (job == null) throw new FaultException<FaultReason>(new FaultReason("Could not find task with id " + jobId)); 319 DA.Permission perm = dao.GetPermissionForJob(job.Id, userManager.CurrentUserId); 320 320 if (perm != DA.Permission.Full) throw new FaultException<FaultReason>(new FaultReason("Not allowed to grant permissions for this experiment")); 321 dao.Set HiveExperimentPermission(hiveExperimentId, userManager.CurrentUserId, grantedUserId, DA.Permission.NotAllowed);322 }); 323 } 324 public IEnumerable<JobPermission> Get HiveExperimentPermissions(Guid hiveExperimentId) {325 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 326 return trans.UseTransaction(() => { 327 DA.Permission currentUserPermission = dao.GetPermissionFor Experiment(hiveExperimentId, userManager.CurrentUserId);321 dao.SetJobPermission(jobId, userManager.CurrentUserId, grantedUserId, DA.Permission.NotAllowed); 322 }); 323 } 324 public IEnumerable<JobPermission> GetJobPermissions(Guid jobId) { 325 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 326 return trans.UseTransaction(() => { 327 DA.Permission currentUserPermission = dao.GetPermissionForJob(jobId, userManager.CurrentUserId); 328 328 if (currentUserPermission != DA.Permission.Full) throw new FaultException<FaultReason>(new FaultReason("Not allowed to list permissions for this experiment")); 329 return dao.Get HiveExperimentPermissions(x => x.JobId == hiveExperimentId);329 return dao.GetJobPermissions(x => x.JobId == jobId); 330 330 }); 331 331 } … … 591 591 592 592 #region Helper Methods 593 private IEnumerable<Task> GetChild Jobs(Guid? parentJobId, bool recursive, bool includeParent) {594 var jobs = new List<Task>(dao.GetJobs(x => parentJobId == null ? !x.ParentTaskId.HasValue : x.ParentTaskId.Value == parentJobId));593 private IEnumerable<Task> GetChildTasks(Guid? parentTaskId, bool recursive, bool includeParent) { 594 var tasks = new List<Task>(dao.GetTasks(x => parentTaskId == null ? !x.ParentTaskId.HasValue : x.ParentTaskId.Value == parentTaskId)); 595 595 596 596 if (recursive) { 597 597 var childs = new List<Task>(); 598 foreach (var job in jobs) {599 childs.AddRange(GetChild Jobs(job.Id, recursive, false));600 } 601 jobs.AddRange(childs);598 foreach (var task in tasks) { 599 childs.AddRange(GetChildTasks(task.Id, recursive, false)); 600 } 601 tasks.AddRange(childs); 602 602 } 603 603 604 if (includeParent) jobs.Add(GetJob(parentJobId.Value));605 return jobs;604 if (includeParent) tasks.Add(GetTask(parentTaskId.Value)); 605 return tasks; 606 606 } 607 607 #endregion -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/Interfaces/IAuthorizationManager.cs
r6717 r6743 30 30 void Authorize(Guid userId); 31 31 32 void AuthorizeForTask(Guid taskId, Permission requiredPermission); 33 32 34 void AuthorizeForJob(Guid jobId, Permission requiredPermission); 33 34 void AuthorizeForExperiment(Guid experimentId, Permission requiredPermission);35 35 } 36 36 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/Interfaces/IEventManager.cs
r6698 r6743 22 22 namespace HeuristicLab.Services.Hive { 23 23 /// <summary> 24 /// The only object in hive which holds a state. Must allow restarts without resetting all jobs24 /// The only object in hive which holds a state. Must allow restarts without resetting all task 25 25 /// </summary> 26 26 public interface IEventManager { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/Interfaces/IHiveDao.cs
r6725 r6743 29 29 public interface IHiveDao { 30 30 #region Task Methods 31 DT.Task Get Job(Guid id);32 IEnumerable<DT.Task> Get Jobs(Expression<Func<Task, bool>> predicate);33 Guid Add Job(DT.Task dto);34 void Update Job(DT.Task dto);35 void Delete Job(Guid id);36 IEnumerable<DT.Task> GetWaiting Jobs(DT.Slave slave, int count);37 IEnumerable<DT.Task> GetParent Jobs(IEnumerable<Guid> resourceIds, int count, bool finished);38 DT.Task Update JobState(Guid jobId, TaskState jobState, Guid? slaveId, Guid? userId, string exception);31 DT.Task GetTask(Guid id); 32 IEnumerable<DT.Task> GetTasks(Expression<Func<Task, bool>> predicate); 33 Guid AddTask(DT.Task dto); 34 void UpdateTask(DT.Task dto); 35 void DeleteTask(Guid id); 36 IEnumerable<DT.Task> GetWaitingTasks(DT.Slave slave, int count); 37 IEnumerable<DT.Task> GetParentTasks(IEnumerable<Guid> resourceIds, int count, bool finished); 38 DT.Task UpdateTaskState(Guid taskId, TaskState taskState, Guid? slaveId, Guid? userId, string exception); 39 39 #endregion 40 40 41 41 #region TaskData Methods 42 DT.TaskData Get JobData(Guid id);43 IEnumerable<DT.TaskData> Get JobDatas(Expression<Func<TaskData, bool>> predicate);44 Guid Add JobData(DT.TaskData dto);45 void Update JobData(DT.TaskData dto);46 void Delete JobData(Guid id);42 DT.TaskData GetTaskData(Guid id); 43 IEnumerable<DT.TaskData> GetTaskDatas(Expression<Func<TaskData, bool>> predicate); 44 Guid AddTaskData(DT.TaskData dto); 45 void UpdateTaskData(DT.TaskData dto); 46 void DeleteTaskData(Guid id); 47 47 #endregion 48 48 … … 55 55 #endregion 56 56 57 #region HiveExperimentMethods58 DT.Job Get HiveExperiment(Guid id);59 IEnumerable<DT.Job> Get HiveExperiments(Expression<Func<Job, bool>> predicate);60 Guid Add HiveExperiment(DT.Job dto);61 void Update HiveExperiment(DT.Job dto);62 void Delete HiveExperiment(Guid id);57 #region Job Methods 58 DT.Job GetJob(Guid id); 59 IEnumerable<DT.Job> GetJobs(Expression<Func<Job, bool>> predicate); 60 Guid AddJob(DT.Job dto); 61 void UpdateJob(DT.Job dto); 62 void DeleteJob(Guid id); 63 63 #endregion 64 64 65 #region HiveExperimentPermission Methods66 DT.JobPermission Get HiveExperimentPermission(Guid hiveExperimentId, Guid grantedUserId);67 IEnumerable<DT.JobPermission> Get HiveExperimentPermissions(Expression<Func<JobPermission, bool>> predicate);68 void Add HiveExperimentPermission(DT.JobPermission dto);69 void Update HiveExperimentPermission(DT.JobPermission dto);70 void Delete HiveExperimentPermission(Guid hiveExperimentId, Guid grantedUserId);71 void Set HiveExperimentPermission(Guid hiveExperimentId, Guid grantedByUserId, Guid grantedUserId, Permission permission);65 #region JobPermission Methods 66 DT.JobPermission GetJobPermission(Guid jobId, Guid grantedUserId); 67 IEnumerable<DT.JobPermission> GetJobPermissions(Expression<Func<JobPermission, bool>> predicate); 68 void AddJobPermission(DT.JobPermission dto); 69 void UpdateJobPermission(DT.JobPermission dto); 70 void DeleteJobPermission(Guid jobId, Guid grantedUserId); 71 void SetJobPermission(Guid jobId, Guid grantedByUserId, Guid grantedUserId, Permission permission); 72 72 #endregion 73 73 … … 86 86 void UpdatePluginData(DT.PluginData dto); 87 87 void DeletePluginData(Guid id); 88 #endregion89 90 #region Calendar Methods91 88 #endregion 92 89 … … 121 118 122 119 #region Authorization Methods 120 Permission GetPermissionForTask(Guid taskId, Guid userId); 123 121 Permission GetPermissionForJob(Guid jobId, Guid userId); 124 Permission GetPermissionForExperiment(Guid experimentId, Guid userId); 125 Guid GetExperimentForJob(Guid jobId); 122 Guid GetJobForTask(Guid taskId); 126 123 #endregion 127 124 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/Manager/AuthorizationManager.cs
r6717 r6743 33 33 } 34 34 35 public void AuthorizeForTask(Guid taskId, DT.Permission requiredPermission) { 36 if (ServiceLocator.Instance.AuthenticationManager.IsInRole(HiveRoles.Slave)) return; // slave-users can access all tasks 37 38 Permission permission = ServiceLocator.Instance.HiveDao.GetPermissionForTask(taskId, ServiceLocator.Instance.UserManager.CurrentUserId); 39 if (permission == Permission.NotAllowed || (permission != DT.Convert.ToEntity(requiredPermission) && DT.Convert.ToEntity(requiredPermission) == Permission.Full)) 40 throw new SecurityException("Current user is not authorized to access task"); 41 } 42 35 43 public void AuthorizeForJob(Guid jobId, DT.Permission requiredPermission) { 36 if (ServiceLocator.Instance.AuthenticationManager.IsInRole(HiveRoles.Slave)) return; // slave-users can access all jobs37 38 44 Permission permission = ServiceLocator.Instance.HiveDao.GetPermissionForJob(jobId, ServiceLocator.Instance.UserManager.CurrentUserId); 39 45 if (permission == Permission.NotAllowed || (permission != DT.Convert.ToEntity(requiredPermission) && DT.Convert.ToEntity(requiredPermission) == Permission.Full)) 40 throw new SecurityException("Current user is not authorized to access job"); 41 } 42 43 public void AuthorizeForExperiment(Guid experimentId, DT.Permission requiredPermission) { 44 Permission permission = ServiceLocator.Instance.HiveDao.GetPermissionForExperiment(experimentId, ServiceLocator.Instance.UserManager.CurrentUserId); 45 if (permission == Permission.NotAllowed || (permission != DT.Convert.ToEntity(requiredPermission) && DT.Convert.ToEntity(requiredPermission) == Permission.Full)) 46 throw new SecurityException("Current user is not authorized to access experiment"); 46 throw new SecurityException("Current user is not authorized to access task"); 47 47 } 48 48 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/Manager/EventManager.cs
r6721 r6743 29 29 namespace HeuristicLab.Services.Hive { 30 30 /// <summary> 31 /// This class offers methods for cleaning up offline slaves and jobs31 /// This class offers methods for cleaning up offline slaves and task 32 32 /// </summary> 33 33 public class EventManager : IEventManager { … … 45 45 log.Log("EventManager.Cleanup()"); 46 46 SetTimeoutSlavesOffline(); 47 SetTimeout JobsWaiting();48 FinishParent Jobs();47 SetTimeoutTasksWaiting(); 48 FinishParentTasks(); 49 49 UpdateStatistics(); 50 50 } … … 72 72 73 73 /// <summary> 74 /// Searches for slaves which are timed out, puts them and their jobsoffline74 /// Searches for slaves which are timed out, puts them and their task offline 75 75 /// </summary> 76 76 private void SetTimeoutSlavesOffline() { … … 79 79 if (!slave.LastHeartbeat.HasValue || (DateTime.Now - slave.LastHeartbeat.Value) > HeuristicLab.Services.Hive.Properties.Settings.Default.SlaveHeartbeatTimeout) { 80 80 slave.SlaveState = DT.SlaveState.Offline; 81 Set JobsWaiting(slave.Id);81 SetTasksWaiting(slave.Id); 82 82 dao.UpdateSlave(slave); 83 83 } … … 86 86 87 87 /// <summary> 88 /// Looks for parent jobs which have FinishWhenChildJobsFinished and set their state to finished88 /// Looks for parent tasks which have FinishWhenChildJobsFinished and set their state to finished 89 89 /// </summary> 90 private void FinishParent Jobs() {91 var parent JobsToFinish = dao.GetParentJobs(dao.GetResources(x => true).Select(x => x.Id), 0, true);92 foreach (var job in parentJobsToFinish) {93 dao.Update JobState(job.Id, TaskState.Finished, null, null, string.Empty);90 private void FinishParentTasks() { 91 var parentTasksToFinish = dao.GetParentTasks(dao.GetResources(x => true).Select(x => x.Id), 0, true); 92 foreach (var task in parentTasksToFinish) { 93 dao.UpdateTaskState(task.Id, TaskState.Finished, null, null, string.Empty); 94 94 } 95 95 } 96 96 97 private void Set JobsWaiting(Guid slaveId) {98 var jobs = dao.GetJobs(x => x.State == TaskState.Calculating).Where(x => x.StateLog.Last().SlaveId == slaveId);99 foreach (var j in jobs) {100 DT.Task job = dao.UpdateJobState(j.Id, TaskState.Waiting, slaveId, null, "Slave timed out.");101 job.Command = null;102 dao.Update Job(job);97 private void SetTasksWaiting(Guid slaveId) { 98 var tasks = dao.GetTasks(x => x.State == TaskState.Calculating).Where(x => x.StateLog.Last().SlaveId == slaveId); 99 foreach (var j in tasks) { 100 DT.Task task = dao.UpdateTaskState(j.Id, TaskState.Waiting, slaveId, null, "Slave timed out."); 101 task.Command = null; 102 dao.UpdateTask(task); 103 103 } 104 104 } 105 105 106 106 /// <summary> 107 /// Looks for jobswhich have not sent heartbeats for some time and reschedules them for calculation107 /// Looks for task which have not sent heartbeats for some time and reschedules them for calculation 108 108 /// </summary> 109 private void SetTimeout JobsWaiting() {110 var jobs = dao.GetJobs(x => (x.State == TaskState.Calculating && (DateTime.Now - x.LastHeartbeat) > HeuristicLab.Services.Hive.Properties.Settings.Default.CalculatingJobHeartbeatTimeout)109 private void SetTimeoutTasksWaiting() { 110 var tasks = dao.GetTasks(x => (x.State == TaskState.Calculating && (DateTime.Now - x.LastHeartbeat) > HeuristicLab.Services.Hive.Properties.Settings.Default.CalculatingJobHeartbeatTimeout) 111 111 || (x.State == TaskState.Transferring && (DateTime.Now - x.LastHeartbeat) > HeuristicLab.Services.Hive.Properties.Settings.Default.TransferringJobHeartbeatTimeout)); 112 foreach (var j in jobs) {113 DT.Task job = dao.UpdateJobState(j.Id, TaskState.Waiting, null, null, "Slave timed out.");114 job.Command = null;115 dao.Update Job(job);112 foreach (var j in tasks) { 113 DT.Task task = dao.UpdateTaskState(j.Id, TaskState.Waiting, null, null, "Slave timed out."); 114 task.Command = null; 115 dao.UpdateTask(task); 116 116 } 117 117 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/Manager/HeartbeatManager.cs
r6725 r6743 54 54 dao.UpdateSlave(slave); 55 55 56 // update jobdata57 actions.AddRange(Update Jobs(heartbeat, slave.IsAllowedToCalculate));56 // update task data 57 actions.AddRange(UpdateTasks(heartbeat, slave.IsAllowedToCalculate)); 58 58 59 // assign new job59 // assign new task 60 60 if (heartbeat.AssignJob && slave.IsAllowedToCalculate && heartbeat.FreeCores > 0) { 61 var availableJobs = dao.GetWaiting Jobs(slave, 1);61 var availableJobs = dao.GetWaitingTasks(slave, 1); 62 62 if (availableJobs.Count() > 0) { 63 63 var job = availableJobs.First(); … … 71 71 72 72 // returns true if assignment was successful 73 private bool AssignJob(Slave slave, Task job) {74 // load job again and check if it is still available (this is an attempt to reduce the race condition which causes multiple heartbeats to get the same jobassigned)75 if (dao.Get Job(job.Id).State != TaskState.Waiting) return false;73 private bool AssignJob(Slave slave, Task task) { 74 // load task again and check if it is still available (this is an attempt to reduce the race condition which causes multiple heartbeats to get the same task assigned) 75 if (dao.GetTask(task.Id).State != TaskState.Waiting) return false; 76 76 77 job = dao.UpdateJobState(job.Id, DataAccess.TaskState.Transferring, slave.Id, null, null);77 task = dao.UpdateTaskState(task.Id, DataAccess.TaskState.Transferring, slave.Id, null, null); 78 78 79 // from now on the jobhas some time to send the next heartbeat (ApplicationConstants.TransferringJobHeartbeatTimeout)80 job.LastHeartbeat = DateTime.Now;81 dao.Update Job(job);79 // from now on the task has some time to send the next heartbeat (ApplicationConstants.TransferringJobHeartbeatTimeout) 80 task.LastHeartbeat = DateTime.Now; 81 dao.UpdateTask(task); 82 82 return true; 83 83 } 84 84 85 85 /// <summary> 86 /// Update the progress of each job87 /// Checks if all the jobssent by heartbeat are supposed to be calculated by this slave86 /// Update the progress of each task 87 /// Checks if all the task sent by heartbeat are supposed to be calculated by this slave 88 88 /// </summary> 89 private IEnumerable<MessageContainer> Update Jobs(Heartbeat heartbeat, bool IsAllowedToCalculate) {89 private IEnumerable<MessageContainer> UpdateTasks(Heartbeat heartbeat, bool IsAllowedToCalculate) { 90 90 List<MessageContainer> actions = new List<MessageContainer>(); 91 91 … … 98 98 // process the jobProgresses 99 99 foreach (var jobProgress in heartbeat.JobProgress) { 100 Task curJob = dao.Get Job(jobProgress.Key);100 Task curJob = dao.GetTask(jobProgress.Key); 101 101 if (curJob == null) { 102 // jobdoes not exist in db102 // task does not exist in db 103 103 actions.Add(new MessageContainer(MessageContainer.MessageType.AbortTask, jobProgress.Key)); 104 104 DA.LogFactory.GetLogger(this.GetType().Namespace).Log("Job does not exist in DB: " + jobProgress.Key); … … 108 108 actions.Add(new MessageContainer(MessageContainer.MessageType.AbortTask, curJob.Id)); 109 109 DA.LogFactory.GetLogger(this.GetType().Namespace).Log("The slave " + heartbeat.SlaveId + " is not supposed to calculate Job: " + curJob); 110 } else if (! JobIsAllowedToBeCalculatedBySlave(heartbeat.SlaveId, curJob)) {111 // assigned resources ids of jobdo not match with slaveId (and parent resourceGroupIds); this might happen when slave is moved to different group110 } else if (!TaskIsAllowedToBeCalculatedBySlave(heartbeat.SlaveId, curJob)) { 111 // assigned resources ids of task do not match with slaveId (and parent resourceGroupIds); this might happen when slave is moved to different group 112 112 actions.Add(new MessageContainer(MessageContainer.MessageType.PauseTask, curJob.Id)); 113 113 } else { 114 // save jobexecution time114 // save task execution time 115 115 curJob.ExecutionTime = jobProgress.Value; 116 116 curJob.LastHeartbeat = DateTime.Now; … … 127 127 break; 128 128 } 129 dao.Update Job(curJob);129 dao.UpdateTask(curJob); 130 130 } 131 131 } … … 135 135 } 136 136 137 private bool JobIsAllowedToBeCalculatedBySlave(Guid slaveId, Task curJob) {138 var assignedResourceIds = dao.GetAssignedResources(cur Job.Id).Select(x => x.Id);137 private bool TaskIsAllowedToBeCalculatedBySlave(Guid slaveId, Task curTask) { 138 var assignedResourceIds = dao.GetAssignedResources(curTask.Id).Select(x => x.Id); 139 139 var slaveResourceIds = dao.GetParentResources(slaveId).Select(x => x.Id); 140 140 return assignedResourceIds.Any(x => slaveResourceIds.Contains(x)); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/MessageContainer.cs
r6725 r6743 37 37 public enum MessageType { 38 38 // *** commands from hive server *** 39 CalculateTask, // slave should calculate a job. the jobis already assigned to the slave40 StopTask, // slave should stop the joband submit results39 CalculateTask, // slave should calculate a task. the task is already assigned to the slave 40 StopTask, // slave should stop the task and submit results 41 41 StopAll, // stop all and submit results 42 AbortTask, // slave should shut the jobdown immediately without submitting results43 AbortAll, // slave should abort all jobsimmediately44 PauseTask, // pause the joband submit the results45 PauseAll, // pause all jobsand submit results42 AbortTask, // slave should shut the task down immediately without submitting results 43 AbortAll, // slave should abort all task immediately 44 PauseTask, // pause the task and submit the results 45 PauseAll, // pause all task and submit results 46 46 Restart, // restart operation after Sleep 47 47 Sleep, // disconnect from server, but don't shutdown 48 48 ShutdownSlave, // slave should shutdown immediately without submitting results 49 SayHello, // Slave should say hello, because heis unknown to the server49 SayHello, // Slave should say hello, because job is unknown to the server 50 50 }; 51 51 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/ServiceContracts/IHiveService.cs
r6725 r6743 33 33 #region Task Methods 34 34 [OperationContract] 35 Guid Add Job(Task job, TaskData jobData, IEnumerable<Guid> resourceIds);36 37 [OperationContract] 38 Guid AddChild Job(Guid parentJobId, Task job, TaskData jobData);39 40 [OperationContract] 41 Task Get Job(Guid jobId);42 43 [OperationContract] 44 IEnumerable<Task> Get Jobs();45 46 [OperationContract] 47 IEnumerable<LightweightTask> GetLightweight Jobs(IEnumerable<Guid> jobIds);48 49 [OperationContract] 50 IEnumerable<LightweightTask> GetLightweightChild Jobs(Guid? parentJobId, bool recursive, bool includeParent);51 52 [OperationContract] 53 IEnumerable<LightweightTask> GetLightweight ExperimentJobs(Guid experimentId);54 55 [OperationContract] 56 TaskData Get JobData(Guid jobId);57 58 [OperationContract] 59 void Update Job(Task jobDto);60 61 [OperationContract] 62 void Update JobData(Task jobDto, TaskData jobDataDto);63 64 [OperationContract] 65 void Delete Job(Guid jobId);66 67 [OperationContract] 68 void DeleteChild Jobs(Guid parentJobId);69 70 [OperationContract] 71 Task Update JobState(Guid jobId, TaskState jobState, Guid? slaveId, Guid? userId, string exception);72 #endregion 73 74 #region JobControl Methods75 [OperationContract] 76 void Stop Job(Guid jobId);77 78 [OperationContract] 79 void Pause Job(Guid jobId);80 81 [OperationContract] 82 void Restart Job(Guid jobId);35 Guid AddTask(Task task, TaskData taskData, IEnumerable<Guid> resourceIds); 36 37 [OperationContract] 38 Guid AddChildTask(Guid parentTaskId, Task task, TaskData taskData); 39 40 [OperationContract] 41 Task GetTask(Guid taskId); 42 43 [OperationContract] 44 IEnumerable<Task> GetTasks(); 45 46 [OperationContract] 47 IEnumerable<LightweightTask> GetLightweightTasks(IEnumerable<Guid> taskIds); 48 49 [OperationContract] 50 IEnumerable<LightweightTask> GetLightweightChildTasks(Guid? parentTaskId, bool recursive, bool includeParent); 51 52 [OperationContract] 53 IEnumerable<LightweightTask> GetLightweightJobTasks(Guid jobId); 54 55 [OperationContract] 56 TaskData GetTaskData(Guid taskId); 57 58 [OperationContract] 59 void UpdateTask(Task taskDto); 60 61 [OperationContract] 62 void UpdateTaskData(Task taskDto, TaskData taskDataDto); 63 64 [OperationContract] 65 void DeleteTask(Guid taskId); 66 67 [OperationContract] 68 void DeleteChildTasks(Guid parentTaskId); 69 70 [OperationContract] 71 Task UpdateTaskState(Guid taskId, TaskState taskState, Guid? slaveId, Guid? userId, string exception); 72 #endregion 73 74 #region Task Control Methods 75 [OperationContract] 76 void StopTask(Guid taskId); 77 78 [OperationContract] 79 void PauseTask(Guid taskId); 80 81 [OperationContract] 82 void RestartTask(Guid taskId); 83 83 #endregion 84 84 85 85 #region Job Methods 86 86 [OperationContract] 87 Job Get HiveExperiment(Guid id);87 Job GetJob(Guid id); 88 88 89 89 /// <summary> 90 /// Returns all experimentsfor the current user90 /// Returns all task for the current user 91 91 /// </summary> 92 92 [OperationContract] 93 IEnumerable<Job> Get HiveExperiments();93 IEnumerable<Job> GetJobs(); 94 94 95 95 /// <summary> 96 /// Returns all experimentsin the hive (only for admins)96 /// Returns all task in the hive (only for admins) 97 97 /// </summary> 98 98 /// <returns></returns> 99 99 [OperationContract] 100 IEnumerable<Job> GetAll HiveExperiments();101 102 [OperationContract] 103 Guid Add HiveExperiment(Job hiveExperimentDto);104 105 [OperationContract] 106 void Update HiveExperiment(Job hiveExperimentDto);107 108 [OperationContract] 109 void Delete HiveExperiment(Guid hiveExperimentId);110 #endregion 111 112 #region HiveExperimentPermission Methods113 [OperationContract] 114 void GrantPermission(Guid hiveExperimentId, Guid grantedUserId, Permission permission);100 IEnumerable<Job> GetAllJobs(); 101 102 [OperationContract] 103 Guid AddJob(Job jobDto); 104 105 [OperationContract] 106 void UpdateJob(Job jobDto); 107 108 [OperationContract] 109 void DeleteJob(Guid JobId); 110 #endregion 111 112 #region JobPermission Methods 113 [OperationContract] 114 void GrantPermission(Guid jobId, Guid grantedUserId, Permission permission); 115 115 116 116 [OperationContract] … … 118 118 119 119 [OperationContract] 120 IEnumerable<JobPermission> Get HiveExperimentPermissions(Guid hiveExperimentId);121 122 [OperationContract] 123 bool IsAllowedPrivileged(); // current user may execute privileged jobs120 IEnumerable<JobPermission> GetJobPermissions(Guid jobId); 121 122 [OperationContract] 123 bool IsAllowedPrivileged(); // current user may execute privileged task 124 124 #endregion 125 125 … … 140 140 [OperationContract] 141 141 Plugin GetPlugin(Guid pluginId); 142 142 143 [OperationContract] 143 144 Plugin GetPluginByHash(byte[] hash); 145 144 146 [OperationContract] 145 147 [FaultContract(typeof(PluginAlreadyExistsFault))] 146 148 Guid AddPlugin(Plugin plugin, List<PluginData> pluginData); 149 147 150 [OperationContract] 148 151 IEnumerable<Plugin> GetPlugins(); 152 149 153 [OperationContract] 150 154 IEnumerable<PluginData> GetPluginDatas(List<Guid> pluginIds); 155 151 156 [OperationContract] 152 157 void DeletePlugin(Guid pluginId); … … 194 199 195 200 [OperationContract] 196 IEnumerable<Task> Get JobsByResourceId(Guid resourceId);201 IEnumerable<Task> GetTasksByResourceId(Guid resourceId); 197 202 198 203 [OperationContract]
Note: See TracChangeset
for help on using the changeset viewer.