Skip to content

Commit 2fc3d97

Browse files
authored
Merge pull request cylc#6765 from wxtim/tidy.remove_unecessary_warnings
demote unnecessary warnings
2 parents db039c1 + dcd7e5a commit 2fc3d97

File tree

7 files changed

+42
-34
lines changed

7 files changed

+42
-34
lines changed

cylc/flow/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -914,10 +914,10 @@ def _check_circular(self):
914914
"""Check for circular dependence in graph."""
915915
if (len(self.taskdefs) > self.CHECK_CIRCULAR_LIMIT and
916916
not getattr(self.options, 'check_circular', False)):
917-
LOG.warning(
917+
LOG.info(
918918
f"Number of tasks is > {self.CHECK_CIRCULAR_LIMIT}; will not "
919-
"check graph for circular dependencies. To enforce this "
920-
"check, use the option --check-circular.")
919+
"check graph for circular dependencies. To run this check"
920+
" anyway use the option --check-circular.")
921921
return
922922
start_point_str = self.cfg['scheduling']['initial cycle point']
923923
raw_graph = self.get_graph_raw(start_point_str,

cylc/flow/rundb.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ def execute_queued_items(self):
535535
)
536536
raise
537537
self.n_tries += 1
538-
LOG.warning(
538+
LOG.info(
539539
"%(file)s: write attempt (%(attempt)d)"
540540
" did not complete: %(error)s\n"
541541
" SQLite error code: %(error_code)s\n"
@@ -560,7 +560,7 @@ def execute_queued_items(self):
560560
table.update_queues.clear()
561561
# Report public database retry recovery if necessary
562562
if self.n_tries:
563-
LOG.warning(
563+
LOG.info(
564564
"%(file)s: recovered after (%(attempt)d) attempt(s)\n" % {
565565
"file": self.db_file_name, "attempt": self.n_tries})
566566
self.n_tries = 0
@@ -601,7 +601,10 @@ def _execute_stmt(self, stmt, stmt_args_list):
601601
for i, stmt_args in enumerate(stmt_args_list):
602602
err_log += ("\nstmt_args[%(i)d]=%(stmt_args)s" % {
603603
"i": i, "stmt_args": stmt_args})
604-
LOG.warning(err_log)
604+
if self.is_public:
605+
LOG.info(err_log)
606+
else:
607+
LOG.warning(err_log)
605608
raise
606609

607610
def pre_select_broadcast_states(self, order=None):

cylc/flow/task_events_mgr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1375,7 +1375,7 @@ def _process_message_started(self, itask, event_time, forced):
13751375
"""Helper for process_message, handle a started message."""
13761376
if itask.job_vacated:
13771377
itask.job_vacated = False
1378-
LOG.warning(f"[{itask}] Vacated job restarted")
1378+
LOG.info(f"[{itask}] Vacated job restarted")
13791379
job_tokens = itask.tokens.duplicate(job=str(itask.submit_num))
13801380
self.data_store_mgr.delta_job_time(job_tokens, 'started', event_time)
13811381
self.data_store_mgr.delta_job_state(job_tokens, TASK_STATUS_RUNNING)

cylc/flow/task_pool.py

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,11 @@ def _reload_taskdefs(self) -> None:
11231123
# Log tasks orphaned by a reload but not currently in the task pool.
11241124
for name in orphans:
11251125
if name not in (itask.tdef.name for itask in tasks):
1126-
LOG.warning("Removed task: '%s'", name)
1126+
LOG.info("Removed task: '%s'", name)
1127+
# Store lists of tasks which were active before reload.
1128+
warn_tasks: List[str] = []
1129+
_warn_tasks: List[str] = []
1130+
11271131
for itask in tasks:
11281132
if itask.tdef.name in orphans:
11291133
if (
@@ -1136,7 +1140,7 @@ def _reload_taskdefs(self) -> None:
11361140
else:
11371141
# Keep active orphaned task, but stop it from spawning.
11381142
itask.graph_children = {}
1139-
LOG.warning(
1143+
LOG.info(
11401144
f"[{itask}] will not spawn children "
11411145
"- task definition removed"
11421146
)
@@ -1158,15 +1162,18 @@ def _reload_taskdefs(self) -> None:
11581162
self._swap_out(new_task)
11591163
self.data_store_mgr.delta_task_prerequisite(new_task)
11601164
LOG.info(f"[{itask}] reloaded task definition")
1165+
11611166
if itask.state(*TASK_STATUSES_ACTIVE):
1162-
LOG.warning(
1163-
f"[{itask}] active with pre-reload settings"
1164-
)
1167+
warn_tasks.append(str(itask))
11651168
elif itask.state(TASK_STATUS_PREPARING):
11661169
# Job file might have been written at this point?
1167-
LOG.warning(
1168-
f"[{itask}] may be active with pre-reload settings"
1169-
)
1170+
_warn_tasks.append(str(itask))
1171+
1172+
for may, tasks in (('', warn_tasks), ('may be', _warn_tasks)):
1173+
if tasks:
1174+
_tasks = "\n * ".join(tasks)
1175+
LOG.info(
1176+
f"Tasks {may} active with pre-reload settings:\n{_tasks}")
11701177

11711178
# Reassign live tasks to the internal queue
11721179
del self.task_queue_mgr
@@ -1250,22 +1257,18 @@ def warn_stop_orphans(self) -> None:
12501257
orphans_kill_failed.append(itask)
12511258
else:
12521259
orphans.append(itask)
1253-
if orphans_kill_failed:
1254-
LOG.warning(
1255-
"Orphaned tasks (kill failed):\n"
1256-
+ "\n".join(
1257-
f"* {itask.identity} ({itask.state.status})"
1258-
for itask in orphans_kill_failed
1259-
)
1260-
)
1261-
if orphans:
1262-
LOG.warning(
1263-
"Orphaned tasks:\n"
1264-
+ "\n".join(
1265-
f"* {itask.identity} ({itask.state.status})"
1266-
for itask in orphans
1260+
1261+
for orphanlist, extra_text in (
1262+
(orphans_kill_failed, ' (kill failed)'),
1263+
(orphans, '')
1264+
):
1265+
if orphanlist:
1266+
LOG.warning(
1267+
f"Orphaned tasks{extra_text}:\n"
1268+
+ "\n".join(
1269+
f"* {itask.identity} ({itask.state.status})"
1270+
for itask in orphanlist)
12671271
)
1268-
)
12691272

12701273
for id_key in self.task_events_mgr._event_timers:
12711274
LOG.warning(

tests/functional/database/04-lock-recover.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ workflow_run_ok "${TEST_NAME_BASE}-run" \
2525
cylc play --debug --no-detach --reference-test "${WORKFLOW_NAME}"
2626

2727
# Ensure that DB statement and its args are printed to STDERR
28-
grep -A 3 -F 'WARNING - cannot execute database statement:' \
28+
grep -A 3 -F 'INFO - cannot execute database statement:' \
2929
"${TEST_NAME_BASE}-run.stderr" > "${TEST_NAME_BASE}-run.stderr.grep"
3030
# The following "sed" turns the value for "time_submit_exit" to "?"
3131
sed -i "s/, '[^T']*T[^Z']*Z',/, '?',/" "${TEST_NAME_BASE}-run.stderr.grep"
3232
# Cannot use cmp_ok as the error message is prefixed by a timestamp.
33-
grep_ok "WARNING - cannot execute database statement:" \
33+
grep_ok "INFO - cannot execute database statement:" \
3434
"${TEST_NAME_BASE}-run.stderr.grep"
3535

3636
DB_FILE="$RUN_DIR/${WORKFLOW_NAME}/log/db"

tests/unit/test_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,7 @@ def test_process_runahead_limit(
11161116
def test_check_circular(opt, monkeypatch, caplog, tmp_flow_config):
11171117
"""Test WorkflowConfig._check_circular()."""
11181118
# ----- Setup -----
1119-
caplog.set_level(logging.WARNING, CYLC_LOG)
1119+
caplog.set_level(logging.INFO, CYLC_LOG)
11201120

11211121
options = SimpleNamespace(is_validate=True)
11221122
if opt:

tests/unit/test_workflow_files.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,16 @@ def test_infer_latest_run_warns_for_runN(
198198
warn_arg: bool,
199199
log_filter: Callable,
200200
tmp_run_dir: Callable,
201+
monkeypatch: pytest.MonkeyPatch
201202
):
202203
"""Tests warning is produced to discourage use of /runN in workflow_id"""
203204
(tmp_run_dir() / 'run1').mkdir()
204205
runN_path = tmp_run_dir() / 'runN'
205206
runN_path.symlink_to('run1')
207+
monkeypatch.setattr('cylc.flow.LOG.level', logging.INFO)
206208
infer_latest_run(runN_path, warn_runN=warn_arg)
207209
filtered_log = log_filter(
208-
logging.WARNING, "You do not need to include runN in the workflow ID"
210+
logging.WARNING, contains="You do not need to include"
209211
)
210212
assert filtered_log if warn_arg else not filtered_log
211213

0 commit comments

Comments
 (0)