Skip to content

Commit dd41648

Browse files
set CYLC_DEBUG env var when set-verbosity DEBUG (#5854)
set CYLC_DEBUG env var when set-verbosity DEBUG --------- Co-authored-by: Ronnie Dutta <[email protected]>
1 parent 69988b0 commit dd41648

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

cylc/flow/option_parsers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,15 @@ def log_level_to_verbosity(lvl: int) -> int:
193193
>>> log_level_to_verbosity(logging.NOTSET)
194194
2
195195
>>> log_level_to_verbosity(logging.DEBUG)
196-
1
196+
2
197197
>>> log_level_to_verbosity(logging.INFO)
198198
0
199199
>>> log_level_to_verbosity(logging.WARNING)
200200
-1
201201
>>> log_level_to_verbosity(logging.ERROR)
202202
-1
203203
"""
204-
if lvl < logging.DEBUG:
204+
if lvl <= logging.DEBUG:
205205
return 2
206206
if lvl < logging.INFO:
207207
return 1

tests/functional/cli/03-set-verbosity.t

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#-------------------------------------------------------------------------------
1818
# Test "cylc set-verbosity"
1919
. "$(dirname "$0")/test_header"
20-
set_test_number 6
20+
set_test_number 4
2121

2222
# Test illegal log level
2323
TEST_NAME="${TEST_NAME_BASE}-bad"
@@ -28,18 +28,32 @@ grep_ok 'InputError: Illegal logging level, duck' "${TEST_NAME}.stderr"
2828
TEST_NAME="${TEST_NAME_BASE}-good"
2929
init_workflow "${TEST_NAME_BASE}" << '__FLOW__'
3030
[scheduler]
31-
allow implicit tasks = True
31+
[[events]]
32+
abort on stall timeout = True
33+
stall timeout = PT0S
3234
[scheduling]
3335
[[graph]]
34-
R1 = andor
36+
R1 = setter => getter
37+
[runtime]
38+
[[setter]]
39+
script = """
40+
echo "CYLC_VERBOSE: $CYLC_VERBOSE"
41+
[[ "$CYLC_VERBOSE" != 'true' ]]
42+
echo "CYLC_DEBUG: $CYLC_DEBUG"
43+
[[ "$CYLC_DEBUG" != 'true' ]]
44+
45+
cylc set-verbosity DEBUG "$CYLC_WORKFLOW_ID"
46+
cylc__job__poll_grep_workflow_log 'Command actioned: set_verbosity'
47+
"""
48+
[[getter]]
49+
script = """
50+
echo "CYLC_VERBOSE: $CYLC_VERBOSE"
51+
[[ "$CYLC_VERBOSE" == 'true' ]]
52+
echo "CYLC_DEBUG: $CYLC_DEBUG"
53+
[[ "$CYLC_DEBUG" == 'true' ]]
54+
"""
3555
__FLOW__
3656

3757
run_ok "${TEST_NAME}-validate" cylc validate "$WORKFLOW_NAME"
38-
workflow_run_ok "${TEST_NAME}-run" cylc play --pause "$WORKFLOW_NAME"
39-
40-
run_ok "$TEST_NAME" cylc set-verbosity DEBUG "$WORKFLOW_NAME"
41-
log_scan "${TEST_NAME}-grep" "${WORKFLOW_RUN_DIR}/log/scheduler/log" 5 1 \
42-
'Command actioned: set_verbosity'
43-
44-
cylc stop "$WORKFLOW_NAME"
58+
workflow_run_ok "${TEST_NAME}-run" cylc play --no-detach "$WORKFLOW_NAME"
4559
purge

0 commit comments

Comments
 (0)