Skip to content

Cylc Config json output mode - #6275

Draft
wxtim wants to merge 5 commits into
cylc:masterfrom
wxtim:feat.parsec_to_json_dumper
Draft

Cylc Config json output mode#6275
wxtim wants to merge 5 commits into
cylc:masterfrom
wxtim:feat.parsec_to_json_dumper

Conversation

@wxtim

@wxtim wxtim commented Aug 1, 2024

Copy link
Copy Markdown
Member

Add the following command to Cylc Config:

$ cylc config --json

Required for cylc/cylc-sphinx-extensions#81.

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are included (or explain why tests are not needed).
  • Changelog entry included if this is a change that can affect users
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@wxtim wxtim self-assigned this Aug 1, 2024
@wxtim wxtim added this to the 8.4.0 milestone Aug 1, 2024
@wxtim wxtim added small speculative blue-skies ideas labels Aug 1, 2024
Comment thread cylc/flow/scripts/config.py

@oliver-sanders oliver-sanders left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread cylc/flow/parsec/config.py Outdated
Comment thread cylc/flow/parsec/config.py Outdated
@wxtim
wxtim marked this pull request as draft August 5, 2024 12:27
@wxtim
wxtim requested a review from oliver-sanders August 5, 2024 12:28
@wxtim
wxtim marked this pull request as ready for review August 16, 2024 14:21
@MetRonnie

This comment was marked as resolved.

@wxtim
wxtim force-pushed the feat.parsec_to_json_dumper branch from 2d8e721 to 5480b12 Compare August 23, 2024 13:29
@MetRonnie MetRonnie removed the speculative blue-skies ideas label Aug 23, 2024
Comment thread cylc/flow/parsec/config.py Outdated
Comment thread cylc/flow/scripts/config.py
@wxtim
wxtim requested a review from MetRonnie August 27, 2024 09:25
Comment thread cylc/flow/parsec/config.py Outdated
Comment thread cylc/flow/parsec/config.py Outdated
@wxtim
wxtim marked this pull request as draft August 28, 2024 08:17
@wxtim

wxtim commented Aug 28, 2024

Copy link
Copy Markdown
Member Author

Drafted pending other work this not being a priority compared to bugfixes.

@wxtim
wxtim force-pushed the feat.parsec_to_json_dumper branch from f87fcf0 to 02616bc Compare August 29, 2024 13:03
@wxtim
wxtim requested a review from MetRonnie August 29, 2024 13:03
@wxtim
wxtim marked this pull request as ready for review August 29, 2024 13:03
@MetRonnie

Copy link
Copy Markdown
Member

Workflow with implicit task foo

$ cylc config myworkflow -i '[runtime][foo]' --null-value=meow --json
Traceback (most recent call last):
  File "~/.conda/envs/cylc8/bin/cylc", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "~/github/cylc-flow/cylc/flow/scripts/cylc.py", line 703, in main
    execute_cmd(command, *cmd_args)
  File "~/github/cylc-flow/cylc/flow/scripts/cylc.py", line 334, in execute_cmd
    entry_point.load()(*args)
  File "~/github/cylc-flow/cylc/flow/terminal.py", line 298, in wrapper
    wrapped_function(*wrapped_args, **wrapped_kwargs)
  File "~/github/cylc-flow/cylc/flow/scripts/config.py", line 189, in main
    asyncio.run(_main(parser, options, *ids))
  File "~/.conda/envs/cylc8/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "~/.conda/envs/cylc8/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.conda/envs/cylc8/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "~/github/cylc-flow/cylc/flow/scripts/config.py", line 245, in _main
    config.pcfg.idump(
  File "~/github/cylc-flow/cylc/flow/parsec/config.py", line 186, in idump
    self.jdump(mkeys, sparse, oneline, none_str, handle=handle)
  File "~/github/cylc-flow/cylc/flow/parsec/config.py", line 215, in jdump
    cfg.repl_val(cfg, None, none_str)
    ^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'repl_val'

@wxtim
wxtim dismissed MetRonnie’s stale review August 29, 2024 15:13

Made necessary change

@oliver-sanders

oliver-sanders commented Oct 7, 2024

Copy link
Copy Markdown
Member

This PR could probably be merged now, however, IMO it's best to keep pairs of PRs open (i.e. unmerged) until the upstream PR has been merged as review comments there could force changes here. Will review together with the upstream PR when both are ready.

The upstream PR is currently a draft, so I'll mark this as draft for now to match.

@oliver-sanders
oliver-sanders marked this pull request as draft October 7, 2024 12:57
@wxtim

wxtim commented Oct 9, 2024

Copy link
Copy Markdown
Member Author

I will get back to this one day, but it's a feature, not a bug...

@oliver-sanders oliver-sanders modified the milestones: 8.4.0, 8.5.0 Nov 29, 2024
@oliver-sanders oliver-sanders modified the milestones: 8.5.0, 8.x Mar 12, 2025
@wxtim
wxtim force-pushed the feat.parsec_to_json_dumper branch from 5cbdc93 to c70efd2 Compare March 24, 2025 09:32
@oliver-sanders

Copy link
Copy Markdown
Member

(unassigning this to re-focus my review queue, feel free to re-assign when undrafted)

@oliver-sanders
oliver-sanders removed their request for review February 19, 2026 12:53
wxtim and others added 3 commits March 4, 2026 10:58
Response to review
- Ensure --json help message is useful.
- Make the null value reporting only happen to actual null values.

Prevent --json being combined with print.. options

Tidy up
@wxtim
wxtim force-pushed the feat.parsec_to_json_dumper branch from 754fab4 to c779021 Compare March 4, 2026 10:59
@wxtim
wxtim requested a review from oliver-sanders March 4, 2026 11:51
@oliver-sanders
oliver-sanders removed their request for review March 4, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants