Skip to content

Commit 1c5bcd7

Browse files
authored
Merge pull request #6602 from wxtim/fix.icp-fail
Suicide trigger prevents later cycles starting
2 parents a411aae + 1b18556 commit 1c5bcd7

File tree

3 files changed

+49
-3
lines changed

3 files changed

+49
-3
lines changed

changes.d/6602.fix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a bug where suicide triggers could prevent initial cycle point tasks spawning.

cylc/flow/taskdef.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,10 @@ def generate_graph_parents(
9999
) -> Dict['SequenceBase', List[TaskTuple]]:
100100
"""Determine concrete graph parents of task tdef at point.
101101
102-
Infer parents be reversing upstream triggers that lead to point/task.
102+
Infer parents by reversing upstream triggers that lead to point/task.
103103
"""
104104
graph_parents: Dict['SequenceBase', List[TaskTuple]] = {}
105+
105106
for seq, triggers in tdef.graph_parents.items():
106107
if not seq.is_valid(point):
107108
# Don't infer parents if the trigger belongs to a sequence that
@@ -353,8 +354,8 @@ def has_only_abs_triggers(self, point):
353354
if (
354355
trig.offset_is_absolute or
355356
trig.offset_is_from_icp or
356-
# Don't count self-suicide as a normal trigger.
357-
dep.suicide and trig.task_name == self.name
357+
# Don't count suicide as a normal trigger:
358+
dep.suicide
358359
):
359360
has_abs = True
360361
else:

tests/integration/test_taskdef.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
2+
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
3+
#
4+
# This program is free software: you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License as published by
6+
# the Free Software Foundation, either version 3 of the License, or
7+
# (at your option) any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
17+
18+
async def test_almost_self_suicide(flow, scheduler, start):
19+
"""Suicide triggers should not count as upstream tasks when looking
20+
to spawn parentless tasks.
21+
22+
https://github.com/cylc/cylc-flow/issues/6594
23+
24+
For the example under test, pre-requisites for ``!a`` should not be
25+
considered the same as pre-requisites for ``a``. If the are then then
26+
is parentless return false for all cases of ``a`` not in the inital cycle
27+
and subsequent cycles never run.
28+
"""
29+
wid = flow({
30+
'scheduler': {'cycle point format': '%Y'},
31+
'scheduling': {
32+
'initial cycle point': 1990,
33+
'final cycle point': 1992,
34+
'graph': {
35+
'R1': 'install_cold',
36+
'P1Y': 'install_cold[^] => a? => b?\nb:fail? => !a?'
37+
}
38+
}
39+
})
40+
schd = scheduler(wid)
41+
async with start(schd):
42+
tasks = [str(t) for t in schd.pool.get_tasks()]
43+
for task in ['1990/a:waiting', '1991/a:waiting', '1992/a:waiting']:
44+
assert task in tasks

0 commit comments

Comments
 (0)