Skip to content

Commit 3cb1187

Browse files
committed
docstring
1 parent 632d21d commit 3cb1187

File tree

1 file changed

+64
-2
lines changed

1 file changed

+64
-2
lines changed

pyhdtoolkit/scripts/htc_monitor.py

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,70 @@
1212
build a different monitor script from the functions there.
1313
1414
15-
16-
TODO: document more this script.
15+
The is registered as a console script called `htc-monitor` in the
16+
environment in which PyhDToolkit is installed.
17+
18+
It is possible to pass a few options, such as the wait time
19+
between calls to `condor_q`, the refresh rate of the table
20+
display and the logging level for console messages.
21+
22+
Usage goes as:
23+
24+
.. code-block:: console
25+
26+
Usage: python -m pyhdtoolkit.scripts.htc_monitor [OPTIONS]
27+
28+
Parse the HTCondor queue and display the status in a nice way using `rich`.
29+
30+
╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────╮
31+
│ --wait -w INTEGER RANGE [x>=1] Seconds to wait between calls to `condor_q`. │
32+
│ [default: 300] │
33+
│ --refresh -r FLOAT RANGE [x>=0.1] Table display refreshes per second. │
34+
│ [default: 1] │
35+
│ --log-level TEXT Console logging level. Can be 'debug', 'info', │
36+
│ 'warning' and 'error'. │
37+
│ [default: warning] │
38+
│ --install-completion Install completion for the current shell. │
39+
│ --show-completion Show completion for the current shell, to copy │
40+
│ it or customize the installation. │
41+
│ --help Show this message and exit. │
42+
╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯
43+
44+
The script will periodically query HTCondor via `condor_q`, process the output and
45+
display its contents in a nice way using `rich`.
46+
A progress bar will show the time remaining until the next query.
47+
48+
A typical output (default parameters) looks like:
49+
50+
.. code-block:: console
51+
52+
Querying HTCondor queue every 300 seconds (table display refreshes 1.00 times/second)
53+
54+
Time to next HTCondor query: ━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 0:02:27
55+
56+
╭────────────────────────────────────────────── Scheduler: bigbird12.cern.ch ──────────────────────────────────────────────╮
57+
│ │
58+
│ OWNER BATCH_NAME SUBMITTED DONE RUNNING IDLE TOTAL JOB_IDS │
59+
│ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │
60+
│ fesoubel 14729581 Thursday, 8 Jan 26 at 10:35 AM (CET) 1 5 _ 6 14729581.1-5 │
61+
│ fesoubel 14729582 Thursday, 8 Jan 26 at 10:35 AM (CET) _ 6 _ 6 14729582.0-5 │
62+
│ fesoubel 14729583 Thursday, 8 Jan 26 at 10:36 AM (CET) _ 5 _ 5 14729583.0-4 │
63+
│ fesoubel 14729584 Thursday, 8 Jan 26 at 10:36 AM (CET) _ 5 _ 5 14729584.0-4 │
64+
│ │
65+
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
66+
╭────────────────────────────────────────────────── bigbird12 Statistics ──────────────────────────────────────────────────╮
67+
│ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │
68+
│ SOURCE JOBS COMPLETED RUNNING IDLE HELD SUSPENDED REMOVED │
69+
│ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │
70+
│ Query 21 0 21 0 0 0 0 │
71+
│ fesoubel 21 0 21 0 0 0 0 │
72+
│ All Users 23387 0 9834 13284 269 0 0 │
73+
│ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │
74+
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
75+
76+
The script is hardcoded to expect outputs from CERN's HTCondor setup.
77+
In case you would like to adapt it to your own HTCondor installation,
78+
or request new features, please open an issue on the GitHub repository.
1779
"""
1880

1981
from __future__ import annotations

0 commit comments

Comments
 (0)