Add support for setting process.options from the command line#50585
Add support for setting process.options from the command line#50585fwyzard wants to merge 6 commits intocms-sw:masterfrom
Conversation
|
cms-bot internal usage |
|
@cms-sw/core-l2 here is a first implementation, including some new tests. Let me know if you have comments -- for example, if I should use a different approach to the parsing, or put code in different place, or add more tests, etc. |
|
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-50585/48766
|
|
A new Pull Request was created by @fwyzard for master. It involves the following packages:
@Dr15Jones, @cmsbuild, @makortel, @smuzaffar can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
|
I'm probably not going to implement the generic |
|
please test |
|
+1 Size: This PR adds an extra 72KB to repository Comparison SummarySummary:
Max Memory Comparisons exceeding threshold@cms-sw/core-l2 , I found 8 workflow step(s) with memory usage exceeding the error threshold: Expand to see workflows ...
|
|
As a simple test, I found that the following script does exactly the same job from argparse import ArgumentParser
import importlib
parser = ArgumentParser(description='add options')
parser.add_argument("-o","--options", help="add to process.options", action = "append", type = str)
parser.add_argument("cfg", help="name of config file")
args = parser.parse_args()
cfg = importlib.__import__(args.cfg[:-3])
process = cfg.process
if args.options:
for opt in args.options:
exec("process.options."+opt, globals(), locals())This can be run by doing cmsRun command_line_cfg.py -o 'numberOfThreads=4' test_cfg.py |
|
On a first, cursory look the code is somewhat complicated (with additional parsers etc). How about just appending the |
It is :-)
I can try that. From a first look, it will require some changes to One possible concern is that with this approach it may be harder to diagnose invalid options 🤔 |
PR description:
Add support for setting process.options from the command line:
cmsRun -o numberOfThreads=32 -o numberOfStreams=24 -o 'accelerators="gpu-*"' config.pyis equivalent to setting
in
config.py.PR validation:
New and existing unit tests pass.