Skip to content

GaudiConfig2 does not support pickle output

GaudiConfig2 configurables are not persisted in pickle dumps.

$ gaudirun.py GaudiExamples.TestConfig2:main -o opts.pkl -n --all-opts
# setting LC_ALL to "C"
$ python -c 'import pickle; f = open("opts.pkl", "rb"); print(pickle.load(f))'
{'ApplicationMgr': ApplicationMgr('ApplicationMgr')}

This diff recovers some functionality:

diff --git a/Gaudi/python/Gaudi/Main.py b/Gaudi/python/Gaudi/Main.py
index 33111ce71..49f0afc6a 100644
--- a/Gaudi/python/Gaudi/Main.py
+++ b/Gaudi/python/Gaudi/Main.py
@@ -390,6 +390,12 @@ class gaudimain(object):
         to_dump = {}
         for n in getNeededConfigurables():
             to_dump[n] = Configuration.allConfigurables[n]
+        from GaudiConfig2._configurables import Configurable
+        for name, configurable in Configurable.instances.items():
+            # TODO conflict checking
+            # if name in to_dump:
+            #     raise Exception()
+            to_dump[name] = configurable
         pickle.dump(to_dump, output, -1)
         output.close()

This gives:

$ gaudirun.py GaudiExamples.TestConfig2:main -o opts.pkl -n --all-opts
# setting LC_ALL to "C"
$ python -c 'import pickle; f = open("opts.pkl", "rb"); print(pickle.load(f))'
{'ApplicationMgr': ApplicationMgr('ApplicationMgr', MessageSvcType=MessageSvc('MessageSvc', OutputLevel=3), ExtSvc=[MessageSvcSink('Gaudi::Monitoring::MessageSvcSink')], TopAlg=[GaudiHistoAlgorithm('SimpleHistos', HistoPrint=True, OutputLevel=2)], EvtMax=50000, EvtSel='NONE', HistogramPersistency='ROOT'), 'MessageSvc': MessageSvc('MessageSvc', OutputLevel=3), 'SimpleHistos': GaudiHistoAlgorithm('SimpleHistos', HistoPrint=True, OutputLevel=2), 'AuditorSvc': AuditorSvc('AuditorSvc', Auditors=['ChronoAuditor']), 'RootHistSvc': PersSvc('RootHistSvc', OutputFile='histo-c2.root'), 'HistogramDataSvc': HistogramSvc('HistogramDataSvc', OutputLevel=2, Input=["InFile DATAFILE='../data/input.hbook' TYP='HBOOK'"])}

But it doesn't merge or check for conflicts. If the (crude) checks are enabled one runs into #191 (closed).

/cc @clemenci

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information