// Token: 0x06000134 RID: 308 RVA: 0x00007C84 File Offset: 0x00005E84 private static void HandleImplicitMarkAsNotClutter(MapiEvent mapiEvent, MailboxSession session, MessageItem message, List <KeyValuePair <string, object> > customDataToLog) { ConversationId valueOrDefault = message.GetValueOrDefault <ConversationId>(ItemSchema.ConversationId, null); if (valueOrDefault == null) { customDataToLog.Add(new KeyValuePair <string, object>("InferenceDiagnostics", "ConversationIdNull")); return; } message.Load(new PropertyDefinition[] { ItemSchema.ConversationFamilyId }); ConversationId valueOrDefault2 = message.GetValueOrDefault <ConversationId>(ItemSchema.ConversationFamilyId, null); if (valueOrDefault2 == null) { customDataToLog.Add(new KeyValuePair <string, object>("InferenceDiagnostics", "ConversationFamilyIdNull")); return; } VariantConfigurationSnapshot flightFeatures = FlightModule.GetFlightFeatures(session); StoreObjectId[] folderIds = new StoreObjectId[] { session.GetDefaultFolderId(DefaultFolderType.Drafts) }; ICoreConversation coreConversation; if (flightFeatures != null && flightFeatures.DataStorage.ModernMailInfra.Enabled && !flightFeatures.DataStorage.ThreadedConversation.Enabled) { ConversationFamilyFactory conversationFamilyFactory = new ConversationFamilyFactory(session, valueOrDefault2); coreConversation = conversationFamilyFactory.CreateConversation(valueOrDefault, folderIds, true, false, InferenceProcessor.ConversationMessagePropertiesToLoad); } else { coreConversation = Conversation.Load(session, valueOrDefault, folderIds, true, false, InferenceProcessor.ConversationMessagePropertiesToLoad); } ConversationClutterInformation conversationClutterInformation = MdbConversationClutterInformationFactory.GetConversationClutterInformation(null, session, flightFeatures, coreConversation); if (conversationClutterInformation != null) { conversationClutterInformation.MarkItemsAsNotClutter(true); } }
// Token: 0x0600118E RID: 4494 RVA: 0x000668D4 File Offset: 0x00064AD4 public override AssistantTaskContext InitialStep(AssistantTaskContext context) { DateTime utcNow = DateTime.UtcNow; DateTime? dateTime = null; DateTime? dateTime2 = null; DateTime? dateTime3 = null; DateTime? dateTime4 = null; Guid guid = Guid.Empty; AssistantTaskContext result; try { this.ValidateContext(context); guid = context.Args.StoreSession.MailboxGuid; ExDateTime?valueOrDefault = context.Args.StoreSession.Mailbox.GetValueOrDefault <ExDateTime?>(MailboxSchema.InferenceTrainingLastAttemptTimestamp, null); if (valueOrDefault != null) { dateTime = new DateTime?(valueOrDefault.Value.UniversalTime); } valueOrDefault = context.Args.StoreSession.Mailbox.GetValueOrDefault <ExDateTime?>(MailboxSchema.InferenceTrainingLastSuccessTimestamp, null); if (valueOrDefault != null) { dateTime2 = new DateTime?(valueOrDefault.Value.UniversalTime); } valueOrDefault = context.Args.StoreSession.Mailbox.GetValueOrDefault <ExDateTime?>(MailboxSchema.InferenceTruthLoggingLastAttemptTimestamp, null); if (valueOrDefault != null) { dateTime3 = new DateTime?(valueOrDefault.Value.UniversalTime); } valueOrDefault = context.Args.StoreSession.Mailbox.GetValueOrDefault <ExDateTime?>(MailboxSchema.InferenceTruthLoggingLastSuccessTimestamp, null); if (valueOrDefault != null) { dateTime4 = new DateTime?(valueOrDefault.Value.UniversalTime); } MailboxSession mailboxSession = context.Args.StoreSession as MailboxSession; if (mailboxSession == null) { string text = "Reason=NonMailboxSession"; this.trainingStatusLogger.LogStatus(guid, 4, new DateTime?(utcNow), dateTime, dateTime2, text); this.truthLabelsStatusLogger.LogStatus(mailboxSession.MailboxGuid, 4, new DateTime?(utcNow), dateTime3, dateTime4, text); this.groupingModelTrainingStatusLogger.LogStatus(guid, 4, text); result = null; } else if (mailboxSession.MailboxOwner.RecipientTypeDetails != RecipientTypeDetails.UserMailbox && mailboxSession.MailboxOwner.RecipientTypeDetails != RecipientTypeDetails.LinkedMailbox) { string text2 = string.Format("Reason=NonUserMailbox#Name={0}#Type={1}", mailboxSession.MailboxOwner.MailboxInfo.DisplayName, mailboxSession.MailboxOwner.RecipientTypeDetails.ToString()); this.trainingStatusLogger.LogStatus(mailboxSession.MailboxGuid, 4, new DateTime?(utcNow), dateTime, dateTime2, text2); this.truthLabelsStatusLogger.LogStatus(mailboxSession.MailboxGuid, 4, new DateTime?(utcNow), dateTime3, dateTime4, text2); this.groupingModelTrainingStatusLogger.LogStatus(mailboxSession.MailboxGuid, 4, text2); result = null; } else { VariantConfigurationSnapshot flightFeatures = FlightModule.GetFlightFeatures(mailboxSession); Exception ex; OrganizationContext organizationInformation = this.orgContentExtractor.GetOrganizationInformation(mailboxSession.MailboxOwner, new ADRecipientInfo.TraceDelegate(this.DiagnosticsSession.TraceDebug), new ADRecipientInfo.TraceDelegate(this.DiagnosticsSession.TraceError), ref ex); FolderDataSelectionConfig.RefreshSettings(); List <Exception> list = new List <Exception>(); if (ex != null) { list.Add(ex); } OutlookActivityManager.SafeProcess(mailboxSession); ActivityHistory activityHistory = new ActivityHistory(mailboxSession, utcNow); ModelVersionSelector modelVersionSelector = InferenceXsoUtil.CreateModelVersionSelector(ServerModelConfigurationWrapper.CurrentWrapper, mailboxSession, delegate(string str) { this.DiagnosticsSession.TraceDebug(str, new object[0]); }); result = new InferenceTrainingTaskContext(context.MailboxData, context.Job, new AssistantStep(this.TrainStep), new MailboxTrainingState(modelVersionSelector, organizationInformation, activityHistory, utcNow, dateTime, dateTime2, flightFeatures, list), new MailboxTruthLoggingState(utcNow, dateTime3, dateTime4, activityHistory)); } } catch (Exception ex2) { string text3 = string.Format("Reason=InitialStepFailed#Exception={0}", InferenceCommonUtility.StringizeException(ex2)); this.trainingStatusLogger.LogStatus(guid, 3, new DateTime?(utcNow), dateTime, dateTime2, text3); this.truthLabelsStatusLogger.LogStatus(guid, 3, new DateTime?(utcNow), dateTime3, dateTime4, text3); this.groupingModelTrainingStatusLogger.LogStatus(guid, 3, text3); throw; } return(result); }
public void OnPromotedMessageHandler(StoreDriverEventSource source, StoreDriverDeliveryEventArgs args) { this.wasMessageDelivered = false; this.logValues = null; StoreDriverDeliveryEventArgsImpl storeDriverDeliveryEventArgsImpl = (StoreDriverDeliveryEventArgsImpl)args; Stopwatch stopwatch = Stopwatch.StartNew(); InferencePropertyBag inferencePropertyBag = new InferencePropertyBag(); MdbDocument mdbDocument = null; VariantConfigurationSnapshot variantConfigurationSnapshot = null; try { InferenceClassificationAgent.tracer.TraceDebug(0L, "Called InferenceClassificationAgent.OnPromotedMessageHandler"); inferencePropertyBag.Add(InferenceSchema.MessageClassificationTime, ExDateTime.UtcNow); inferencePropertyBag.Add(InferenceSchema.ServerName, this.server.Name); if (storeDriverDeliveryEventArgsImpl.MailboxSession != null) { inferencePropertyBag.Add(DocumentSchema.MailboxId, storeDriverDeliveryEventArgsImpl.MailboxSession.MailboxGuid.ToString()); inferencePropertyBag.Add(InferenceSchema.ClutterEnabled, storeDriverDeliveryEventArgsImpl.MailboxSession.Mailbox.GetValueOrDefault <bool>(MailboxSchema.InferenceClutterEnabled, false)); inferencePropertyBag.Add(InferenceSchema.ClassificationEnabled, storeDriverDeliveryEventArgsImpl.MailboxSession.Mailbox.GetValueOrDefault <bool>(MailboxSchema.InferenceClassificationEnabled, false)); inferencePropertyBag.Add(InferenceSchema.HasBeenClutterInvited, storeDriverDeliveryEventArgsImpl.MailboxSession.Mailbox.GetValueOrDefault <bool>(MailboxSchema.InferenceHasBeenClutterInvited, false)); } inferencePropertyBag.Add(InferenceSchema.InternetMessageId, storeDriverDeliveryEventArgsImpl.ReplayItem.InternetMessageId); inferencePropertyBag.Add(InferenceSchema.Locale, InferenceClassificationAgent.GetLocale(storeDriverDeliveryEventArgsImpl)); if (storeDriverDeliveryEventArgsImpl.MailboxOwner != null && storeDriverDeliveryEventArgsImpl.MailboxOwner.OrganizationId != null && storeDriverDeliveryEventArgsImpl.MailboxOwner.OrganizationId.OrganizationalUnit != null) { inferencePropertyBag.Add(InferenceSchema.TenantName, storeDriverDeliveryEventArgsImpl.MailboxOwner.OrganizationId.OrganizationalUnit.Name); } if (!InferenceClassificationAgent.IsMailboxInteresting(storeDriverDeliveryEventArgsImpl)) { inferencePropertyBag.Add(InferenceSchema.ClassificationStatus, InferenceClassificationAgentLogger.Status.Skipped); inferencePropertyBag.Add(InferenceSchema.ClassificationStatusMessage, "MailboxNotInteresting"); } else if (!InferenceClassificationAgent.IsMessageInteresting(storeDriverDeliveryEventArgsImpl)) { inferencePropertyBag.Add(InferenceSchema.ClassificationStatus, InferenceClassificationAgentLogger.Status.Skipped); inferencePropertyBag.Add(InferenceSchema.ClassificationStatusMessage, "MessageNotInteresting"); } else { storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies = (storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies ?? new Dictionary <PropertyDefinition, object>()); Guid guid = Guid.NewGuid(); storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies[MessageItemSchema.InferenceMessageIdentifier] = guid; inferencePropertyBag.Add(InferenceSchema.MessageIdentifier, guid); variantConfigurationSnapshot = FlightModule.GetFlightFeatures(storeDriverDeliveryEventArgsImpl.MailboxOwner); if (variantConfigurationSnapshot != null) { inferencePropertyBag.Add(InferenceSchema.UserFlightFeatures, variantConfigurationSnapshot); } IDeliveryClassificationStrategy deliveryClassificationStrategy = ClassificationStrategyFactory.Create(storeDriverDeliveryEventArgsImpl.MailboxSession, variantConfigurationSnapshot); inferencePropertyBag.Add(InferenceSchema.IsUiEnabled, deliveryClassificationStrategy != null); OriginalDeliveryFolderInfo originalDeliveryFolderInfo = InferenceClassificationAgent.GetOriginalDeliveryFolderInfo(storeDriverDeliveryEventArgsImpl); storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies[ItemSchema.OriginalDeliveryFolderInfo] = originalDeliveryFolderInfo.Serialize(); inferencePropertyBag.Add(InferenceSchema.OriginalDeliveryFolder, originalDeliveryFolderInfo); if (!InferenceClassificationAgent.IsDeliveryFolderInteresting(originalDeliveryFolderInfo)) { inferencePropertyBag.Add(InferenceSchema.ClassificationStatus, InferenceClassificationAgentLogger.Status.Skipped); inferencePropertyBag.Add(InferenceSchema.ClassificationStatusMessage, "DeliveryFolderNotInteresting"); } else if (!this.isPipelineEnabled) { inferencePropertyBag.Add(InferenceSchema.ClassificationStatus, InferenceClassificationAgentLogger.Status.Failed); inferencePropertyBag.Add(InferenceSchema.ClassificationStatusMessage, "PipelineDisabled"); InferenceClassificationProcessing.NumberOfItemsSkippedDueToDisabledPipeline.Increment(); } else { ConversationClutterInformation conversationClutterInformation = null; bool flag = false; InferenceClassificationResult inferenceClassificationResult = InferenceClassificationResult.None; if (this.RunClassificationPipeline(storeDriverDeliveryEventArgsImpl, inferencePropertyBag, variantConfigurationSnapshot, out mdbDocument, out flag, out conversationClutterInformation)) { if (flag) { inferenceClassificationResult |= InferenceClassificationResult.IsClutterModel; } string value = string.Empty; bool flag2 = false; bool flag3; InferenceClassificationResult inferenceClassificationResult2; string text; bool flag4; if (InferenceClassificationAgent.CheckForRuleAndConversationOverrides(storeDriverDeliveryEventArgsImpl.SharedPropertiesBetweenAgents, originalDeliveryFolderInfo, out flag3, out inferenceClassificationResult2, out text, out flag4)) { flag = flag3; value = text; } inferenceClassificationResult |= inferenceClassificationResult2; if (flag4 && conversationClutterInformation != null) { flag = conversationClutterInformation.IsNewMessageClutter(flag, out flag2); } inferencePropertyBag.Add(InferenceSchema.IsClutter, flag); if (flag) { inferenceClassificationResult |= InferenceClassificationResult.IsClutterFinal; } if (deliveryClassificationStrategy != null) { deliveryClassificationStrategy.ApplyClassification(storeDriverDeliveryEventArgsImpl, inferenceClassificationResult); if (flag2 && conversationClutterInformation != null) { conversationClutterInformation.MarkItemsAsNotClutter(); } } storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies[ItemSchema.InferenceClassificationResult] = inferenceClassificationResult; inferencePropertyBag.Add(InferenceSchema.InferenceClassificationResult, inferenceClassificationResult); inferencePropertyBag.Add(InferenceSchema.ClassificationStatus, InferenceClassificationAgentLogger.Status.Succeeded); inferencePropertyBag.Add(InferenceSchema.ClassificationStatusMessage, value); } } } } catch (Exception ex) { if (ex is OutOfMemoryException || ex is StackOverflowException || ex is ThreadAbortException) { throw; } Exception innerException = ex.InnerException; if (innerException is StorageTransientException) { InferenceClassificationProcessing.NumberOfTransientExceptions.Increment(); } else if (innerException is QuotaExceededException) { InferenceClassificationProcessing.NumberOfQuotaExceededExceptions.Increment(); } this.diagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Failures, "Received exception {0}", new object[] { ex }); inferencePropertyBag.Add(InferenceSchema.ClassificationStatus, InferenceClassificationAgentLogger.Status.Failed); inferencePropertyBag.Add(InferenceSchema.ClassificationStatusMessage, "Exception"); inferencePropertyBag.Add(InferenceSchema.ClassificationAgentException, ex); } finally { stopwatch.Stop(); InferenceClassificationAgent.tracer.TraceDebug <long>((long)this.GetHashCode(), "InferenceClassification agent took {0} ms to process the item.", stopwatch.ElapsedMilliseconds); inferencePropertyBag.Add(InferenceSchema.TimeTakenToClassify, stopwatch.ElapsedMilliseconds); if (storeDriverDeliveryEventArgsImpl.MailboxSession != null) { InferenceClassificationAgent.RecordPerformanceCounter(storeDriverDeliveryEventArgsImpl.MailboxSession.MdbGuid.ToString(), stopwatch.ElapsedMilliseconds); } InferenceClassificationTracking inferenceClassificationTracking = InferenceClassificationTracking.Create(); this.logValues = this.classificationAgentLogger.ExtractClassificationProperties(inferencePropertyBag, mdbDocument, inferenceClassificationTracking); if (variantConfigurationSnapshot != null && variantConfigurationSnapshot.Inference.InferenceStampTracking.Enabled) { storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies[MessageItemSchema.InferenceClassificationTrackingEx] = inferenceClassificationTracking.ToString(); } if (mdbDocument != null) { mdbDocument.Dispose(); mdbDocument = null; } } }