Changeset 6721 for branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/HiveClient.cs
- Timestamp:
- 09/08/11 13:41:25 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/HiveClient.cs
r6490 r6721 31 31 using HeuristicLab.Core; 32 32 using HeuristicLab.PluginInfrastructure; 33 using TS = System.Threading.Tasks; 33 34 34 35 namespace HeuristicLab.Clients.Hive { … … 217 218 ServiceLocator.Instance.CallHiveService(service => { 218 219 foreach (HiveJob job in refreshableHiveExperiment.GetAllHiveJobs()) { 219 if (job.Job.State != JobState.Finished && job.Job.State != JobState.Aborted && job.Job.State != JobState.Failed)220 if (job.Job.State != TaskState.Finished && job.Job.State != TaskState.Aborted && job.Job.State != TaskState.Failed) 220 221 service.PauseJob(job.Job.Id); 221 222 } … … 227 228 ServiceLocator.Instance.CallHiveService(service => { 228 229 foreach (HiveJob job in refreshableHiveExperiment.GetAllHiveJobs()) { 229 if (job.Job.State != JobState.Finished && job.Job.State != JobState.Aborted && job.Job.State != JobState.Failed)230 if (job.Job.State != TaskState.Finished && job.Job.State != TaskState.Aborted && job.Job.State != TaskState.Failed) 230 231 service.StopJob(job.Job.Id); 231 232 } … … 282 283 refreshableHiveExperiment.Progress.Status = "Uploading jobs..."; 283 284 284 var tasks = new List<T ask>();285 var tasks = new List<TS.Task>(); 285 286 foreach (HiveJob hiveJob in refreshableHiveExperiment.HiveJobs) { 286 tasks.Add(T ask.Factory.StartNew((hj) => {287 tasks.Add(TS.Task.Factory.StartNew((hj) => { 287 288 UploadJobWithChildren(refreshableHiveExperiment.Progress, (HiveJob)hj, null, resourceIds, jobCount, totalJobCount, configFilePlugin.Id, refreshableHiveExperiment.HiveExperiment.Id, refreshableHiveExperiment.Log, refreshableHiveExperiment.HiveExperiment.IsPrivileged, cancellationToken); 288 289 }, hiveJob) … … 290 291 } 291 292 try { 292 T ask.WaitAll(tasks.ToArray());293 TS.Task.WaitAll(tasks.ToArray()); 293 294 } 294 295 catch (AggregateException ae) { … … 341 342 jobCount[0]++; 342 343 } 343 JobData jobData;344 TaskData jobData; 344 345 List<IPluginDescription> plugins; 345 346 … … 384 385 } 385 386 386 var tasks = new List<T ask>();387 var tasks = new List<TS.Task>(); 387 388 foreach (HiveJob child in hiveJob.ChildHiveJobs) { 388 tasks.Add(T ask.Factory.StartNew((tuple) => {389 tasks.Add(TS.Task.Factory.StartNew((tuple) => { 389 390 var arguments = (Tuple<HiveJob, HiveJob>)tuple; 390 391 UploadJobWithChildren(progress, arguments.Item1, arguments.Item2, groups, jobCount, totalJobCount, configPluginId, hiveExperimentId, log, isPrivileged, cancellationToken); … … 394 395 jobUploadSemaphore.Release(); semaphoreReleased = true; // the semaphore has to be release before waitall! 395 396 try { 396 T ask.WaitAll(tasks.ToArray());397 TS.Task.WaitAll(tasks.ToArray()); 397 398 } 398 399 catch (AggregateException ae) { … … 414 415 refreshableHiveExperiment.IsProgressing = true; 415 416 int totalJobCount = 0; 416 IEnumerable<Lightweight Job> allJobs;417 IEnumerable<LightweightTask> allJobs; 417 418 418 419 refreshableHiveExperiment.Progress.Status = "Connecting to Server..."; 419 // fetch all Jobobjects to create the full tree of tree of HiveJob objects420 // fetch all Task objects to create the full tree of tree of HiveJob objects 420 421 refreshableHiveExperiment.Progress.Status = "Downloading list of jobs..."; 421 422 allJobs = ServiceLocator.Instance.CallHiveService(s => s.GetLightweightExperimentJobs(hiveExperiment.Id)); … … 436 437 IDictionary<Guid, HiveJob> allHiveJobs = downloader.Results; 437 438 438 refreshableHiveExperiment.HiveJobs = new ItemCollection<HiveJob>(allHiveJobs.Values.Where(x => !x.Job.Parent JobId.HasValue));439 refreshableHiveExperiment.HiveJobs = new ItemCollection<HiveJob>(allHiveJobs.Values.Where(x => !x.Job.ParentTaskId.HasValue)); 439 440 440 441 if (refreshableHiveExperiment.IsFinished()) { … … 456 457 } 457 458 458 private static void BuildHiveJobTree(HiveJob parentHiveJob, IEnumerable<Lightweight Job> allJobs, IDictionary<Guid, HiveJob> allHiveJobs) {459 IEnumerable<Lightweight Job> childJobs = from job in allJobs460 where job.ParentJobId.HasValue && job.ParentJobId.Value == parentHiveJob.Job.Id461 orderby job.DateCreated ascending462 select job;463 foreach (Lightweight Jobjob in childJobs) {459 private static void BuildHiveJobTree(HiveJob parentHiveJob, IEnumerable<LightweightTask> allJobs, IDictionary<Guid, HiveJob> allHiveJobs) { 460 IEnumerable<LightweightTask> childJobs = from job in allJobs 461 where job.ParentTaskId.HasValue && job.ParentTaskId.Value == parentHiveJob.Job.Id 462 orderby job.DateCreated ascending 463 select job; 464 foreach (LightweightTask job in childJobs) { 464 465 HiveJob childHiveJob = allHiveJobs[job.Id]; 465 466 parentHiveJob.AddChildHiveJob(childHiveJob); … … 481 482 482 483 public static ItemJob LoadItemJob(Guid jobId) { 483 JobData jobData = ServiceLocator.Instance.CallHiveService(s => s.GetJobData(jobId));484 TaskData jobData = ServiceLocator.Instance.CallHiveService(s => s.GetJobData(jobId)); 484 485 try { 485 486 return PersistenceUtil.Deserialize<ItemJob>(jobData.Data);
Note: See TracChangeset
for help on using the changeset viewer.