コード例 #1
0
        private async Task DeleteJobErrors(IServicesMgr svcManager, ExecutionIdentity identityCurrentUser, Int32 workspaceArtifactId, Int32 jobArtifactID)
        {
            var jobErrorArtifactIDs = await ArtifactQueries.QueryJobErrors(svcManager, identityCurrentUser, workspaceArtifactId, jobArtifactID, Constant.Guids.ObjectType.ImportUtilityJobErrors, Constant.Guids.Field.ImportUtilityJobErrors.ImportUtilityJob);

            if (jobErrorArtifactIDs != null & jobErrorArtifactIDs.Any())
            {
                var artifactTypeId = SqlQueryHelper.RetrieveArtifactTypeIdByGuidAsync(DbContext, Constant.Guids.ObjectType.ImportUtilityJobErrors).Result;
                await ArtifactQueries.DeleteJobErrors(svcManager, identityCurrentUser, workspaceArtifactId, jobErrorArtifactIDs.ToList(), artifactTypeId);
            }
        }
コード例 #2
0
        private async Task FinalizeJobStatiaticsAsync(ExportManagerQueueRecord exportManagerQueueRecord, Int32 actualNumberOfExportedRecords)
        {
            var jobRDO = await RetrieveExportJobRDO(exportManagerQueueRecord);

            var expectedNumberOfExports = jobRDO[Constant.Guids.Field.ExportUtilityJob.Expected].ValueAsWholeNumber.GetValueOrDefault();

            if (expectedNumberOfExports > 0)
            {
                var notExported = (await ArtifactQueries.QueryJobErrors(RsapiApiOptions, RsapiRepositoryGroup.RdoRepository, exportManagerQueueRecord.WorkspaceArtifactId, exportManagerQueueRecord.ExportJobArtifactId)).Count();
                await ArtifactQueries.UpdateExportJobStatitics(
                    rdoRepository : RsapiRepositoryGroup.RdoRepository,
                    rsapiApiOptions : RsapiApiOptions,
                    workspaceArtifactId : exportManagerQueueRecord.WorkspaceArtifactId,
                    jobArtifactID : exportManagerQueueRecord.ExportJobArtifactId,
                    expectedNumberOfExports : expectedNumberOfExports,
                    actualNumberOfExports : actualNumberOfExportedRecords,
                    notExported : notExported,
                    recordsThatHaveBeenProcessed : expectedNumberOfExports);
            }
        }
コード例 #3
0
        public async Task <Response> ExecutePreCascadeDelete()
        {
            var response = new Response {
                Success = true, Message = string.Empty
            };

            try
            {
                var dtExportJobErrors = SqlQueryHelper.RetrieveJobErrorsFromTempTable(DbContext, TempTableName);

                if (dtExportJobErrors != null && dtExportJobErrors.Rows.Count > 0)
                {
                    var jobArtifactIDs = dtExportJobErrors.Rows.OfType <DataRow>().Select(dr => dr.Field <Int32>("ArtifactID")).ToList();
                    var setStatus      = await ArtifactQueries.RetrieveRdoJobStatusAsync(SvcManager, WorkspaceArtifactId, IdentityCurrentUser, jobArtifactIDs[0]);

                    if (!string.IsNullOrEmpty(setStatus))
                    {
                        switch (setStatus)
                        {
                        case Constant.Status.Job.SUBMITTED:
                        case Constant.Status.Job.IN_PROGRESS_MANAGER:
                        case Constant.Status.Job.IN_PROGRESS_WORKER:
                        case Constant.Status.Job.COMPLETED_MANAGER:
                        case Constant.Status.Job.CANCELREQUESTED:
                        case Constant.Status.Job.RETRY:
                            response.Success   = false;
                            response.Exception = new SystemException(Constant.ErrorMessages.NotSupportedJobDeletion);
                            break;

                        case Constant.Status.Job.CANCELLED:
                        case Constant.Status.Job.COMPLETED:
                        case Constant.Status.Job.COMPLETED_WITH_ERRORS:
                        case Constant.Status.Job.ERROR:
                        case Constant.Status.Job.NEW:
                            Logger.LogDebug($"{Constant.Names.ApplicationName} - Delete Export Job button clicked.");

                            if (jobArtifactIDs.Count > 0)
                            {
                                Logger.LogDebug($"{Constant.Names.ApplicationName} - Delete Export Job button click, {jobArtifactIDs.Count} Export Job Errors found.");

                                var jobErrorArtifactIDs = await ArtifactQueries.QueryJobErrors(SvcManager, IdentityCurrentUser, WorkspaceArtifactId, jobArtifactIDs[0], Constant.Guids.ObjectType.ExportUtilityJobErrors, Constant.Guids.Field.ExportUtilityJobErrors.ExportUtilityJob);

                                var errorArtifactIDs = jobErrorArtifactIDs as int[] ?? jobErrorArtifactIDs.ToArray();
                                if (jobErrorArtifactIDs != null & errorArtifactIDs.Any())
                                {
                                    var artifactTypeId = SqlQueryHelper.RetrieveArtifactTypeIdByGuidAsync(DbContext, Constant.Guids.ObjectType.ExportUtilityJobErrors).Result;
                                    await ArtifactQueries.DeleteJobErrors(SvcManager, IdentityCurrentUser, WorkspaceArtifactId, jobErrorArtifactIDs.ToList(), artifactTypeId);

                                    Logger.LogDebug($"{Constant.Names.ApplicationName} - Delete Export Job button click, {jobArtifactIDs.Count} Export Job Errors deleted.");
                                }
                            }
                            else
                            {
                                Logger.LogDebug($"{Constant.Names.ApplicationName} - Delete Export Job button click, no Export Job Errors found.");
                            }

                            Logger.LogDebug($"{Constant.Names.ApplicationName} - Delete Export Job button click action completed.");
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                response.Success   = false;
                response.Exception = new SystemException($@"{Constant.ErrorMessages.DefaultErrorPrepend}, Error Message: {ex}");
            }

            return(response);
        }