Skip to content

Commit dcee55c

Browse files
committed
Make trigger and set warnings consistent again.
1 parent 3c16324 commit dcee55c

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

cylc/flow/task_pool.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2045,13 +2045,14 @@ def set_prereqs_and_outputs(
20452045
return
20462046

20472047
# For active tasks, default to the task's current flow assignment.
2048+
warnings_flow_none = []
20482049
if itasks:
20492050
flow_nums = self.get_flow_nums(flow, flow_descr)
20502051
for itask in itasks:
20512052
if flow == ['none'] and itask.flow_nums != set():
2052-
LOG.error(
2053-
f"[{itask}] ignoring 'flow=none' set: task already has"
2054-
f" {repr_flow_nums(itask.flow_nums, full=True)}"
2053+
warnings_flow_none.append(
2054+
f"{itask.identity}: "
2055+
f"{repr_flow_nums(itask.flow_nums, full=True)}"
20552056
)
20562057
continue
20572058

@@ -2076,6 +2077,13 @@ def set_prereqs_and_outputs(
20762077
self._set_outputs_itask(itask, outputs)
20772078
no_op = False
20782079

2080+
if warnings_flow_none:
2081+
msg = '\n * '.join(warnings_flow_none)
2082+
LOG.warning(
2083+
"Tasks already flow-assigned - ignoring "
2084+
f'"trigger --flow=none": \n * {msg}'
2085+
)
2086+
20792087
# For inactive tasks, default to all current flows.
20802088
if inactive_tasks:
20812089
flow_nums = self.get_flow_nums(flow or [FLOW_ALL], flow_descr)

tests/integration/test_flow_assignment.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
FLOW_ALL,
2828
FLOW_NEW,
2929
FLOW_NONE,
30-
repr_flow_nums
3130
)
3231
from cylc.flow.scheduler import Scheduler
3332

@@ -137,11 +136,8 @@ async def test_flow_assignment(
137136
do_command([active_a.identity], flow=[FLOW_NONE])
138137
assert active_a.flow_nums == {1, 2}
139138
assert log_filter(
140-
contains=(
141-
f'[{active_a}] ignoring \'flow=none\' {command}: '
142-
f'task already has {repr_flow_nums(active_a.flow_nums)}'
143-
),
144-
level=logging.ERROR
139+
contains=("Tasks already flow-assigned - ignoring"),
140+
level=logging.WARNING
145141
)
146142

147143
do_command([active_a.identity], flow=[FLOW_NEW])

0 commit comments

Comments
 (0)