From a2c68b2adcc30760e37340ebec3e27fe82ee7d33 Mon Sep 17 00:00:00 2001 From: Hilary Oliver Date: Wed, 15 Mar 2023 13:34:07 +1300 Subject: [PATCH] Scan CLI warning message. [skip ci] --- cylc/flow/scripts/scan.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/cylc/flow/scripts/scan.py b/cylc/flow/scripts/scan.py index ea7eec9c20..bc6b3f8c48 100644 --- a/cylc/flow/scripts/scan.py +++ b/cylc/flow/scripts/scan.py @@ -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 @@ -233,7 +234,7 @@ 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' ) @@ -241,11 +242,9 @@ def get_option_parser() -> COP: 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' ) @@ -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: