Skip to content

Commit

Permalink
Revert "[rdf] Restrict distributed initialization to executors only"
Browse files Browse the repository at this point in the history
Revert is needed due to changes introduced with
PR #15672.
  • Loading branch information
martamaja10 committed Jul 11, 2024
1 parent 589c633 commit 99cdd6c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ def register_initialization(cls, fun, *args, **kwargs):
**kwargs (dict): Keyword arguments used to execute the function.
"""
cls.initialization = partial(fun, *args, **kwargs)
fun(*args, **kwargs)

@abstractmethod
def ProcessAndMerge(self, ranges: List[DataRange],
Expand Down
17 changes: 17 additions & 0 deletions bindings/experimental/distrdf/test/backend/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,20 @@ def test_header_declaration_on_current_session(self):
Utils.declare_headers(["test_headers/header4.hxx"])
self.assertEqual(ROOT.b(1), True)


class InitializationTest(unittest.TestCase):
"""Check the initialize method"""

def test_initialization_runs_in_current_environment(self):
"""
User initialization method should be executed on the current user
session, so actions applied by the user initialization function are
also visible in the current scenario.
"""
def defineIntVariable(name, value):
import ROOT
ROOT.gInterpreter.ProcessLine("int %s = %s;" % (name, value))

varvalue = 2
DistRDF.initialize(defineIntVariable, "myInt", varvalue)
self.assertEqual(ROOT.myInt, varvalue)

0 comments on commit 99cdd6c

Please sign in to comment.