Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runahead: handle no sequences within start-stop cycle interval #6638

Open
wants to merge 2 commits into
base: 8.4.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes.d/6638.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed possible crash when restarting a workflow after changing the graph.
7 changes: 5 additions & 2 deletions cylc/flow/task_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,11 @@ def compute_runahead(self, force=False) -> bool:
self._prev_runahead_base_point = base_point

if count_cycles:
# (len(list) may be less than ilimit due to sequence end)
limit_point = sorted(sequence_points)[:ilimit + 1][-1]
if not sequence_points:
limit_point = base_point
else:
# (len(list) may be less than ilimit due to sequence end)
limit_point = sorted(sequence_points)[:ilimit + 1][-1]
else:
limit_point = max(sequence_points)

Expand Down
29 changes: 29 additions & 0 deletions tests/integration/test_task_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -1800,6 +1800,35 @@ async def test_compute_runahead_with_no_tasks(flow, scheduler, run):
assert schd.pool.get_tasks() == []


async def test_compute_runahead_with_no_sequences(flow, scheduler, start, run, complete):
"""It should handle no sequences within the start-stop cycle range.

See https://github.com/cylc/cylc-flow/issues/6154
"""
cfg = {
'scheduling': {
'cycling mode': 'integer',
'initial cycle point': '1',
'graph': {
'P1': 'foo[-P1] => foo'
}
}
}
id_ = flow(cfg)
schd = scheduler(id_, paused_start=False)
async with run(schd):
await complete(schd, '2/foo')

cfg['scheduling']['graph']['R1'] = cfg['scheduling']['graph']['P1']
cfg['scheduling']['graph'].pop('P1')
flow(cfg, workflow_id=id_)

schd = scheduler(id_, paused_start=False)
async with start(schd):
schd.pool.compute_runahead()
assert schd.pool.runahead_limit_point == IntegerPoint('3')


@pytest.mark.parametrize('rhlimit', ['P2D', 'P2'])
@pytest.mark.parametrize('compat_mode', ['compat-mode', 'normal-mode'])
async def test_runahead_future_trigger(
Expand Down
Loading