public ExtractorRegullarExpression(IArtifactQueries artifactQueries, Int32 workspaceArtifactId, RDO extractorRegullarExpressionRdo, ErrorLogModel errorLogModel) { WorkspaceArtifactId = workspaceArtifactId; ArtifactQueries = artifactQueries; ErrorLogModel = errorLogModel; SetMyProperties(extractorRegullarExpressionRdo); }
public ExtractorProfile(IArtifactFactory artifactFactory, Int32 workspaceArtifactId, RDO extractorProfileRdo, ErrorLogModel errorLogModel) { WorkspaceArtifactId = workspaceArtifactId; ArtifactFactory = artifactFactory; ExtractorTargetTexts = new List <IExtractorTargetText>(); ErrorLogModel = errorLogModel; SetMyProperties(extractorProfileRdo); }
public ExtractorTargetText(IArtifactQueries artifactQueries, IServicesMgr servicesMgr, ExecutionIdentity executionIdentity, Int32 workspaceArtifactId, RDO extractorTargetTextRdo, ErrorLogModel errorLogModel) { //ErrorQueue = errorQueue; ServicesMgr = servicesMgr; ExecutionIdentity = executionIdentity; WorkspaceArtifactId = workspaceArtifactId; ArtifactQueries = artifactQueries; TextExtractionUtility = new TextExtractionUtility(new TextExtractionValidator()); TargetRule = new TargetRule(extractorTargetTextRdo); ErrorLogModel = errorLogModel; SetMyProperties(extractorTargetTextRdo); }
public WorkerQueue(ISqlQueryHelper sqlQueryHelper, IArtifactQueries artifactQueries, ArtifactFactory artifactFactory, IDBContext eddsDbContext, IServicesMgr servicesMgr, ExecutionIdentity executionIdentity, Int32 agentId, Int32 resourceServerId, String batchTableName, TextExtractorLog textExtractorLog, ExtractorSetReporting textExtractorJobReporting) { InitializeDefaults(); SqlQueryHelper = sqlQueryHelper; ArtifactQueries = artifactQueries; EddsDbContext = eddsDbContext; ServicesMgr = servicesMgr; ExecutionIdentity = executionIdentity; AgentId = agentId; ResourceServerId = resourceServerId; BatchTableName = batchTableName; TextExtractorLog = textExtractorLog; Records = GetWorkerQueueRecords(textExtractorJobReporting, artifactFactory); TextExtractorJobReporting = textExtractorJobReporting; ArtifactFactory = artifactFactory; ErrorLogModel = new ErrorLogModel(sqlQueryHelper, eddsDbContext, agentId, QueueTableName); }
public void ProcessAllRecords() { string[] emailRecepients = null; try { if (HasRecords) { //update job status to worker - in progress TextExtractorLog.RaiseUpdate(String.Format("Updating record status to {0}. [WorkspaceArtifactId: {1}, ExtractorSetArtifactID: {2}]", Constant.ExtractorSetStatus.IN_PROGRESS_WORKER_PROCESSING, WorkspaceArtifactId, ExtractorSetArtifactId)); ArtifactQueries.UpdateRdoStringFieldValue(ServicesMgr, ExecutionIdentity.CurrentUser, WorkspaceArtifactId, Constant.Guids.ObjectType.ExtractorSet, Constant.Guids.Fields.ExtractorSet.Status, ExtractorSetArtifactId, Constant.ExtractorSetStatus.IN_PROGRESS_WORKER_PROCESSING); var countForLogging = 1; foreach (var workerQueueRecord in Records) { TextExtractorLog.RaiseUpdate(String.Format("Processing record - {0}. [WorkspaceArtifactId: {1}, ExtractorSetArtifactID: {2}, DocumentArtifactId: {3}]", countForLogging++, WorkspaceArtifactId, ExtractorSetArtifactId, workerQueueRecord.DocumentArtifactId)); //check for ExtractorSet cancellation var extractorSet = ArtifactFactory.GetInstanceOfExtractorSet(ExecutionIdentity.CurrentUser, WorkspaceArtifactId, ExtractorSetArtifactId); emailRecepients = extractorSet.EmailRecepients; if (extractorSet.IsCancellationRequested()) { TextExtractorLog.RaiseUpdate("Cancellation Requested."); //delete all remaining records in current batch worker queue because the ExtractorSet is cancelled TextExtractorLog.RaiseUpdate("Deleting all the remaining records in current worker queue batch."); SqlQueryHelper.RemoveBatchFromQueue(EddsDbContext, BatchTableName); return; } try { workerQueueRecord.Process(); } catch (Exception ex) { var errorContext = String.Format("An error occured when processing the document. [WorkspaceArtifactId: {0}, ExtractorSetArtifactId: {1}, DocumentArtifactId: {2}]", workerQueueRecord.WorkspaceArtifactId, workerQueueRecord.ExtractorSetArtifactId, workerQueueRecord.DocumentArtifactId); //log error message to ErrorLog table ErrorLogModel.InsertRecord(errorContext, ex, workerQueueRecord.QueueId, workerQueueRecord.WorkspaceArtifactId); //Update TextExtractorErrors field on the Document object incase of error var exceptionMessage = ExceptionMessageFormatter.GetInnerMostExceptionMessage(ex); String extractorSetName = ArtifactQueries.GetExtractorSetNameForArtifactId(ServicesMgr, ExecutionIdentity, WorkspaceArtifactId, workerQueueRecord.ExtractorSetArtifactId); var fieldValue = String.Format(Constant.ErrorMessages.DOCUMENT_ERROR_ENCOUNTERED, exceptionMessage, extractorSetName); ArtifactQueries.AppendToDocumentLongTextFieldValue(ServicesMgr, ExecutionIdentity, workerQueueRecord.WorkspaceArtifactId, workerQueueRecord.DocumentArtifactId, Constant.Guids.Fields.Document.TextExtractorErrors, fieldValue); //Update ExtractorSet Details field ArtifactQueries.UpdateExtractorSetDetails(ServicesMgr, ExecutionIdentity, workerQueueRecord.WorkspaceArtifactId, workerQueueRecord.ExtractorSetArtifactId, Constant.ExtractorSetStatus.DetailMessages.COMPLETE_WITH_ERRORS_DETAILS); } finally { //delete current record from worker queue SqlQueryHelper.RemoveRecordFromWorkerQueue(EddsDbContext, workerQueueRecord.QueueTableName, workerQueueRecord.QueueId); } } } } catch (Exception ex) { throw new CustomExceptions.TextExtractorException("An error occured when processing records in the worker queue.", ex); } finally { VerifyAndUpdateWorkerStatusToComplete(); if (emailRecepients != null) { VerifyAndSendEmailForExtractorSetComplete(emailRecepients); } } }