Running a PROOF query on a dataset with pre-build tselector

Hi,
Using TProof::Load, I’ve managed to load and build my TSelector. I also have a dataset on the PROOF cluster I’m ready to run on. What is the simplest thing I can do to run on it?

One option, obviously, is proof.Process(“queryTestSimpleQuery.cxx+”). The problme with this is there is no queryTestSimpleQuery.h anywhere. The complete object is defined in queryTestSimpleQuery.cxx. So process fails right away. I can fix this, but it requires some real work in my infrastructure (queryTestSimpleQuery is auto-generated). So, I’d like to find a way around this.

One is to build up a TChain from teh files in the proof dataset (pretty ugly), then call TChain::SetProof(true), and then create my TSelector object, and then do “chain.Process(myobj)” - however this fails saying that it isn’t implemented.

So - is there a way I can do this, or do I have to change the way my code generates the TSelector?

I’m using 5.28 on teh client. I think I’m using 5.28 for the PROOF server too, but I’m not 100% sure.

Many thanks!

Hi,

After this

[quote=“gwatts”]What is the simplest thing I can do to run on it?

var r = proof.Load("queryTestSimpleQuery.cxx+,ntuple_CollectionTree.h,junk_macro_parsettree_CollectionTree.C");

[/quote]

the class queryTestSimpleQuery should defined. This means that you should be able to process your data by referring to the selector by name, in one of the TProof::Process signatures.
The next step is to tell PROOF which dataset you want to process. Using a TChain is a one possibility. In such a case, after doing chain->SetProof(), you should be able to do

chain->Process("queryTestSimpleQuery");

Or you can use a TFileCollection:

proof.Process(myTFileCollection,"queryTestSimpleQuery");

Or you can use the PROOF dataset support, which allows to register named TFileCollections and then to refer to them by name:

proof.RegisterDataSet("myDataset", myTFileCollection); // Only once
proof.Process("myDataset","queryTestSimpleQuery");

I suggest that you try the TChain one or TFileCollection to see if you can process your selector by name. Then you can move on to decide how to organize your datasets.

Gerri

Hi,
Sorry I took so long to get back to this - I was traveling a bit and working on PROOF @ 30K doesn’t work for me. :slight_smile:

This worked! Thanks a lot for your help. Here is some a complete bit of code for those that are interested. Though it is in a non-standard language (C#), what I’m doing is obvious, so if anyone else stumbles on this question they should be able to translate it directly to C++ or python or whatever.

using System;
namespace prooftest
{
    class Program
    {
        static void Main(string[] args)
        {
            var proof = ROOTNET.NTProof.Open("proof://XXXX.XXXX.edu");
            try
            {
                string ds = "LINQTest";
                if (!proof.ExistsDataSet(ds))
                {
                    Console.WriteLine("Data set is not defined");
                    return;
                }

                Console.WriteLine("Verifying the dataset...");
                var ver = proof.VerifyDataSet(ds);
                Console.WriteLine("Result from verification: {0}", ver);


                PushFileToMaster(proof, "ntuple_CollectionTree.h");
                PushFileToMaster(proof, "junk_macro_parsettree_CollectionTree.C");

                var r = proof.Load("queryTestSimpleQuery.cxx+,ntuple_CollectionTree.h,junk_macro_parsettree_CollectionTree.C");
                Console.WriteLine("Result of the load is {0}", r);

                var cls = ROOTNET.NTClass.GetClass("queryTestSimpleQuery");
                if (cls == null)
                    throw new InvalidOperationException("COuldn't find the selector object");

                var pr = proof.Process(string.Format("{0}#btagd3pd", ds), "queryTestSimpleQuery");
                Console.WriteLine("Result from the process is {0}.", pr);

                if (pr == 0)
                {
                    Console.WriteLine("Somethign bad happened:");
                    var logs = ROOTNET.NTProof.Mgr("XXXX.XXXX.edu").GetSessionLogs();
                    logs.Display("0.0", 0);
                    logs.Display("0.1", 0);
                    logs.Display("0.2", 0);
                    logs.Display("0.3", 0);
                }

                var o = proof.GetOutputList();
                foreach (var obj in o)
                {
                    Console.WriteLine("Output name is {0}", obj.Name);
                }

            }
            finally
            {
                proof.Close();
            }
        }

        private static void PushFileToMaster(ROOTNET.Interface.NTProof proof, string file)
        {
            var masterLocation = string.Format("~/session-{0}/master-0-{1}/", proof.SessionTag, proof.SessionTag);

            var mgr = proof.Manager;
            mgr.PutFile(file, masterLocation);
        }
    }
}

Cheers, Gordon!