cta-observatory / ctapipe

Low-level data processing pipeline software for CTAO or similar arrays of Imaging Atmospheric Cherenkov Telescopes
https://ctapipe.readthedocs.org
BSD 3-Clause "New" or "Revised" License
63 stars 267 forks source link

Config system ignores unknown config values silently #1436

Open Bultako opened 3 years ago

Bultako commented 3 years ago

I have found that Tools do not always capture bad or invalid arguments. Some examples below.

MyTool --foo=True
WARNING [MyTool] (loader/load_config): Unrecognized alias: '--foo=True', it will probably have no effect.
INFO [MyTool] (tool/initialize): ctapipe version 0.8.0.post31+gite99e39c
MyTool --Foo=True
WARNING [MyTool] (loader/load_config): Unrecognized alias: '--Foo= True', it will probably have no effect.
CRITICAL [MyTool] (application/catch_config_error): Bad config encountered during initialization:
CRITICAL [MyTool] (application/catch_config_error): Invalid argument: '--Foo=1'
MyTool --foo.bar=True
INFO [MyTool] (tool/initialize): ctapipe version 0.8.0.post31+gite99e39c
MyTool --Foo.bar=True
INFO [MyTool] (tool/initialize): ctapipe version 0.8.0.post31+gite99e39c

I guess this could produce an unexpected behavior of the Tool if a misspelled argument is passed together with a config file having the right argument name, which will turn out sometimes in a silent execution of the Tool.

maxnoe commented 3 years ago

Yes, it seems non-top-level config options are just silently ignored.

I could have sworn I already opened this issue, but I could not find it. So maybe I forgot to open it.

kosack commented 3 years ago

perhaps add this to #1406 (reqs for a new config system).

kosack commented 3 years ago

also related to https://github.com/ipython/traitlets/issues/145