public void RemoteBashCmdLineExecuteDifferentPlaces()
        {
            var rootFile = TestUtils.CreateFileOfInt(20);

            // Run the query the first & second times.
            var q     = new SimpleTTreeExecutorQueriable <TestNtupe>(new[] { rootFile.AsRemoteBashUri(), rootFile.AsRemoteBashUri(machine: "testmachine2.txt") }, "dude", typeof(ntuple));
            var dude1 = q.Count();

            // Make sure we got a good hit on the cache and that we actually executed query once.
            var t = ((DefaultQueryProvider)q.Provider).Executor as TTreeQueryExecutor;

            Assert.AreEqual(2, t.CountExecutionRuns);
        }
        public void RemoteBashCmdLineCacheRepeatedSplitRequest()
        {
            var rootFile = TestUtils.CreateFileOfInt(20);

            // Run the query the first & second times.
            var q     = new SimpleTTreeExecutorQueriable <TestNtupe>(new[] { rootFile.AsRemoteBashUri(workers: 2), rootFile.AsRemoteBashUri(workers: 2) }, "dude", typeof(ntuple));
            var dude1 = q.Count();
            var dude2 = q.Count();

            // Make sure we got a good hit on the cache and that we actually executed query once (but on two machines).
            var t = ((DefaultQueryProvider)q.Provider).Executor as TTreeQueryExecutor;

            Assert.AreEqual(1, t.CountCacheHits);
            Assert.AreEqual(2, t.CountExecutionRuns);
        }
Пример #3
0
        public void TTreeWithZeroEntriesButConcat()
        {
            const int numberOfIter = 10;
            var       rootFile     = TestUtils.CreateFileOfInt(numberOfIter);

            var q      = new SimpleTTreeExecutorQueriable <singleIntNtuple>(new[] { rootFile }, "dude", typeof(ntuple));
            var result = q.Where(e => false).Concat(q).AsTTree(outputROOTFile: new FileInfo("TTreeWithZeroEntriesButConcat.root"));

            Assert.IsNotNull(result);
            Assert.AreEqual(2, result.Length);

            var fout = ROOTNET.NTFile.Open(result[1].FullName, "READ");
            var t    = fout.Get("DataTree") as NTTree;

            Assert.IsNotNull(t);
            Assert.AreEqual(0, t.GetEntries());
        }
        public void RemoteBashCmdLineStressTestSingle()
        {
            var rootFile = TestUtils.CreateFileOfInt(20);
            int nfiles   = 10;
            var finfo    = new FileInfo(rootFile.LocalPath);
            var files    = Enumerable.Range(0, nfiles)
                           .Select(index => finfo.CopyTo($"{finfo.DirectoryName}\\{Path.GetFileNameWithoutExtension(finfo.Name)}_{index}{finfo.Extension}"))
                           .Select(u => new Uri(u.FullName).AsRemoteBashUri())
                           .ToArray();

            // Run the query the first & second times.
            var q     = new SimpleTTreeExecutorQueriable <TestNtupe>(files, "dude", typeof(ntuple));
            var dude1 = q.Count();

            Assert.AreEqual(20 * nfiles, dude1);

            // Make sure we got a good hit on the cache and that we actually executed query once.
            var t = ((DefaultQueryProvider)q.Provider).Executor as TTreeQueryExecutor;

            Assert.AreEqual(1, t.CountExecutionRuns);
        }
        public void RunNestedConcat()
        {
            const int numberOfIter = 10;
            var rootFile1 = TestUtils.CreateFileOfInt(numberOfIter);
            var proxyFile1 = TestUtils.GenerateROOTProxy(rootFile1, "dude");
            ntuple._gProxyFile = proxyFile1.FullName;
            var q1 = new SimpleTTreeExecutorQueriable<TestNtupe>(new[] { rootFile1 }, "dude", typeof(ntuple));

            var rootFile2 = TestUtils.CreateFileOfVectorDouble(numberOfIter);
            var proxyFile2 = TestUtils.GenerateROOTProxy(rootFile2, "dude");
            ntuple2._gProxyFile = proxyFile2.FullName;
            var q2 = new SimpleTTreeExecutorQueriable<TestNtupeArrD>(new[] { rootFile2 }, "dude", typeof(ntuple2));

            var dude = q2.SelectMany(e => e.myvectorofdouble).Select(i => (int)1).Concat(q1.Select(eb => (int)1)).Count();

            Assert.AreEqual(numberOfIter * 10 + numberOfIter, dude);
        }
        public void RunSimpleConcatTwoSourceAsFiles()
        {
            const int numberOfIter = 10;
            var rootFile1 = TestUtils.CreateFileOfInt(numberOfIter);
            var rootFile2 = TestUtils.CreateFileOfInt(numberOfIter*2);

            var proxyFile1 = TestUtils.GenerateROOTProxy(rootFile1, "dude");
            ntuple._gProxyFile = proxyFile1.FullName;
            var q1 = new SimpleTTreeExecutorQueriable<TestNtupe>(new[] { rootFile1 }, "dude", typeof(ntuple));

            var q2 = new SimpleTTreeExecutorQueriable<TestNtupe>(new[] { rootFile2 }, "dude", typeof(ntuple));

            var dude = q1.Concat(q2).AsTTree();

            foreach (var f in dude)
            {
                Console.WriteLine(f.FullName);
            }

            Assert.AreEqual(2, dude.Length);
            Assert.AreNotEqual(dude[0].Name, dude[1].Name);
        }
        public void RunSimpleConcatTwoSourceAsFilesDifferentQueries()
        {
            const int numberOfIter = 10;
            var rootFile1 = TestUtils.CreateFileOfInt(numberOfIter);
            var proxyFile1 = TestUtils.GenerateROOTProxy(rootFile1, "dude");
            ntuple._gProxyFile = proxyFile1.FullName;
            var q1 = new SimpleTTreeExecutorQueriable<TestNtupe>(new[] { rootFile1 }, "dude", typeof(ntuple));

            var rootFile2 = TestUtils.CreateFileOfVectorDouble(numberOfIter);
            var proxyFile2 = TestUtils.GenerateROOTProxy(rootFile2, "dude");
            ntuple2._gProxyFile = proxyFile2.FullName;
            var q2 = new SimpleTTreeExecutorQueriable<TestNtupeArrD>(new[] { rootFile2 }, "dude", typeof(ntuple2));

            var dude = q2.SelectMany(e => e.myvectorofdouble).Select(i => (int)1).Concat(q1.Select(e => (int)1)).AsTTree();

            foreach (var f in dude)
            {
                Console.WriteLine(f.FullName);
            }

            Assert.AreEqual(2, dude.Length);
            Assert.AreNotEqual(dude[0].Name, dude[1].Name);
        }
        public void RunSimpleConcatWithLatetake()
        {
            const int numberOfIter = 10;
            var rootFile = TestUtils.CreateFileOfInt(numberOfIter);
            var proxyFile = TestUtils.GenerateROOTProxy(rootFile, "dude");
            ntuple._gProxyFile = proxyFile.FullName;

            var q = new SimpleTTreeExecutorQueriable<TestNtupe>(new[] { rootFile }, "dude", typeof(ntuple));
            var dude = q.Concat(q).TakePerSource(6).Count();

            Assert.AreEqual(12, dude);
        }