/// <summary>
        /// Delete project
        /// </summary>
        private void BuildProject()
        {
            var stopWatch = Stopwatch.StartNew();
            var indexId   = AnalyticsProject.GetIndexIdForProject(_jobParameter.MatterId, WorkAssignment.JobId, _dataset.CollectionId,
                                                                  _jobParameter.ProjectCollectionId);
            var indexService = AnalyticsProject.GetAnalyticalEngineIndexService(_jobParameter.MatterId, WorkAssignment.JobId, indexId);

            AnalyticsProject.BuildProjectInAnalyticalEngine(_jobParameter.MatterId, WorkAssignment.JobId, indexService, indexId);
            stopWatch.Stop();
            Tracer.Info("Job {0} : Time taken for build project in Analytical Engine  {1} m.s ", WorkAssignment.JobId, stopWatch.ElapsedMilliseconds);
        }
        /// <summary>
        ///     Begins the work.
        /// </summary>
        protected override void BeginWork()
        {
            BootParameters.ShouldNotBe(null);
            base.BeginWork();

            _jobParameter =
                (AnalyticsProjectInfo)XmlUtility.DeserializeObject(BootParameters, typeof(AnalyticsProjectInfo));
            _analyticProject = new AnalyticsProject();

            _documentBachSize =
                Convert.ToInt32(
                    ApplicationConfigurationManager.GetValue("IncludeDocumentsIntoProjectInSubSystemJobBatchSize",
                                                             "AnalyticsProject"));
            _dataset =
                DataSetBO.GetDataSetDetailForDataSetId(Convert.ToInt64(_jobParameter.DatasetId,
                                                                       CultureInfo.CurrentCulture));
            _jobParameter.DocumentSource.CollectionId = _dataset.CollectionId;

            _totalDocumentCount =
                _analyticProject.GetProjectDocumentsCountByTaskId(
                    Convert.ToInt64(_jobParameter.MatterId, CultureInfo.CurrentCulture),
                    _jobParameter.ProjectCollectionId, _jobParameter.PrimarySystemJobId);
            //Update job log initial state
            var jobSummaryKeyValuePairs = new EVKeyValuePairs();

            JobMgmtBO.UpdateJobResult(WorkAssignment.JobId, 0, _totalDocumentCount,
                                      jobSummaryKeyValuePairs);

            if (_jobParameter.IsRerunJob || _jobParameter.IsAddAdditionalDocuments) //Rerun job or Add additional documents- need get to get existing IndexId ,if already created
            {
                _indexId = AnalyticsProject.GetIndexIdForProject(_jobParameter.MatterId, WorkAssignment.JobId,
                                                                 _dataset.CollectionId, _jobParameter.ProjectCollectionId, false);
            }

            if (string.IsNullOrEmpty(_indexId))
            {
                _indexId = "idx-" + Guid.NewGuid().ToString().ToLowerInvariant();
                _analyticProject.InsertIndexId(_jobParameter.MatterId, WorkAssignment.JobId, _dataset.CollectionId,
                                               _jobParameter.ProjectCollectionId, _indexId);
            }
            AnalyticsProject.CreateAnalyticalIndex(_jobParameter.MatterId, WorkAssignment.JobId, _indexId);  //Create Index in Spark SVM..
            IncreaseProcessedDocumentsCount(_totalDocumentCount);
        }
예제 #3
0
        protected override void ProcessMessage(PipeMessageEnvelope message)
        {
            try
            {
                if (string.IsNullOrEmpty(_indexId))
                {
                    _indexId = AnalyticsProject.GetIndexIdForProject(_jobParameter.MatterId, WorkAssignment.JobId,
                                                                     _dataset.CollectionId, _jobParameter.ProjectCollectionId);
                }

                if (_indexService == null)
                {
                    //Get Indexservice
                    _indexService = AnalyticsProject.GetAnalyticalEngineIndexService(_jobParameter.MatterId,
                                                                                     WorkAssignment.JobId, _indexId);
                }


                var projectDocumentCollection = (ProjectDocumentCollection)message.Body;
                projectDocumentCollection.ShouldNotBe(null);
                projectDocumentCollection.Documents.ShouldNotBe(null);
                var documents = projectDocumentCollection.Documents.Select(projectDocument => new Business.Analytics.DocumentIdentifier
                {
                    ReferenceId = projectDocument.DocumentReferenceId,
                    DocId       = projectDocument.DocId,
                    Url         = projectDocument.TextFilePath
                }).ToList();

                _analyticProject = new AnalyticsProject();
                _analyticProject.AddDocumentsInAnalyticalEngine(_jobParameter.MatterId, _dataset.CollectionId, _jobParameter, documents, _indexService,
                                                                _indexId, WorkAssignment.JobId);

                Send(projectDocumentCollection);
            }
            catch (Exception ex)
            {
                ex.Trace().Swallow();
                ReportToDirector(ex);
            }
        }