Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] --cfg=hydra CLI fails if top-level config is read-only #1461

Closed
Jasha10 opened this issue Mar 8, 2021 · 3 comments 路 Fixed by #1542
Closed

[Bug] --cfg=hydra CLI fails if top-level config is read-only #1461

Jasha10 opened this issue Mar 8, 2021 · 3 comments 路 Fixed by #1542
Assignees
Labels
bug Something isn't working In progress Work in progress
Milestone

Comments

@Jasha10
Copy link
Collaborator

Jasha10 commented Mar 8, 2021

馃悰 Bug

Description

The --cfg=hydra flag on the command line fails when the top-level node is read-only

$ cd ~/hydra.git/examples/patterns/write_protect_config_node/
$ python frozen.py
{'baud_rate': 19200, 'data_bits': 8, 'stop_bits': 1}
$ python frozen.py --cfg=hydra
Traceback (most recent call last):
  File "/Users/lappy486/hydra.git/hydra/_internal/utils.py", line 210, in run_and_report
    return func()
  File "/Users/lappy486/hydra.git/hydra/_internal/utils.py", line 378, in <lambda>
    lambda: hydra.show_cfg(
  File "/Users/lappy486/hydra.git/hydra/_internal/hydra.py", line 162, in show_cfg
    cfg = self._get_cfg(
  File "/Users/lappy486/hydra.git/hydra/_internal/hydra.py", line 152, in _get_cfg
    cfg = self.get_sanitized_hydra_cfg(cfg)
  File "/Users/lappy486/hydra.git/hydra/_internal/hydra.py", line 128, in get_sanitized_hydra_cfg
    del cfg[key]
  File "/Users/lappy486/opt/miniconda3/envs/hydra/lib/python3.8/site-packages/omegaconf/dictconfig.py", line 380, in __delitem__
    self._format_and_raise(
  File "/Users/lappy486/opt/miniconda3/envs/hydra/lib/python3.8/site-packages/omegaconf/base.py", line 171, in _format_and_raise
    format_and_raise(
  File "/Users/lappy486/opt/miniconda3/envs/hydra/lib/python3.8/site-packages/omegaconf/_utils.py", line 640, in format_and_raise
    _raise(ex, cause)
  File "/Users/lappy486/opt/miniconda3/envs/hydra/lib/python3.8/site-packages/omegaconf/_utils.py", line 543, in _raise
    raise ex.with_traceback(sys.exc_info()[2])  # set end OC_CAUSE=1 for full backtrace
omegaconf.errors.ReadonlyConfigError: DictConfig in read-only mode does not support deletion
    full_key: baud_rate
    object_type=SerialPort

System information

  • Hydra Version : '1.1.0dev5'
  • Python version : 3.8.8
  • Virtual environment type and version : conda
  • Operating system : MacOs
@Jasha10 Jasha10 added the bug Something isn't working label Mar 8, 2021
@omry
Copy link
Collaborator

omry commented Mar 8, 2021

nice catch, want to send a PR? :)

@Jasha10
Copy link
Collaborator Author

Jasha10 commented Mar 8, 2021

Sure, will do.

@omry
Copy link
Collaborator

omry commented Mar 9, 2021

Related issues:
--hydra-help, --help

@omry omry added this to the Hydra 1.1.0 milestone Mar 28, 2021
@jieru-hu jieru-hu self-assigned this Apr 2, 2021
@jieru-hu jieru-hu added the In progress Work in progress label Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working In progress Work in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants