Пример #1
0
 private async Task LogCleanupAsync(TaskExecutionCheckpointRequest checkpoint)
 {
     try
     {
         await _taskExecutionRepository.CheckpointAsync(checkpoint).ConfigureAwait(false);
     }
     catch (Exception) { }
 }
Пример #2
0
 private async Task LogEmptyBlockEventAsync(string taskExecutionId, string appName, string taskName)
 {
     var checkPointRequest = new TaskExecutionCheckpointRequest()
     {
         TaskExecutionId = taskExecutionId,
         Message         = "No values for generate the block. Emtpy Block context returned.",
         TaskId          = new TaskId(appName, taskName)
     };
     await _taskExecutionRepository.CheckpointAsync(checkPointRequest).ConfigureAwait(false);
 }
Пример #3
0
        private void LogEmptyBlockEvent(string taskExecutionId, string appName, string taskName)
        {
            var checkPointRequest = new TaskExecutionCheckpointRequest()
            {
                TaskExecutionId = taskExecutionId,
                Message         = "No values for generate the block. Emtpy Block context returned.",
                TaskId          = new TaskId(appName, taskName)
            };

            _taskExecutionRepository.Checkpoint(checkPointRequest);
        }
Пример #4
0
        public async Task CheckpointAsync(string checkpointMessage)
        {
            if (!IsExecutionContextActive)
            {
                throw new ExecutionException(NotActiveMessage);
            }

            var request = new TaskExecutionCheckpointRequest()
            {
                TaskId          = new TaskId(_taskExecutionInstance.ApplicationName, _taskExecutionInstance.TaskName),
                TaskExecutionId = _taskExecutionInstance.TaskExecutionId,
                Message         = checkpointMessage
            };
            await _taskExecutionRepository.CheckpointAsync(request).ConfigureAwait(false);
        }
Пример #5
0
        public void Checkpoint(string checkpointMessage)
        {
            if (!IsExecutionContextActive)
            {
                throw new ExecutionException(NotActiveMessage);
            }

            var request = new TaskExecutionCheckpointRequest()
            {
                TaskId          = new TaskId(_taskExecutionInstance.ApplicationName, _taskExecutionInstance.TaskName),
                TaskExecutionId = _taskExecutionInstance.TaskExecutionId,
                Message         = checkpointMessage
            };

            _taskExecutionRepository.Checkpoint(request);
        }
Пример #6
0
        private async Task StartCleanOldDataAsync(string applicationName, string taskName, string taskExecutionId)
        {
            var checkpoint = new TaskExecutionCheckpointRequest()
            {
                TaskExecutionId = taskExecutionId,
                TaskId          = new TaskId(applicationName, taskName)
            };

            try
            {
                var configuration = _tasklingConfiguration.GetTaskConfiguration(applicationName, taskName);
                var request       = new CleanUpRequest()
                {
                    TaskId = new TaskId(applicationName, taskName),
                    GeneralDateThreshold            = DateTime.UtcNow.AddDays(-1 * configuration.KeepGeneralDataForDays),
                    ListItemDateThreshold           = DateTime.UtcNow.AddDays(-1 * configuration.KeepListItemsForDays),
                    TimeSinceLastCleaningThreashold = new TimeSpan(configuration.MinimumCleanUpIntervalHours, 0, 0)
                };
                var cleaned = await _cleanUpRepository.CleanOldDataAsync(request).ConfigureAwait(false);

                if (cleaned)
                {
                    checkpoint.Message = "Data clean up performed";
                }
                else
                {
                    checkpoint.Message = "Data clean up skipped";
                }
            }
            catch (Exception ex)
            {
                checkpoint.Message = "Failed to clean old data. " + ex;
            }

            await LogCleanupAsync(checkpoint).ConfigureAwait(false);
        }
 public async Task CheckpointAsync(TaskExecutionCheckpointRequest taskExecutionRequest)
 {
     await RegisterEventAsync(taskExecutionRequest.TaskId, taskExecutionRequest.TaskExecutionId, EventType.CheckPoint, taskExecutionRequest.Message).ConfigureAwait(false);
 }
 public void Checkpoint(TaskExecutionCheckpointRequest taskExecutionRequest)
 {
     RegisterEvent(taskExecutionRequest.TaskId, taskExecutionRequest.TaskExecutionId, EventType.CheckPoint, taskExecutionRequest.Message);
 }