Skip to content

Add possibility to lock an option slot of ApplicationOptions

Christoph Hasse requested to merge pyconf_lockOption into master

This was triggered by some discussions in the Core Software MM channel.

The Short version is that if you use the options file /Moore/Hlt/Moore/tests/options/download_mdf_input.py but afterwards set options.evt_max to a higher value, the job will potentially run over the last, and only partially downloaded, event in the mdf file. This results in weird errors.

This MR adds the method lockOption to ApplicationOptions which enables the possibility to lock a specific option of the ApplicationOptions
Moore!761 (merged) adds the use of this functionality to the download_mdf_input.py script.

Using the example from the mattermost discussion as an example:
./build.x86_64+avx2+fma-centos7-gcc10-opt+g/run gaudirun.py Rich/Panoptes/tests/qmtest/rich_ref_index_calib.qmt
now triggers:

# --> Including file '/localdisk2/chasse/from_scratch/stack/Moore/Hlt/Moore/tests/options/mdf_input_and_conds.py'
# <-- End of file '/localdisk2/chasse/from_scratch/stack/Moore/Hlt/Moore/tests/options/mdf_input_and_conds.py'
# --> Including file '/localdisk2/chasse/from_scratch/stack/Moore/Hlt/Moore/tests/options/download_mdf_input.py'
# <-- End of file '/localdisk2/chasse/from_scratch/stack/Moore/Hlt/Moore/tests/options/download_mdf_input.py'
# --> Including file '/localdisk2/chasse/from_scratch/stack/Moore/Hlt/Moore/tests/options/multi_threaded_4_threads.py'
# <-- End of file '/localdisk2/chasse/from_scratch/stack/Moore/Hlt/Moore/tests/options/multi_threaded_4_threads.py'
# --> Including file '/localdisk2/chasse/from_scratch/stack/Panoptes/Rich/Panoptes/options/RichRefIndexCalib.py'
Traceback (most recent call last):
  File "/localdisk2/chasse/from_scratch/stack/Gaudi/InstallArea/x86_64+avx2+fma-centos7-gcc10-opt+g/bin/gaudirun.py", line 547, in <module>
    exec(o, g, l)
  File "<string>", line 1, in <module>
  File "/localdisk2/chasse/from_scratch/stack/Gaudi/InstallArea/x86_64+avx2+fma-centos7-gcc10-opt+g/python/GaudiKernel/ProcessJobOptions.py", line 502, in importOptions
    _import_function_mapping[ext](optsfile)
  File "/localdisk2/chasse/from_scratch/stack/Gaudi/InstallArea/x86_64+avx2+fma-centos7-gcc10-opt+g/python/GaudiKernel/ProcessJobOptions.py", line 470, in _import_python
    exec(code, {})
  File "/localdisk2/chasse/from_scratch/stack/Panoptes/Rich/Panoptes/options/RichRefIndexCalib.py", line 19, in <module>
    options.evt_max = 100000
  File "/localdisk2/chasse/from_scratch/stack/LHCb/InstallArea/x86_64+avx2+fma-centos7-gcc10-opt+g/python/PyConf/application.py", line 139, in __setattr__
    raise ConfigurationError("Can't change property {}! It was locked in: {}".format(attr, _ApplicationOptions_lockedSlots[attr]))
PyConf.utilities.ConfigurationError: Can't change property evt_max! It was locked in: /localdisk2/chasse/from_scratch/stack/Moore/Hlt/Moore/tests/options/download_mdf_input.py

cc @rmatev @apearce @jonrob @sstahl

Merge request reports