renamed --silent switch --quiet

This commit is contained in:
2020-10-01 12:06:52 +02:00
parent 4bfe9c9c0f
commit b608b12432
5 changed files with 7 additions and 7 deletions

View File

@ -19,7 +19,7 @@ The `data` folder contains some channel lists and output files for testing.
Reads a list of PV names from plain text file (comments starting with `#` are allowed, even recommended) and tests each channel for connection, alarm status and severity. Reads a list of PV names from plain text file (comments starting with `#` are allowed, even recommended) and tests each channel for connection, alarm status and severity.
For each channel, the result will be printed as soon as it arrived. Thus, the output is ordered by response time. There is a command-line switch to suppress the output (`-s`/`--silent`) and to set the connection time out in seconds (`-t`/`--timeout`). For each channel, the result will be printed as soon as it arrived. Thus, the output is ordered by response time. There is a command-line switch to suppress the output (`-q`/`--quiet`) and to set the connection time out in seconds (`-t`/`--timeout`).
The test result can be written to a comma-separated values (csv) file by giving a filename to the `-o`/`--output` switch (`.csv` is automatically appended to the filename if missing). The test result can be written to a comma-separated values (csv) file by giving a filename to the `-o`/`--output` switch (`.csv` is automatically appended to the filename if missing).

View File

@ -23,7 +23,7 @@ def run_check(clargs):
chans = load_config(filename) chans = load_config(filename)
pvs = (epics.PV(ch) for ch in chans) # putting PV constructors into ThreadPoolExecutor has weird effects pvs = (epics.PV(ch) for ch in chans) # putting PV constructors into ThreadPoolExecutor has weird effects
get_data = DataGetter(clargs.timeout, clargs.silent) get_data = DataGetter(clargs.timeout, clargs.quiet)
data = parallel(get_data, pvs, chans) data = parallel(get_data, pvs, chans)
df = pd.DataFrame(data).T df = pd.DataFrame(data).T

View File

@ -16,7 +16,7 @@ def handle_clargs():
parser_check = subparsers.add_parser("check", help="check a list of channels", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser_check = subparsers.add_parser("check", help="check a list of channels", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser_check.add_argument("filename", help="name of input channel-list file") parser_check.add_argument("filename", help="name of input channel-list file")
parser_check.add_argument("-o", "--output", help="output CSV file", default=None) parser_check.add_argument("-o", "--output", help="output CSV file", default=None)
parser_check.add_argument("-s", "--silent", help="do not show each channel's answer", action="store_true") parser_check.add_argument("-q", "--quiet", help="do not show each channel's answer", action="store_true")
parser_check.add_argument("-t", "--timeout", help="connection timeout in seconds", type=float, default=1) parser_check.add_argument("-t", "--timeout", help="connection timeout in seconds", type=float, default=1)
parser_compare = subparsers.add_parser("compare", help="compare two check results") parser_compare = subparsers.add_parser("compare", help="compare two check results")

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
./sani.py check data/test_chans_good.txt -s ./sani.py check data/test_chans_good.txt -q
echo echo
./sani.py check data/test_chans_bad.txt ./sani.py check data/test_chans_bad.txt
echo echo

View File

@ -8,9 +8,9 @@ from .consts import MSG_NOT_CONNECTED, MSG_SUCCESS
class DataGetter: class DataGetter:
def __init__(self, timeout, silent): def __init__(self, timeout, quiet):
self.timeout = timeout self.timeout = timeout
self.silent = silent self.quiet = quiet
def __call__(self, pv): def __call__(self, pv):
connected = pv.wait_for_connection(self.timeout) connected = pv.wait_for_connection(self.timeout)
@ -38,7 +38,7 @@ class DataGetter:
"severity": severity "severity": severity
} }
if not self.silent: if not self.quiet:
msg = colored(col, msg) msg = colored(col, msg)
print(pv.pvname, msg) print(pv.pvname, msg)
return data return data