public Task Handle(BatchSubmissionCompletedEvent notification, CancellationToken cancellationToken) { using (var scope = TracingExtensions.StartServerSpan( _tracer, notification.TracingKeys, "batch-vetting-initiating")) { try { _logger.LogInformation( "Batch vetting initiated - URI: {BatchUri}", notification.BatchUri); var batchJobData = new BatchJobData { BatchUri = notification.BatchUri, TracingKeys = notification.TracingKeys }; _backgroundJobClient .Enqueue <VetBatchJob>( job => job.Execute(batchJobData, null, JobCancellationToken.Null)); } catch (Exception e) { scope.Span.Log(new Dictionary <string, object>() { { "exception", e } }); Tags.Error.Set(scope.Span, true); } return(Task.CompletedTask); } }
public Task Handle(BatchSubmissionCompletedEvent notification, CancellationToken cancellationToken) { using (var scope = TracingExtensions.StartServerSpan( _tracer, notification.TracingKeys, "batch-submission-completion")) { try { _logger.LogInformation( "Batch submission completion handled - URI: {BatchUri}", notification.BatchUri); } catch (Exception e) { scope.Span.Log(new Dictionary <string, object>() { { "exception", e } }); Tags.Error.Set(scope.Span, true); } return(Task.CompletedTask); } }
public async Task Execute(BatchJobData batchJobData, PerformContext context, IJobCancellationToken cancellationToken) { using (TracingExtensions.StartServerSpan(_tracer, batchJobData.TracingKeys, "batch-submission-feedback-generation")) { context.WriteLine($"Generating feedback doc for batch {batchJobData.BatchId}"); var batch = await _batchRepository.BatchForIdAsync(batchJobData.BatchId); var feedbackUri = _batchUriGenerator.GenerateSubmissionFeedbackUri(batch.GetBatchUri); await batch.GenerateSubmissionFeedbackAsync( feedbackUri, _batchSubmissionFeedbackStoreService); await _batchRepository.SaveChangesAsync(cancellationToken.ShutdownToken); } }
public async Task Execute(BatchJobData batchJobData, PerformContext context, IJobCancellationToken cancellationToken) { using (TracingExtensions.StartServerSpan(_tracer, batchJobData.TracingKeys, "batch-vetting-job")) { context.WriteLine($"Generating feedback doc for batch {batchJobData.BatchUri}"); var batch = await Batch.CreateAsync( batchJobData.BatchUri, _batchContentService); _batchRepository.AddBatch(batch); await _batchRepository.SaveChangesAsync(cancellationToken.ShutdownToken); await batch.Vet( _batchReportUriGenerator.GenerateVettingReportUri(batch.GetBatchUri), _vettingPlugins, _batchVettingReportStoreService); await _batchRepository.SaveChangesAsync(cancellationToken.ShutdownToken); } }