Skip to content

Commit 99cdd6c

Browse files
committed
Revert "[rdf] Restrict distributed initialization to executors only"
Revert is needed due to changes introduced with PR root-project#15672.
1 parent 589c633 commit 99cdd6c

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

bindings/experimental/distrdf/python/DistRDF/Backends/Base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ def register_initialization(cls, fun, *args, **kwargs):
194194
**kwargs (dict): Keyword arguments used to execute the function.
195195
"""
196196
cls.initialization = partial(fun, *args, **kwargs)
197+
fun(*args, **kwargs)
197198

198199
@abstractmethod
199200
def ProcessAndMerge(self, ranges: List[DataRange],

bindings/experimental/distrdf/test/backend/test_common.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,20 @@ def test_header_declaration_on_current_session(self):
5858
Utils.declare_headers(["test_headers/header4.hxx"])
5959
self.assertEqual(ROOT.b(1), True)
6060

61+
62+
class InitializationTest(unittest.TestCase):
63+
"""Check the initialize method"""
64+
65+
def test_initialization_runs_in_current_environment(self):
66+
"""
67+
User initialization method should be executed on the current user
68+
session, so actions applied by the user initialization function are
69+
also visible in the current scenario.
70+
"""
71+
def defineIntVariable(name, value):
72+
import ROOT
73+
ROOT.gInterpreter.ProcessLine("int %s = %s;" % (name, value))
74+
75+
varvalue = 2
76+
DistRDF.initialize(defineIntVariable, "myInt", varvalue)
77+
self.assertEqual(ROOT.myInt, varvalue)

0 commit comments

Comments
 (0)