diff --git a/src/Microsoft.ComponentDetection.Orchestrator/Experiments/ExperimentService.cs b/src/Microsoft.ComponentDetection.Orchestrator/Experiments/ExperimentService.cs index 7a5a3c3a9..435c0f76a 100644 --- a/src/Microsoft.ComponentDetection.Orchestrator/Experiments/ExperimentService.cs +++ b/src/Microsoft.ComponentDetection.Orchestrator/Experiments/ExperimentService.cs @@ -109,13 +109,18 @@ private void FilterExperiments(IComponentDetector detector, int count) } /// - public async Task FinishAsync() + public async Task FinishAsync(bool shouldCheckAutomaticProcessFlag = false) { if (!DetectorExperiments.AreExperimentsEnabled) { return; } + if (!shouldCheckAutomaticProcessFlag && !Orchestrator.AutomaticallyProcessExperiments) + { + return; + } + foreach (var (config, experiment) in this.experiments) { var controlComponents = experiment.ControlGroupComponents; diff --git a/src/Microsoft.ComponentDetection.Orchestrator/Experiments/IExperimentService.cs b/src/Microsoft.ComponentDetection.Orchestrator/Experiments/IExperimentService.cs index 958d45df7..5bdf03576 100644 --- a/src/Microsoft.ComponentDetection.Orchestrator/Experiments/IExperimentService.cs +++ b/src/Microsoft.ComponentDetection.Orchestrator/Experiments/IExperimentService.cs @@ -22,5 +22,5 @@ public interface IExperimentService /// Called when all detectors have finished executing. Processes the experiments and reports the results. /// /// A representing the asynchronous operation. - Task FinishAsync(); + Task FinishAsync(bool shouldCheckAutomaticProcessFlag = false); } diff --git a/src/Microsoft.ComponentDetection.Orchestrator/Orchestrator.cs b/src/Microsoft.ComponentDetection.Orchestrator/Orchestrator.cs index bf3aeee9c..5776f6382 100644 --- a/src/Microsoft.ComponentDetection.Orchestrator/Orchestrator.cs +++ b/src/Microsoft.ComponentDetection.Orchestrator/Orchestrator.cs @@ -29,6 +29,8 @@ namespace Microsoft.ComponentDetection.Orchestrator; public class Orchestrator { + public const bool AutomaticallyProcessExperiments = false; + private static readonly bool IsLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux); private readonly IServiceProvider serviceProvider; diff --git a/src/Microsoft.ComponentDetection.Orchestrator/Services/DetectorProcessingService.cs b/src/Microsoft.ComponentDetection.Orchestrator/Services/DetectorProcessingService.cs index 572ba9708..e488fae42 100644 --- a/src/Microsoft.ComponentDetection.Orchestrator/Services/DetectorProcessingService.cs +++ b/src/Microsoft.ComponentDetection.Orchestrator/Services/DetectorProcessingService.cs @@ -86,9 +86,9 @@ public async Task ProcessDetectorsAsync(IDetectionArgu record.DetectedComponentCount = detectedComponents.Count(); var dependencyGraphs = componentRecorder.GetDependencyGraphsByLocation().Values; record.ExplicitlyReferencedComponentCount = dependencyGraphs.Select(dependencyGraph => - { - return dependencyGraph.GetAllExplicitlyReferencedComponents(); - }) + { + return dependencyGraph.GetAllExplicitlyReferencedComponents(); + }) .SelectMany(x => x) .Distinct() .Count(); @@ -122,6 +122,7 @@ public async Task ProcessDetectorsAsync(IDetectionArgu }).ToList(); var results = await Task.WhenAll(scanTasks); + await this.experimentService.FinishAsync(); var detectorProcessingResult = this.ConvertDetectorResultsIntoResult(results, exitCode);