Skip to content

Commit

Permalink
data store: include absolute graph edges
Browse files Browse the repository at this point in the history
* Closes #5845
  • Loading branch information
oliver-sanders committed Jul 15, 2024
1 parent dc9f01b commit ec7e16d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
6 changes: 1 addition & 5 deletions cylc/flow/taskdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,7 @@ def generate_graph_parents(tdef, point, taskdefs):
# where (point -Px) does not land on a valid point for woo.
# TODO ideally validation would flag this as an error.
continue
is_abs = (trigger.offset_is_absolute or
trigger.offset_is_from_icp)
if is_abs and parent_point != point:
# If 'foo[^] => bar' only spawn off of '^'.
continue
is_abs = trigger.offset_is_absolute or trigger.offset_is_from_icp
graph_parents[seq].append((parent_name, parent_point, is_abs))

if tdef.sequential:
Expand Down
34 changes: 34 additions & 0 deletions tests/integration/test_data_store_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from typing import TYPE_CHECKING

from cylc.flow.data_store_mgr import (
EDGES,
FAMILY_PROXIES,
JOBS,
TASKS,
Expand Down Expand Up @@ -316,3 +317,36 @@ def test_delta_task_prerequisite(harness):
p.satisfied
for t in schd.data_store_mgr.updated[TASK_PROXIES].values()
for p in t.prerequisites})


async def test_absolute_graph_edges(flow, scheduler, start):
"""It should add absolute graph edges to the store.
See: https://github.com/cylc/cylc-flow/issues/5845
"""
runahead_cycles = 1
id_ = flow({
'scheduling': {
'initial cycle point': '1',
'cycling mode': 'integer',
'runahead limit': f'P{runahead_cycles}',
'graph': {
'R1': 'build',
'P1': 'build[^] => run',
},
},
})
schd = scheduler(id_)

async with start(schd):
await schd.update_data_structure()

assert {
(Tokens(edge.source).relative_id, Tokens(edge.target).relative_id)
for edge in schd.data_store_mgr.data[schd.id][EDGES].values()
} == {
('1/build', f'{cycle}/run')
# +1 for Python's range()
# +2 for Cylc's runahead
for cycle in range(1, runahead_cycles + 3)
}

0 comments on commit ec7e16d

Please sign in to comment.