Skip to content

Commit

Permalink
Scan CLI warning message. [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
hjoliver committed Mar 15, 2023
1 parent 1c485a8 commit a2c68b2
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions cylc/flow/scripts/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import asyncio
import json
from pathlib import Path
from sys import stderr
from typing import Callable, Optional, TYPE_CHECKING

from ansimarkup import ansiprint as cprint
Expand Down Expand Up @@ -233,19 +234,17 @@ def get_option_parser() -> COP:
'--colour-blind', '--color-blind',
help=(
"Don't depend on colour to convey information. "
' Use this rather than --color=never so you still get bold text.'
'Use this rather than --color=never so you still get bold text.'
),
action='store_true'
)

parser.add_option(
'--ping',
help=(
'Test the connection to the flow. Scan normally just reads flow'
' contact files, but --ping forces a connection to the scheduler'
' and removes the contact file if it is not found to be running'
" (this can happen if the scheduler gets killed and can't clean"
' up after itself).'
"Connect to schedulers and remove contact files if they are not "
"found to be running. Contact files can be left behind when "
"schedulers get killed."
),
action='store_true'
)
Expand Down Expand Up @@ -578,6 +577,14 @@ async def main(

await scanner(opts, write, scan_dir)

if opts.format != 'rich' and not opts.ping:
print(
"By default 'cylc scan' just reads workflow contact files, which"
"\ncan be left behind if a scheduler gets killed. Use '--ping'"
"\nto attempt connection and remove bad contact files.",
file=stderr
)


@cli_function(get_option_parser)
def cli(_, opts: 'Values', color: bool) -> None:
Expand Down

0 comments on commit a2c68b2

Please sign in to comment.