// Token: 0x0600149B RID: 5275 RVA: 0x000766EC File Offset: 0x000748EC
 public void OnWorkCycleCheckpoint()
 {
     try
     {
         if (this.peopleRelevancePipeline == null)
         {
             PipelineContext pipelineContext;
             this.peopleRelevancePipeline = InferencePipelineUtil.CreateAndStartTrainingPipeline(base.DatabaseInfo.Guid.ToString(), this.DiagnosticsSession, "PeopleRelevancePipelineDefinition.xml", "PeopleRelevance", PeopleRelevanceAssistantType.InferencePipelineVersion, out pipelineContext);
         }
         this.DiagnosticsSession.Assert(this.peopleRelevancePipeline != null, "People Relevance Pipeline is null", new object[0]);
         if (this.peopleRelevancePipelineFeeder == null)
         {
             this.peopleRelevancePipelineFeeder = new PeopleRelevanceFeeder(this.peopleRelevancePipeline);
         }
     }
     catch (InvalidOperationException ex)
     {
         if (!(ex.InnerException is FileNotFoundException))
         {
             throw;
         }
         this.DiagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Failures, "PeopleRelevanceAssistant.OnWorkCycleCheckpoint: FAILED to create people relevance pipeline because definition file doesn't exist.  Exception: {0}", new object[]
         {
             ex
         });
     }
 }
 // Token: 0x0600118D RID: 4493 RVA: 0x00066895 File Offset: 0x00064A95
 protected override void OnShutdownInternal()
 {
     this.DiagnosticsSession.TraceDebug("ShutDown is called on the service. Sending Abort processing signal to the pipeline", new object[0]);
     if (this.trainingPipelineContext != null)
     {
         InferencePipelineUtil.SetAbortOnProcessing(this.trainingPipelineContext);
     }
 }
 // Token: 0x0600118B RID: 4491 RVA: 0x00066790 File Offset: 0x00064990
 public void OnWorkCycleCheckpoint()
 {
     if (this.trainingPipeline == null)
     {
         this.trainingPipeline = InferencePipelineUtil.CreateAndStartTrainingPipeline(base.DatabaseInfo.Guid.ToString(), this.DiagnosticsSession, "InferenceTrainingPipelineDefinition.xml", "Training", InferenceTrainingAssistant.InferencePipelineVersion, out this.trainingPipelineContext);
         InferenceModel.GetInstance(this.trainingPipelineContext.GetProperty <string>(DocumentSchema.PipelineInstanceName)).Reset();
     }
     this.DiagnosticsSession.Assert(this.trainingPipeline != null, "Training Pipeline is null", new object[0]);
     this.DiagnosticsSession.Assert(this.trainingPipelineContext != null, "Training Pipeline Context is null", new object[0]);
     if (this.trainingFeeder == null)
     {
         this.trainingFeeder = new InferenceTrainingFeeder(this.trainingPipeline, this.trainingPipelineContext, "InferenceTrainingAssistant", this.trainingStatusLogger, this.truthLabelsStatusLogger);
     }
 }
Example #4
0
        protected override void InternalProcessDocument(DocumentContext data)
        {
            object obj = null;

            if (data.Document.TryGetProperty(PeopleRelevanceSchema.IsBasedOnRecipientInfoData, out obj) && (bool)obj)
            {
                this.DiagnosticsSession.TraceDebug("RecipientInfo-based relevance is enabled. Skip processing SentItems", new object[0]);
                return;
            }
            DocumentProcessingContext documentProcessingContext = data.AsyncResult.AsyncState as DocumentProcessingContext;

            Util.ThrowOnConditionFailed(documentProcessingContext != null, "Context object passed in async call is not of type DocumentProcessingContext");
            Util.ThrowOnMismatchType <Document>(data.Document, "data.Document");
            Document document = data.Document as Document;

            this.DiagnosticsSession.TraceDebug <IIdentity>("Processing document - {0}", document.Identity);
            IList <IDocument> list     = null;
            IDocument         property = document.GetProperty <IDocument>(PeopleRelevanceSchema.SentItemsTrainingSubDocument);

            this.DiagnosticsSession.TraceDebug <int>("Count of nested documents in the training set - {0}", property.NestedDocuments.Count);
            if (document.TryGetProperty(PeopleRelevanceSchema.CurrentTimeWindowNumber, out obj))
            {
                document.SetProperty(PeopleRelevanceSchema.TimeWindowNumberAtLastRun, (long)obj);
            }
            bool flag = false;

            foreach (IDocument document2 in property.NestedDocuments)
            {
                if (base.PipelineContext != null && InferencePipelineUtil.IsAbortOnProcessingRequested((PipelineContext)base.PipelineContext))
                {
                    flag = true;
                    break;
                }
                this.DiagnosticsSession.TraceDebug <IIdentity>("Processing mini document - {0}", document2.Identity);
                using (MdbDocument mdbDocument = MdbInferenceFactory.Current.CreateFullDocument(document2, documentProcessingContext, MdbPeoplePropertyMap.Instance, PeopleRelevanceDocumentFactory.SentItemsFullDocumentProperties))
                {
                    this.DiagnosticsSession.TraceDebug <IIdentity>("Creating full document succeeded - {0}", mdbDocument.Identity);
                    if (document.TryGetProperty(PeopleRelevanceSchema.ContactList, out obj))
                    {
                        mdbDocument.SetProperty(PeopleRelevanceSchema.ContactList, obj);
                    }
                    if (document.TryGetProperty(PeopleRelevanceSchema.CurrentTimeWindowStartTime, out obj))
                    {
                        mdbDocument.SetProperty(PeopleRelevanceSchema.CurrentTimeWindowStartTime, obj);
                        mdbDocument.SetProperty(PeopleRelevanceSchema.CurrentTimeWindowNumber, document.GetProperty <long>(PeopleRelevanceSchema.CurrentTimeWindowNumber));
                    }
                    if (document.TryGetProperty(PeopleRelevanceSchema.MailboxOwner, out obj))
                    {
                        mdbDocument.SetProperty(PeopleRelevanceSchema.MailboxOwner, obj);
                    }
                    this.DiagnosticsSession.TraceDebug <IIdentity>("Pushing full document to the nested pipeline - {0}", mdbDocument.Identity);
                    try
                    {
                        this.NestedPipeline.ProcessDocument(mdbDocument, documentProcessingContext);
                        this.DiagnosticsSession.TraceDebug <IIdentity>("Processing full document in the nested pipeline completed without exceptions - {0}", mdbDocument.Identity);
                        if (mdbDocument.TryGetProperty(PeopleRelevanceSchema.SentTime, out obj))
                        {
                            document2.SetProperty(PeopleRelevanceSchema.SentTime, obj);
                        }
                        else
                        {
                            this.DiagnosticsSession.TraceDebug <IIdentity>("Missing sent time property in full document after completing nested pipeline - {0}", mdbDocument.Identity);
                        }
                        IDictionary <string, IInferenceRecipient> property2 = mdbDocument.GetProperty <IDictionary <string, IInferenceRecipient> >(PeopleRelevanceSchema.ContactList);
                        document.SetProperty(PeopleRelevanceSchema.ContactList, property2);
                        ExDateTime property3 = mdbDocument.GetProperty <ExDateTime>(PeopleRelevanceSchema.CurrentTimeWindowStartTime);
                        document.SetProperty(PeopleRelevanceSchema.CurrentTimeWindowStartTime, property3);
                        long property4 = mdbDocument.GetProperty <long>(PeopleRelevanceSchema.CurrentTimeWindowNumber);
                        document.SetProperty(PeopleRelevanceSchema.CurrentTimeWindowNumber, property4);
                    }
                    catch (ComponentException ex)
                    {
                        if (list == null)
                        {
                            list = new List <IDocument>(property.NestedDocuments.Count);
                        }
                        this.DiagnosticsSession.TraceError <IIdentity, string>("Received an operation failed exception while processing mini document - {0} message- {1}", document2.Identity, ex.Message);
                        this.DiagnosticsSession.TraceDebug <IIdentity>("Adding the mini document - {0} to the failed Documents collection", document2.Identity);
                        this.DiagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Warnings, string.Format("U={0} - Received an operation failed exception while processing mini document - {1} message- {2}", documentProcessingContext.Session.MailboxOwner.MailboxInfo.PrimarySmtpAddress, document2.Identity, ex.Message), new object[0]);
                        list.Add(document2);
                    }
                }
            }
            if (flag)
            {
                throw new AbortOnProcessingRequestedException();
            }
            int num = 0;

            if (list != null && list.Count > 0)
            {
                num = list.Count;
                this.DiagnosticsSession.TraceDebug <int>("Count of failed Documents - {0}", num);
                property.RemoveDocuments(list);
                if (property.NestedDocuments.Count == 0)
                {
                    throw new NestedDocumentCountZeroException();
                }
            }
            this.DiagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Informational, string.Format("U={0} - NestedSentItemsPipeline: {1} messages processed successfully, {2} messages failed", documentProcessingContext.Session.MailboxOwner.MailboxInfo.PrimarySmtpAddress, property.NestedDocuments.Count, num), new object[0]);
        }