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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak scan CLI help. #5405

Merged
merged 2 commits into from
May 4, 2023
Merged

Tweak scan CLI help. #5405

merged 2 commits into from
May 4, 2023

Conversation

hjoliver
Copy link
Member

@hjoliver hjoliver commented Mar 13, 2023

  • Improve cylc scan command help
  • add scheduler PID to the output
  • print a note to stderr to remind that scan only reads contact files by default
$ cylc scan 
demo/run9 niwa-1007885.niwa.local:43070 21212  # PIDs new
demo/run7 niwa-1007885.niwa.local:43010 21132
demo/run8 niwa-1007885.niwa.local:43069 21173

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). [Not needed: minor documentation only]
  • CHANGES.md 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.

@hjoliver hjoliver added the small label Mar 13, 2023
@hjoliver hjoliver self-assigned this Mar 13, 2023
@hjoliver
Copy link
Member Author

As an aside, cylc scan -t json just prints contact file content plus a little more static data, e.g. contact file location.

@oliver-sanders was that the intention for -t json? If so, we should document that and disallow use with other options e.g. -t rich -t json which currently doesn't have the expected effect.

@oliver-sanders
Copy link
Member

oliver-sanders commented Mar 14, 2023

@oliver-sanders was that the intention for -t json?

Yes, I think this was inherited from Cylc 7. It's just a better interface for any systems which want to scape this information.

The cylc play command also accepts --format=json for much the same reason (UIS could avoid re-scanning when it starts workflows).

If so, we should document that and disallow use with other options e.g. -t rich -t json which currently doesn't have the expected effect.

???

cylc scan --format=json --format=rich results in --format=rich

In the same way that:

git commit --author=one --author=two results in --author=two

If you repeat an argument, the latter definition is used.

@hjoliver
Copy link
Member Author

hjoliver commented Mar 14, 2023

If you repeat an argument, the latter definition is used.

Duh 🤦

Well, not exclusively true but fair enough.

cylc config -i foo -i bar

What I was getting at was: was the intention to allow all cylc scan output (plain, rich, contact file, ...) to be returned in json format? [arrggh so many "was"s]

It would be reasonable to expect that -t json does that. But all it actually does is return the contents of the contact file (albeit in json format). We should probably rename the option to --contact-file ...

@hjoliver hjoliver force-pushed the scan-doc branch 5 times, most recently from 9823ee6 to a2c68b2 Compare March 15, 2023 01:03
@hjoliver hjoliver changed the base branch from 8.1.x to master May 3, 2023 01:55
@hjoliver hjoliver added this to the cylc-8.2.0 milestone May 3, 2023
@hjoliver hjoliver marked this pull request as ready for review May 3, 2023 02:01
@hjoliver hjoliver closed this May 3, 2023
@hjoliver hjoliver reopened this May 3, 2023
@hjoliver
Copy link
Member Author

hjoliver commented May 3, 2023

I've stuck with just documenting what -t json does better:

json: full contact data in JSON format

Comment on lines 598 to 602
print(
"\nUse `--ping` to attempt to connect to schedulers and clean "
"\nup after any that were killed or did not shut down cleanly.",
file=stderr
)
Copy link
Member

Choose a reason for hiding this comment

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

I think printing this message every time is a bit too obstructive.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, it's only printed for non scheduler-contacting cases, and only to stderr. And I got here via a bunch of confused-user questions ("cylc scan says my workflow is running, but stuff isn't working!").

Copy link
Member

Choose a reason for hiding this comment

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

Well, it's only printed for non scheduler-contacting cases

So the default i.e. 99.9% of cases.

Copy link
Member

@oliver-sanders oliver-sanders May 3, 2023

Choose a reason for hiding this comment

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

I feel that if it is really this important that we add a message to every command, then it should really be the default.

But we don't want to do that in order to keep cylc scan fast.

#5511 possible alternative?

IMO, crashes should be sufficiently unusual that we shouldn't need to bend other commands to accommodate this case. It's mostly a large number of critical bugs reported during Cylc 8 stabilisation which has made this situation common.

Copy link
Member Author

@hjoliver hjoliver May 3, 2023

Choose a reason for hiding this comment

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

This situation is particularly confusing for users when it does happen, because they have a reasonable expectation that cylc scan does not report stopped workflows as running.

However, I'll remove the message. I quite like your proposed #5511 solution.

@hjoliver
Copy link
Member Author

hjoliver commented May 3, 2023

@oliver-sanders - this now just clarifies the command help, and adds scheduler PID to the basic scan output. Which makes it easier for users to see if a scheduler really is running, if they need to do that.

One review should do now.

@oliver-sanders oliver-sanders merged commit c05629c into cylc:master May 4, 2023
23 of 24 checks passed
wxtim added a commit to wxtim/cylc that referenced this pull request May 4, 2023
…_too_soon

* upstream/master: (70 commits)
  Tweak scan CLI help. (cylc#5405)
  Add support for python 3.11 (cylc#5497)
  tests/u: add parameter ids
  build(deps): bump pypa/gh-action-pypi-publish from 1.8.5 to 1.8.6
  prerequisite: remove unused interface
  Fix change log dup section.
  Fix flaky test
  Update CONTRIBUTING.md
  Tidy platforms
  modify CONTRIBUTING.md
  Bump dev version (cylc#5501)
  Prepare release 8.1.3
  Ignore off-sequence parents, for datastore. (cylc#5495)
  Avoid duplicate prerequisites from multiple recurrences. (cylc#5466)
  Update cylc/flow/prerequisite.py
  prerequsite: remove target_point_strings attribute
  tests/f: fix events/11
  swarm: convert cylc-dev Docker image to run on ubuntu:latest
  fix changelog
  Apply prerequisite changes to spawned tasks, on reload & restart (cylc#5334)
  ...
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.

None yet

2 participants