Ejemplo n.º 1
0
        public static void GeneratePlot(AzureExperimentManager aeMan, Tags tags, string prefix, ComparableExperiment refE, int refId, int id, string outputPath)
        {
            Console.WriteLine("Generating plot for #{0}...", id);
            System.Diagnostics.Debug.Print("Starting task for job #{0}", id);
            ComparableExperiment e = Helpers.GetComparableExperiment(id, aeMan).Result;

            Comparison cmp   = new Comparison(refE, e, prefix.Replace('|', '/'), tags);
            Chart      chart = Charts.BuildComparisonChart(prefix, cmp);

            chart.SaveImage(Path.Combine(outputPath, String.Format("{0}-{1}.png", refId, id)), ChartImageFormat.Png);

            e = null; cmp = null; chart = null;
            System.GC.Collect();
            System.Diagnostics.Debug.Print("Ending task for job #{0}", id);
        }
Ejemplo n.º 2
0
        public static async Task Run(string prefix, string outputPath, string repositoryPath)
        {
            Console.WriteLine("Connecting...");
            var    sStorage = new SecretStorage(Settings.Default.AADApplicationId, Settings.Default.AADApplicationCertThumbprint, Settings.Default.KeyVaultUrl);
            string cString  = await sStorage.GetSecret(Settings.Default.ConnectionStringSecretId);

            AzureSummaryManager    sMan  = new AzureSummaryManager(cString, Helpers.GetDomainResolver());
            AzureExperimentManager aeMan = AzureExperimentManager.Open(cString);
            Tags tags = await Helpers.GetTags(Settings.Default.SummaryName, sMan);

            Console.WriteLine("Loading timeline...");
            Timeline timeline = await Helpers.GetTimeline(Settings.Default.SummaryName, aeMan, sMan, cString);

            // Numbers: 4.5.0 = 8023; suspect 8308 -> 8312
            Directory.CreateDirectory(outputPath);

            int refId = 8023;

            Console.WriteLine("Loading reference #{0}...", refId);
            ComparableExperiment refE = await Helpers.GetComparableExperiment(refId, aeMan);

            List <Task> tasks = new List <Task>();

            for (int i = 0; i < timeline.Experiments.Length; i++)
            {
                ExperimentViewModel e = timeline.Experiments[i];
                if (e.Id < refId)
                {
                    continue;
                }
                //tasks.Add(GeneratePlot(aeMan, tags, prefix, refE, refId, e.Id, outputPath));
                //GeneratePlot(aeMan, tags, prefix, refE, refId, e.Id, outputPath);
                if (i > 0 && e.Id != refId)
                {
                    GenerateLog(repositoryPath, outputPath, timeline.Experiments[i - 1].Id, e.Id, timeline.Experiments[i - 1].SubmissionTime, e.SubmissionTime);
                }
                //if (e.Id == 8099) break;
            }

            //ParallelOptions popts = new ParallelOptions();
            //popts.MaxDegreeOfParallelism = 1;
            //ParallelLoopResult r = Parallel.ForEach(tasks, popts, t => t.Wait());

            //Task.WaitAll(tasks.ToArray());

            //await Task.WhenAll(tasks);
        }