static void Main(string[] args)
        {
            Akavache.BlobCache.ApplicationName = "ScanTDTResults";

            //
            // Get the basic job info, and make sure the last job is something we are ready to
            // go with.
            //

            var cl        = new TDTJobAccess();
            var lastBuild = cl.GetLastBuild().Result;

            Console.WriteLine("Looking at build id={0}", lastBuild.Id);
            if (lastBuild.IsBuilding)
            {
                Console.WriteLine("  This build isn't finished!");
                return;
            }
            if (lastBuild.Status != JenkinsBuildStatus.Success)
            {
                Console.WriteLine("  Build didn't complete successfully!");
            }
            else
            {
                Console.WriteLine("  Build completed ok");
            }

            //
            // Get the various runs, and analyze them.
            // First, look at them by-build. And then the results of each one.
            //

            Console.WriteLine();
            var runs    = cl.GetRunsForBuild(lastBuild).Result;
            var byBuild = from r in runs
                          group r by r.RootCoreRelease;
            var buildList = from b in byBuild
                            select b.First();

            foreach (var b in buildList)
            {
                Console.WriteLine("Build report for release {0}", b.RootCoreRelease);
                b.BuildReport.WriteReportBuild(Console.Out, "  ").Wait();
            }

            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();
            foreach (var b in runs)
            {
                Console.WriteLine();
                Console.WriteLine("Build report for: r{1} - {0}", b.RootCoreRelease, b.AmiRecoReleaseTag);
                b.BuildReport.WriteReportRun(Console.Out, "  ").Wait();
            }
        }
Exemple #2
0
        /// <summary>
        /// Save to a file.
        /// </summary>
        /// <param name="?"></param>
        /// <param name="destination"></param>
        /// <returns></returns>
        public static async Task <FileInfo> SaveToFile(this JenkinsArtifact artifact, JenkinsBuild bld, FileInfo destination)
        {
            var url      = string.Format("{0}artifact/{1}", bld.Url, artifact.RelativePath);
            var fileData = await TDTJobAccess.GetAsBytes(url).FirstAsync();

            using (var wr = destination.Create())
            {
                wr.Write(fileData, 0, fileData.Length);
            }
            return(destination);
        }
        /// <summary>
        /// Get the build report (console text) and parse it.
        /// </summary>
        private async Task Parse()
        {
            // This is an expense operation.
            if (_parsed)
            {
                return;
            }
            _parsed = true;

            // First, get and cache the web client. If we've cached it, no worries.
            var fullLog = await TDTJobAccess.GetAsString(_build.ConsoleTextUrl);

            // Now, look for warnings during the build. This is, basically, a line-by-line search for things.
            foreach (var line in fullLog.AsLines())
            {
                if (line.Contains(": warning:"))
                {
                    BuildWarningsTotal++;
                    if (line.Contains("boost"))
                    {
                        BuildWarningsBoost++;
                    }
                }
            }

            // Look at the two artifacts. If there aren't two, then this is very bad.
            var isPassedAPath   = _build.Artifacts.Where(a => a.DisplayPath == "trigDecsion.root").FirstOrDefault();
            var featureInfoPath = _build.Artifacts.Where(a => a.DisplayPath == "associatedFeatures.root").FirstOrDefault();

            if (isPassedAPath == null || featureInfoPath == null)
            {
                Console.WriteLine("--> Build seems to be missing proper artifact files!");
                return;
            }

            // Check that we saw events, and the basic trigger stuff worked.
            var isPassedFile = await isPassedAPath.SaveToTempFile(_build, "root");

            var rf      = ROOTNET.NTFile.Open(isPassedFile.FullName, "READ");
            var hpassed = rf.Get("eventCounter") as ROOTNET.Interface.NTH1;

            FoundEvents = hpassed.Entries > 0;

            var hTrigger = rf.Get("passEvents") as ROOTNET.Interface.NTH1;
            var titles   = hTrigger.Xaxis.Labels.Zip(Enumerable.Range(1, 10), (lbl, cnt) => Tuple.Create(lbl, cnt))
                           .ToDictionary(info => (info.Item1 as ROOTNET.Interface.NTObjString).Name, info => info.Item2);

            isPassedL1Any   = (int)hTrigger.GetBinContent(titles["L1"]);
            isPassedHLTAny  = (int)hTrigger.GetBinContent(titles["HLT"]);
            isPassedWorking = isPassedL1Any > 0 && isPassedHLTAny > 0;

            rf.Close();

            // Next look at eh features results.
            var featureFile = await featureInfoPath.SaveToTempFile(_build, "root");

            rf = ROOTNET.NTFile.Open(featureFile.FullName, "READ");

            var eleFeatures = rf.Get("eleNFeature") as ROOTNET.Interface.NTH1;

            FoundElectronFeatures = (int)eleFeatures.Entries != (int)eleFeatures.GetBinContent(1);

            rf.Close();
        }