From 10be64fb1077d0bd53a84daa63360011eb0ba531 Mon Sep 17 00:00:00 2001
From: Gerardo Ganis <gerardo.ganis@cern.ch>
Date: Wed, 26 Mar 2014 14:51:39 +0100
Subject: [PATCH] Make TProof::Process to return TSelector::GetStatus
 (ROOT-748)

To get the same behaviour as in Tree::Process.
The TSelector::fStatus of all non-aborted workers are added.
---
 proof/proof/src/TProof.cxx             | 8 ++++++++
 proof/proof/src/TProofLite.cxx         | 9 +++++++++
 proof/proofplayer/src/TProofPlayer.cxx | 5 +++++
 3 files changed, 22 insertions(+)

diff --git a/proof/proof/src/TProof.cxx b/proof/proof/src/TProof.cxx
index e28601cd706..ccf9b06dc48 100644
--- a/proof/proof/src/TProof.cxx
+++ b/proof/proof/src/TProof.cxx
@@ -5305,6 +5305,13 @@ Long64_t TProof::Process(TDSet *dset, const char *selector, Option_t *option,
    // Finalise output file settings (opt is ignored in here)
    if (HandleOutputOptions(opt, outfile, 1) != 0) return -1;
 
+   // Retrieve status from the output list
+   if (rv >= 0) {
+      TParameter<Long64_t> *sst =
+        (TParameter<Long64_t> *) fOutputList.FindObject("PROOF_SelectorStatus");
+      if (sst) rv = sst->GetVal();
+   }
+
    if (fSync) {
       // reactivate the default application interrupt handler
       if (sh)
@@ -5627,6 +5634,7 @@ Long64_t TProof::Process(const char *dsetname, const char *selector,
    } else {
       delete dset;
    }
+
    return retval;
 }
 
diff --git a/proof/proof/src/TProofLite.cxx b/proof/proof/src/TProofLite.cxx
index 3b3053b70a9..8d006adefd0 100644
--- a/proof/proof/src/TProofLite.cxx
+++ b/proof/proof/src/TProofLite.cxx
@@ -40,6 +40,7 @@
 #include "TPluginManager.h"
 #include "TDataSetManager.h"
 #include "TDataSetManagerFile.h"
+#include "TParameter.h"
 #include "TPRegexp.h"
 #include "TProofQueryResult.h"
 #include "TProofServ.h"
@@ -1408,6 +1409,14 @@ Long64_t TProofLite::Process(TDSet *dset, const char *selector, Option_t *option
    // Finalise output file settings (opt is ignored in here)
    if (HandleOutputOptions(opt, outfile, 1) != 0) return -1;
 
+   // Retrieve status from the output list
+   if (rv >= 0) {
+      TParameter<Long64_t> *sst =
+        (TParameter<Long64_t> *) fOutputList.FindObject("PROOF_SelectorStatus");
+      if (sst) rv = sst->GetVal();
+   }
+
+
    // Done
    return rv;
 }
diff --git a/proof/proofplayer/src/TProofPlayer.cxx b/proof/proofplayer/src/TProofPlayer.cxx
index cdc5de5594b..735c9ad86a5 100644
--- a/proof/proofplayer/src/TProofPlayer.cxx
+++ b/proof/proofplayer/src/TProofPlayer.cxx
@@ -1470,6 +1470,11 @@ Long64_t TProofPlayer::Process(TDSet *dset, const char *selector_file,
             }
          }
       }
+
+      // Add Selector status in the output list so it can be returned to the client as done
+      // by Tree::Process (see ROOT-748). The status from the various workers will be added.
+      fOutput->Add(new TParameter<Long64_t>("PROOF_SelectorStatus", (Long64_t) fSelector->GetStatus()));
+
       if (gProofServ && !gProofServ->IsParallel()) {  // put all the canvases onto the output list
          TIter nxc(gROOT->GetListOfCanvases());
          while (TObject *c = nxc())
-- 
GitLab