public TaskLogger(PlanHelper planHelper, Guid timelineId, Guid jobId, Guid timelineRecordId) { this.planHelper = planHelper; this.timelineId = timelineId; this.jobId = jobId; this.timelineRecordId = timelineRecordId; this.pagingLogger = new PagingLogger(planHelper, timelineId, timelineRecordId); }
public JobStatusReportingHelper(TaskMessage taskMessage) { this.taskMessage = taskMessage; var planClient = new PlanHelper(taskMessage.PlanUri, new VssBasicCredential(string.Empty, taskMessage.AuthToken), taskMessage.ProjectId, taskMessage.HubName, taskMessage.PlanId); taskLogger = new TaskLogger(planClient, taskMessage.TimelineId, taskMessage.JobId, taskMessage.TaskInstanceId); }
public PagingLogger(PlanHelper planHelper, Guid timelineId, Guid jobId) { this.planHelper = planHelper; this.timelineId = timelineId; this.jobId = jobId; _pageId = Guid.NewGuid().ToString(); _pagesFolder = Path.Combine(Path.GetTempPath(), PagingFolder); Directory.CreateDirectory(_pagesFolder); }
public async void Execute(CancellationToken cancellationToken) { // create timelinerecord if not provided await CreateTaskTimelineRecordIfRequired(cancellationToken); // initialize status report helper var jobStatusReportingHelper = new JobStatusReportingHelper(taskMessage); // report job started await jobStatusReportingHelper.ReportJobStarted("Job has started", cancellationToken); var planHelper = new PlanHelper(taskMessage.PlanUri, new VssBasicCredential(string.Empty, taskMessage.AuthToken), taskMessage.ProjectId, taskMessage.HubName, taskMessage.PlanId); var taskLogger = new TaskLogger(planHelper, taskMessage.TimelineId, taskMessage.JobId, taskMessage.TaskInstanceId); var executeTask = taskExecutionHandler.ExecuteAsync(taskLogger, cancellationToken); await jobStatusReportingHelper.ReportJobProgress("Job is in progress...", cancellationToken).ConfigureAwait(false); // start client handler execute var taskResult = await executeTask; // report job completed with status await jobStatusReportingHelper.ReportJobCompleted("Job completed", taskResult, cancellationToken); taskLogger.End(); }