Skip to content

Extended context information when CA is used in debug mode

Tomasz Bold requested to merge tbold/athena:component-addition-context into master

When the ComponentAccumulator.debugMode is set to True the merging issues come with handy info like below (contxt ingo is significanly longer thatn in standard jobs). When the debugMode is off (default) a message indicates that it can be turned on.

Traceback (most recent call last):
  File "/srv/build/x86_64-centos7-gcc8-opt/python/AthenaConfiguration/ComponentAccumulatorTest.py", line 98, in test_conflict_in_cond_alg
    self.acc.addCondAlgo(TestAlgo("Cond1", MyInt=8)) # value 8 conflicts with earlier set value 7
  File "/srv/build/x86_64-centos7-gcc8-opt/python/AthenaConfiguration/ComponentAccumulator.py", line 393, in addCondAlgo
    deduplicate(algo,self._conditionsAlgs) #will raise on conflict
  File "/srv/build/x86_64-centos7-gcc8-opt/python/AthenaConfiguration/Deduplication.py", line 26, in deduplicate
    raiseWithCurrentContext(exception)
  File "/srv/build/x86_64-centos7-gcc8-opt/python/AthenaConfiguration/DebuggingContext.py", line 43, in raiseWithCurrentContext
    raise type(exception)(str(exception) + '\nwith the context\n {}'.format(Context.current()) )
ValueError: conflicting settings for property MyInt of Cond1: cannot merge values 8 and 7
with the context
 Adding Conditions Algorithm to the ComponentAccumulator that has instance of it aready added in this context
 >>> runpy.py:193(_run_module_as_main) runpy.py:85(_run_code) __main__.py:18(<module>) main.py:101(__init__) main.py:271(runTests) runner.py:176(run) suite.py:84(__call__) suite.py:122(run) suite.py:84(__call__) suite.py:122(run) suite.py:84(__call__) suite.py:122(run) case.py:676(__call__) case.py:624(run) ComponentAccumulatorTest.py:57(setUp)
Traceback (most recent call last):
  File "/srv/build/x86_64-centos7-gcc8-opt/python/AthenaConfiguration/ComponentAccumulatorTest.py", line 98, in test_conflict_in_cond_alg
    self.acc.addCondAlgo(TestAlgo("Cond1", MyInt=8)) # value 8 conflicts with earlier set value 7
  File "/srv/build/x86_64-centos7-gcc8-opt/python/AthenaConfiguration/ComponentAccumulator.py", line 393, in addCondAlgo
    deduplicate(algo,self._conditionsAlgs) #will raise on conflict
  File "/srv/build/x86_64-centos7-gcc8-opt/python/AthenaConfiguration/Deduplication.py", line 26, in deduplicate
    raiseWithCurrentContext(exception)
  File "/srv/build/x86_64-centos7-gcc8-opt/python/AthenaConfiguration/DebuggingContext.py", line 43, in raiseWithCurrentContext
    raise type(exception)(str(exception) + '\nwith the context\n {}'.format(Context.current()) )
ValueError: conflicting settings for property MyInt of Cond1: cannot merge values 8 and 7
with the context
 Unknown (enable it with ComponentAccumulator.debugMode = True)

Tagging @wlampl as I have better reused "deduplicate" functionality for algorithms in this MR (so it is a significant change).

Merge request reports