public void Activate() { if (activated) { return; } Logging.Progress("Activating GraphManager"); activated = true; this.Reachability.UpdateReachabilityPartialOrder(this); this.MaterializeAll(); this.Controller.DoStartupBarrier(); this.currentState = InternalGraphManagerState.Active; this.Controller.Workers.WakeUp(); foreach (var streamingInput in this.streamingInputs) { streamingInput.Activate(); } this.NotifyOnStartup(); }
/// <summary> /// Blocks until all computation is complete and resources are released. /// </summary> public void Join() { if (this.CurrentState == InternalGraphManagerState.Inactive) { throw new Exception("Joining graph manager before calling Activate()"); } else { if (this.DomainReporting) { foreach (var input in this.streamingInputs) { input.Join(); } var largestRealInputEpoch = this.inputs.Max(x => x.CurrentEpoch); Logging.Info("Largest real epoch " + largestRealInputEpoch + " current stats " + RootDomainStatisticsStage.CurrentEpoch); while (this.RootDomainStatisticsStage.CurrentEpoch < largestRealInputEpoch) { this.RootDomainStatisticsStage.OnNext(new string[] { }); } Logging.Info("New stats " + RootDomainStatisticsStage.CurrentEpoch); // wait until all real inputs have drained (possibly generating new logging) if (largestRealInputEpoch > 0) { Logging.Info("Syncing stats " + (largestRealInputEpoch - 1)); this.Sync(largestRealInputEpoch - 1); } // now shut down the reporting Console.WriteLine("Calling reporting completed"); this.RootDomainStatisticsStage.OnCompleted(); } else { foreach (var input in this.streamingInputs) { input.Join(); } } // wait for all progress updates to drain. this.ProgressTracker.BlockUntilComplete(); NotifyOnShutdown(); this.isJoined = true; this.currentState = InternalGraphManagerState.Complete; } }