Skip to content

Commit 61adbce

Browse files
committed
Fix missing log warning for failed attempts at removing tasks
Partially reverts e6c4adf
1 parent 82bb1ba commit 61adbce

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

cylc/flow/commands.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ def _remove_matched_tasks(
161161
schd: 'Scheduler',
162162
ids: Set[TaskTokens],
163163
flow_nums: 'FlowNums',
164+
warn_unremovable: bool = True,
164165
):
165166
"""Remove matched tasks."""
166167
# Mapping of *relative* task IDs to removed flow numbers:
@@ -267,15 +268,14 @@ def _remove_matched_tasks(
267268
)
268269
LOG.info(f"Removed tasks: {', '.join(sorted(tasks_str_list))}")
269270

270-
if not_removed:
271+
if warn_unremovable and not_removed:
271272
fnums_str = (
272273
repr_flow_nums(flow_nums, full=True) if flow_nums else ''
273274
)
274275
tasks_str = ', '.join(
275276
sorted(tokens.relative_id for tokens in not_removed)
276277
)
277-
# This often does not indicate an error - e.g. for group trigger.
278-
LOG.debug(f"Task(s) not removable: {tasks_str} {fnums_str}")
278+
LOG.warning(f"Task(s) not removable: {tasks_str} {fnums_str}")
279279

280280
if removed and schd.pool.compute_runahead():
281281
schd.pool.release_runahead_tasks()
@@ -806,7 +806,12 @@ def _force_trigger_tasks(
806806
# Remove all inactive and selected active group members.
807807
if flow != [FLOW_NONE]:
808808
# (No need to remove tasks if triggering with no-flow).
809-
_remove_matched_tasks(schd, {*active_to_remove, *inactive}, flow_nums)
809+
_remove_matched_tasks(
810+
schd,
811+
{*active_to_remove, *inactive},
812+
flow_nums,
813+
warn_unremovable=False,
814+
)
810815

811816
# trigger should override the held state, however, in-group tasks may
812817
# have previously been held and active in-group tasks will become

tests/integration/test_remove.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

1717
import logging
18+
1819
import pytest
1920

20-
from cylc.flow import CYLC_LOG
2121
from cylc.flow.commands import (
2222
force_trigger_tasks,
2323
reload_workflow,
@@ -261,15 +261,14 @@ async def test_logging(
261261
# Invalid tasks:
262262
'2005/a', '2000/doh',
263263
]
264-
async with start(schd) as log:
265-
log.set_level(logging.DEBUG, CYLC_LOG)
264+
async with start(schd):
266265
await run_cmd(remove_tasks(schd, tasks_to_remove, []))
267266

268267
assert log_filter(
269268
logging.INFO, "Removed tasks: 2000/a (flows=1), 2000/b (flows=1)"
270269
)
271270

272-
assert log_filter(logging.DEBUG, "Task(s) not removable: 2001/a, 2001/b")
271+
assert log_filter(logging.WARNING, "Task(s) not removable: 2001/a, 2001/b")
273272
assert log_filter(logging.WARNING, "Invalid cycle point for task: a, 2005")
274273
assert log_filter(
275274
logging.WARNING, "No tasks match the IDs:\n* 2000/doh\n* 2005/a"
@@ -283,13 +282,12 @@ async def test_logging_flow_nums(
283282
):
284283
"""Test logging of task removals involving flow numbers."""
285284
schd: Scheduler = scheduler(example_workflow)
286-
async with start(schd) as log:
287-
log.set_level(logging.DEBUG, CYLC_LOG)
285+
async with start(schd):
288286
await run_cmd(force_trigger_tasks(schd, ['1/a1'], ['1', '2']))
289287
# Removing from flow that doesn't exist doesn't work:
290288
await run_cmd(remove_tasks(schd, ['1/a1'], ['3']))
291289
assert log_filter(
292-
logging.DEBUG, "Task(s) not removable: 1/a1 (flows=3)"
290+
logging.WARNING, "Task(s) not removable: 1/a1 (flows=3)"
293291
)
294292

295293
# But if a valid flow is included, it will be removed from that flow:

0 commit comments

Comments
 (0)