/// <summary> /// Initializes a new instance of the <see cref="StepStatus" /> class. /// </summary> /// <param name="inputs">The inputs used by this step. (required).</param> /// <param name="outputs">The outputs produced by this step. (required).</param> /// <param name="startedAt">The time at which the task was started (required).</param> /// <param name="id">The step unique ID (required).</param> /// <param name="name">A human readable name for the step. Usually defined by the DAG task name but can be extended if the step is part of a loop for example. This name is unique within the boundary of the DAG/Job that generated it. (required).</param> /// <param name="statusType">The type of step this status is for. Can be \"Function\", \"DAG\" or \"Loop\" (required).</param> /// <param name="templateRef">The name of the template that spawned this step (required).</param> /// <param name="childrenIds">A list of child step IDs (required).</param> /// <param name="outboundSteps">A list of the last step to ran in the context of this step. In the case of a DAG or a job this will be the last step that has been executed. It will remain empty for functions. (required).</param> /// <param name="annotations">An optional dictionary to add annotations to inputs. These annotations will be used by the client side libraries..</param> /// <param name="message">Any message produced by the task. Usually error/debugging hints..</param> /// <param name="finishedAt">The time at which the task was completed.</param> /// <param name="source">Source url for the status object. It can be a recipe or a function..</param> /// <param name="status">The status of this step..</param> /// <param name="command">The command used to run this step. Only applies to Function steps..</param> /// <param name="boundaryId">This indicates the step ID of the associated template root step in which this step belongs to. A DAG step will have the id of the parent DAG for example..</param> public StepStatus ( List <AnyOf <StepStringInput, StepIntegerInput, StepNumberInput, StepBooleanInput, StepFolderInput, StepFileInput, StepPathInput, StepArrayInput, StepJSONObjectInput> > inputs, List <AnyOf <StepStringOutput, StepIntegerOutput, StepNumberOutput, StepBooleanOutput, StepFolderOutput, StepFileOutput, StepPathOutput, StepArrayOutput, StepJSONObjectOutput> > outputs, DateTime startedAt, string id, string name, StatusType statusType, string templateRef, List <string> childrenIds, List <string> outboundSteps, // Required parameters Dictionary <string, string> annotations = default, string message = default, DateTime finishedAt = default, string source = default, StepStatusEnum status = StepStatusEnum.Unknown, string command = default, string boundaryId = default // Optional parameters ) : base() // BaseClass { // to ensure "inputs" is required (not null) this.Inputs = inputs ?? throw new ArgumentNullException("inputs is a required property for StepStatus and cannot be null"); // to ensure "outputs" is required (not null) this.Outputs = outputs ?? throw new ArgumentNullException("outputs is a required property for StepStatus and cannot be null"); this.StartedAt = startedAt; // to ensure "id" is required (not null) this.Id = id ?? throw new ArgumentNullException("id is a required property for StepStatus and cannot be null"); // to ensure "name" is required (not null) this.Name = name ?? throw new ArgumentNullException("name is a required property for StepStatus and cannot be null"); this.StatusType = statusType; // to ensure "templateRef" is required (not null) this.TemplateRef = templateRef ?? throw new ArgumentNullException("templateRef is a required property for StepStatus and cannot be null"); // to ensure "childrenIds" is required (not null) this.ChildrenIds = childrenIds ?? throw new ArgumentNullException("childrenIds is a required property for StepStatus and cannot be null"); // to ensure "outboundSteps" is required (not null) this.OutboundSteps = outboundSteps ?? throw new ArgumentNullException("outboundSteps is a required property for StepStatus and cannot be null"); this.Annotations = annotations; this.Message = message; this.FinishedAt = finishedAt; this.Source = source; this.Status = status; this.Command = command; this.BoundaryId = boundaryId; // Set non-required readonly properties with defaultValue this.Type = "StepStatus"; }
public void AddVerification(string expected, string actual, StepStatusEnum status) { if (_expectedResults == null) { _expectedResults = new List <string>(new string[] { expected }); } else { _expectedResults.Add(expected); } if (_actualResults == null) { _actualResults = new List <string>(new string[] { actual }); } else { _actualResults.Add(actual); } if (((int)status) > ((int)_status)) { this.Outcome = status; } }
//public StepInfo AddStep(string description, string expected, string name) //{ // StepInfo newStep, oldStep = null; // newStep = new StepInfo(description, expected, name) // { // Id = Convert.ToString(this.Steps.Count + 1), // Name = Convert.ToString(this.Steps.Count + 1), // Section = $"{this.Section}/step[{this.Steps.Count + 1}]", // }; // newStep.StatusChanged += Step_StatusChanged; // if (this.Steps.Count > 0) // oldStep = this.Steps[this.Steps.Count - 1]; // this.Steps.Add(newStep); // OnStepAdded(newStep, oldStep); // return newStep; //} public StepInfo AddStep(string description, string expected, string actual, StepStatusEnum status, string name = null) { StepInfo newStep, oldStep = null; string id = ReporterManager.GenerateStepId(); newStep = new StepInfo(description, expected, actual, status, name) { Id = id, // Convert.ToString(this.Steps.Count + 1), Section = $"{this.Section}/step[@id='{id}']", // $"{this.Section}/step[{this.Steps.Count + 1}]", }; if (String.IsNullOrEmpty(name)) { newStep.Name = GetStepName(); } //newStep.Name = Convert.ToString(this.Steps.Count + 1); newStep.StatusChanged += Step_StatusChanged; if (this.Steps.Count > 0) { oldStep = this.Steps[this.Steps.Count - 1]; } this.Steps.Add(newStep); OnStepAdded(newStep, oldStep); return(newStep); }
public StepInfo(string description, string expected, string actual, StepStatusEnum status, string name = null) { _description = description; if (expected != null) { _expectedResults = new List <string>(new string[] { expected }); } if (actual != null) { _actualResults = new List <string>(new string[] { actual }); } _status = status; if (name != null) { _name = name; } _startTime = new Timestamp(DateTime.UtcNow); }
public void SetStatus(StepStatusEnum value) { _status = value; }
/// <summary> /// Execute this step. /// </summary> protected override void ExecuteMain() { try { this.Status = StepStatusEnum.Executing; this.ResultDetail = new StepResultDetail(""); int result = 0; StepStatusEnum stepStatus = StepStatusEnum.Executing; //lock (GlobalSettings.StepStatus) //{ // stepStatus = GlobalSettings.StepStatus.GetValueOrDefault( // typeof(ExportDataFromSqlServerStep).Name, StepStatusEnum.NotExecutable); //} //if (stepStatus != StepStatusEnum.NotExecutable) //{ do { try { result += DataImporter.CopyDataFiles(Settings.Default.CopyDataFiles_From, Settings.Default.CopyDataFiles_To, Properties.Settings.Default.CopyDataFiles_DeleteSource); } catch (System.IO.IOException ioex) { ExceptionHelper.CentralProcess(ioex); Log.Info("Goto wait and then will start another try..."); goto WaitAndAgain; } if (MessageBox.Show("Finished one round of copy, do you want to start a new round?", "Rule perf automation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No) { stepStatus = StepStatusEnum.Pass; break; } WaitAndAgain: System.Threading.Thread.Sleep(60000); //lock (GlobalSettings.StepStatus) //{ // stepStatus = GlobalSettings.StepStatus.GetValueOrDefault( // typeof(ExportDataFromSqlServerStep).Name, StepStatusEnum.NotExecutable); //} } while (true || stepStatus == StepStatusEnum.Executing || stepStatus == StepStatusEnum.Deploying || stepStatus == StepStatusEnum.DeployingCompleted); switch (stepStatus) { case StepStatusEnum.Cancelled: this.Status = StepStatusEnum.Failed; this.ResultDetail.Message += "Failed due to step {0} cancelled.".FormatWith(typeof(ExportDataFromSqlServerStep).Name); break; case StepStatusEnum.Failed: this.Status = StepStatusEnum.Failed; this.ResultDetail.Message += "Failed due to step {0} failed.".FormatWith(typeof(ExportDataFromSqlServerStep).Name); break; case StepStatusEnum.Pass: this.Status = StepStatusEnum.Pass; break; case StepStatusEnum.Warning: this.Status = StepStatusEnum.Warning; this.ResultDetail.Message += "Warning due to step {0}'s result is warning.".FormatWith(typeof(ExportDataFromSqlServerStep).Name); break; default: break; } //} //else //{ // result += DataImporter.CopyDataFiles(Settings.Default.CopyDataFiles_From, Settings.Default.CopyDataFiles_To, true); // this.Status = StepStatusEnum.Pass; //} this.ResultDetail.Message += "Successfully copied {0} file(s) from '{1}' to '{2}'.".FormatWith(result, Settings.Default.TransferFolder, Settings.Default.BedTransferFolder); } catch (Exception ex) { this.Status = StepStatusEnum.Failed; this.ResultDetail = new StepResultDetail("Error has occurred, please check log.", ExceptionHelper.CentralProcessSingle2(ex)); } finally { if (this.ResultDetail != null) { Log.Info(this.ResultDetail.Message); } } }