Exemple #1
0
        private void CheckOutput(Model resultModel, BenchmarkPhase phase, int?iteration = null)
        {
            var description = phase switch
            {
                BenchmarkPhase.Initial => "initial result",
                BenchmarkPhase.Update => $"model after update {iteration}",
                _ => throw new ArgumentOutOfRangeException(nameof(phase))
            };
            var jobCollection = resultModel.RootElements.OfType <IJobCollection>().FirstOrDefault();

            if (jobCollection == null)
            {
                throw new ArgumentException("No job collection found in " + description);
            }

            AssertEmpty(jobCollection.Jobs.Select(job => job.ProtocolStepName).Distinct().Where(name => !AllowedStepNames.Any(name.StartsWith)), "protocol step names", description);

            AssertEmpty(from liquidTransfer in jobCollection.Jobs.OfType <ILiquidTransferJob>()
                        from tipCavity in liquidTransfer.Tips
                        where tipCavity.TargetCavityIndex < 0 || tipCavity.TargetCavityIndex >= 96
                        select tipCavity.TargetCavityIndex.ToString(), "target cavity indices", description);

            AssertEmpty(from liquidTransfer in jobCollection.Jobs.OfType <ILiquidTransferJob>()
                        from tipCavity in liquidTransfer.Tips
                        group tipCavity by(liquidTransfer.Target?.Name, tipCavity.TargetCavityIndex, liquidTransfer.ProtocolStepName) into transferGroup
                        where transferGroup.Count() > 1
                        select $"{transferGroup.Key.Name} into cavity {transferGroup.Key.TargetCavityIndex} for {transferGroup.Key.ProtocolStepName} ({transferGroup.Count()} hits)",
                        "cavities used multiple times",
                        description);

            Report(phase, iteration, resultModel.Descendants().Count());
        }
 static void Report(BenchmarkPhase phase, int?iteration = null, string result = null)
 {
     GC.Collect();
     Console.WriteLine($"{Tool};{Query};{ChangeSet};{RunIndex};{iteration ?? 0};{phase};Time;{stopwatch.Elapsed.Ticks * 100}");
     Console.WriteLine($"{Tool};{Query};{ChangeSet};{RunIndex};{iteration ?? 0};{phase};Memory;{Environment.WorkingSet}");
     if (result != null)
     {
         Console.WriteLine($"{Tool};{Query};{ChangeSet};{RunIndex};{iteration ?? 0};{phase};Elements;{result}");
     }
 }
        private void CheckOutput(Model resultModel, BenchmarkPhase phase, int?iteration = null)
        {
            var description = phase switch
            {
                BenchmarkPhase.Initial => "initial result",
                BenchmarkPhase.Update => $"model after update {iteration}",
                _ => throw new ArgumentOutOfRangeException(nameof(phase))
            };
            var jobCollection = resultModel.RootElements.OfType <IJobCollection>().FirstOrDefault();

            if (jobCollection == null)
            {
                throw new ArgumentException("No job collection found in " + description);
            }

            AssertEmpty(jobCollection.Jobs.Select(job => job.ProtocolStepName).Distinct().Where(name => !AllowedStepNames.Any(name.StartsWith)), "protocol step names", description);

            AssertEmpty(from liquidTransfer in jobCollection.Jobs.OfType <ILiquidTransferJob>()
                        from tipCavity in liquidTransfer.Tips
                        where tipCavity.TargetCavityIndex < 0 || tipCavity.TargetCavityIndex >= 96
                        select tipCavity.TargetCavityIndex.ToString(), "target cavity indices", description);

            AssertEmpty(from liquidTransfer in jobCollection.Jobs.OfType <ILiquidTransferJob>()
                        from tipCavity in liquidTransfer.Tips
                        group tipCavity by(liquidTransfer.Target?.Name, tipCavity.TargetCavityIndex, liquidTransfer.ProtocolStepName) into transferGroup
                        where transferGroup.Count() > 1
                        select $"{transferGroup.Key.Name} into cavity {transferGroup.Key.TargetCavityIndex} for {transferGroup.Key.ProtocolStepName} ({transferGroup.Count()} hits)",
                        "cavities used multiple times",
                        description);

            var failedPlatesIncubate = from incubate in jobCollection.Jobs.OfType <IIncubateJob>()
                                       where incubate.State == JobStatus.Failed
                                       select incubate.Microplate;

            var failedPlatesWash = from wash in jobCollection.Jobs.OfType <IWashJob>()
                                   where wash.State == JobStatus.Failed
                                   select wash.Microplate;

            var failedPlates = new HashSet <ILabware>(failedPlatesIncubate.Concat(failedPlatesWash));

            var liquidTransfersPerWell = from liquidTransfer in jobCollection.Jobs.OfType <ILiquidTransferJob>()
                                         from tipCavity in liquidTransfer.Tips
                                         group tipCavity by(tipCavity.TargetCavityIndex, liquidTransfer.Target) into wellGroup
                                             where wellGroup.All(tipTransfer => tipTransfer.Status != JobStatus.Failed) && !failedPlates.Contains(wellGroup.Key.Target)
                                         select wellGroup;

            Report(phase, iteration, resultModel.Descendants().Count(), liquidTransfersPerWell.Count());
        }
Exemple #4
0
 private void Report(BenchmarkPhase phase, int?iteration = null)
 {
     GC.Collect();
     Console.WriteLine($"{Tool};{Scenario};{Model};{RunIndex};{iteration ?? 0};{phase};Time;{_stopwatch.Elapsed.Ticks * 100}");
     Console.WriteLine($"{Tool};{Scenario};{Model};{RunIndex};{iteration ?? 0};{phase};Memory;{Environment.WorkingSet}");
 }
 private void Report(BenchmarkPhase phase, int?iteration, int elements, int successfulWells)
 {
     Console.WriteLine($"{Tool};{Scenario};{Model};{RunIndex};{iteration ?? 0};{phase};Elements;{elements}");
     Console.WriteLine($"{Tool};{Scenario};{Model};{RunIndex};{iteration ?? 0};{phase};ActiveSamples;{successfulWells}");
 }
Exemple #6
0
 private void Report(BenchmarkPhase phase, int?iteration, int elements)
 {
     Console.WriteLine($"{Tool};{Scenario};{Model};{RunIndex};{iteration ?? 0};{phase};Elements;{elements}");
 }