/// <summary> /// Initializes a new instance of the <see cref="T:System.Object"/> class. /// </summary> /// <remarks>Arun: Made the constructor public because Activator.CreateInstance in Director requires this.</remarks> public Pipeline() { PipelineStatus = new PipelineStatus { PipelineState = PipelineState.Empty }; PipelineSections = new List <PipelineSection>(); StatisticsAvailable = false; }
protected bool CheckPipelineForCompletion() { if (PipelineStatus.GetMostRecentState() != PipelineState.FirstWorkerCompleted) { return(false); } // Debugging //foreach (var pipelineSection in PipelineSections) //{ // if (pipelineSection.DataPipeName != null /*&& pipelineSection.DataPipeName.Count > 0*/) // { // Tracer.Debug("Pipeline section {0} contains {1} messages.", pipelineSection.Name, pipelineSection.DataPipeName.Count); // } //} // When in the Running state we can check all data pipes sequentially and if they all are empty this means we are done if (PipelineSections.Any(pipelineSection => pipelineSection.DataPipeName != null && pipelineSection.DataPipeName.Count > 0)) { return(false); } Tracer.Info("Pipeline detected that there are no more messages in the pipes."); try { if (!Completed()) { Tracer.Info("Custom Pipeline completion handler requested continuation of pipeline operation."); return(false); } } catch (Exception ex) { ex.Trace(); ProblemReport problemReport = new ProblemReport("Pipeline completion", WorkerStage.EndWork, ex); PipelineStatus.ProblemReports.Add(problemReport); } if (PipelineStatus.ProblemReports.Any()) { Tracer.Warning("Pipeline detected job completion WITH ERRORS in {0:0.##} seconds.", _runTime.Elapsed.TotalSeconds); PipelineStatus.PipelineState = PipelineState.ProblemReported; return(true); } Tracer.Warning("Pipeline detected job completion without errors in {0:0.##} seconds.", _runTime.Elapsed.TotalSeconds); PipelineStatus.PipelineState = PipelineState.Completed; return(true); }
private void UpdatePipelineState(PipeMessageEnvelope envelope, out bool continueMessagePumping) { continueMessagePumping = true; if (envelope != null) { ProcessReport(envelope); if (PipelineStatus.GetMostRecentState() == PipelineState.AllWorkersQuit) { continueMessagePumping = false; } } else { // No reports to process, so we have a little idle time CheckPipelineForCompletion(); } ReportPipelineStatus("PIPELINE STATUS: ", false); }
protected void ReportPipelineStatus(string header, bool finalStatus) { if (!StatisticsAvailable) { return; // Nothing to report yet } if (PipelineStatus.GetMostRecentState() != PipelineState.Running && PipelineStatus.GetMostRecentState() != PipelineState.FirstWorkerCompleted) { // We don't need to report pipeline status unless it is Running or FirstWorkerCompleted return; } if (_timeSinceTheLastProgressReport.Elapsed < _speedReportInterval) { return; } ForceReportPipelineStatus(header, finalStatus); PeriodicPipelineServicingHook(); }