- Timestamp:
- 09/12/11 18:04:25 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
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 });
Note: See TracChangeset
for help on using the changeset viewer.