Changeset 14901 for trunk/sources/HeuristicLab.Clients.Hive
- Timestamp:
- 05/02/17 09:41:39 (7 years ago)
- Location:
- trunk/sources/HeuristicLab.Clients.Hive/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveClient.cs
r14185 r14901 441 441 if (refreshableJob.IsFinished()) { 442 442 refreshableJob.ExecutionState = Core.ExecutionState.Stopped; 443 } else { 443 } else if (refreshableJob.IsPaused()) { 444 refreshableJob.ExecutionState = Core.ExecutionState.Paused; 445 } else { 444 446 refreshableJob.ExecutionState = Core.ExecutionState.Started; 445 447 } -
trunk/sources/HeuristicLab.Clients.Hive/3.3/RefreshableJob.cs
r14185 r14901 304 304 } 305 305 GC.Collect(); // force GC, because .NET is too lazy here (deserialization takes a lot of memory) 306 if ( AllJobsFinished()) {307 this.ExecutionState = Core.ExecutionState.Stopped;306 if (IsFinished()) { 307 ExecutionState = ExecutionState.Stopped; 308 308 StopResultPolling(); 309 } else if (IsPaused()) { 310 ExecutionState = ExecutionState.Paused; 311 StopResultPolling(); 312 } else { 313 ExecutionState = ExecutionState.Started; 309 314 } 310 315 UpdateTotalExecutionTime(); … … 330 335 job.FinishedCount = jobs.Count(j => j.Task.State == TaskState.Finished); 331 336 OnJobStatisticsChanged(); 332 }333 334 public bool AllJobsFinished() {335 return this.GetAllHiveTasks().All(j => (j.Task.State == TaskState.Finished336 || j.Task.State == TaskState.Aborted337 || j.Task.State == TaskState.Failed)338 && !j.IsDownloading);339 337 } 340 338 … … 513 511 this.RefreshAutomatically = false; 514 512 StopResultPolling(); 513 } else if (IsPaused()) { 514 this.executionState = Core.ExecutionState.Paused; 515 this.RefreshAutomatically = false; 516 StopResultPolling(); 515 517 } else { 516 518 this.RefreshAutomatically = true; … … 527 529 this.OnStateLogListChanged(); 528 530 529 if (this.ExecutionState != ExecutionState.Stopped ) {531 if (this.ExecutionState != ExecutionState.Stopped && this.ExecutionState != ExecutionState.Paused) { 530 532 this.RefreshAutomatically = true; 531 533 } … … 584 586 585 587 public bool IsFinished() { 586 return HiveTasks != null 587 && HiveTasks.All(x => x.Task.DateFinished.HasValue && x.Task.DateCreated.HasValue); 588 var tasks = GetAllHiveTasks(); 589 return tasks.All(x => x.Task.State == TaskState.Finished 590 || x.Task.State == TaskState.Aborted 591 || x.Task.State == TaskState.Failed); 592 } 593 594 public bool IsPaused() { 595 var tasks = GetAllHiveTasks().Where(x => !x.Task.IsParentTask); 596 return tasks.All(x => x.Task.State != TaskState.Waiting 597 && x.Task.State != TaskState.Transferring 598 && x.Task.State != TaskState.Calculating) 599 && tasks.Any(x => x.Task.State == TaskState.Paused); 588 600 } 589 601
Note: See TracChangeset
for help on using the changeset viewer.