Skip to content

Commit

Permalink
Merge pull request #6229 from oliver-sanders/6225
Browse files Browse the repository at this point in the history
runahead: handle a workflow with an empty graph
  • Loading branch information
wxtim committed Jul 15, 2024
2 parents 0f8847b + fdd503c commit dc9f01b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
15 changes: 9 additions & 6 deletions cylc/flow/task_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,15 @@ def compute_runahead(self, force=False) -> bool:
if not self.active_tasks:
# Find the earliest sequence point beyond the workflow start point.
base_point = min(
point
for point in {
seq.get_first_point(self.config.start_point)
for seq in self.config.sequences
}
if point is not None
(
point
for point in {
seq.get_first_point(self.config.start_point)
for seq in self.config.sequences
}
if point is not None
),
default=None,
)
else:
# Find the earliest point with incomplete tasks.
Expand Down
20 changes: 20 additions & 0 deletions tests/integration/test_task_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -1750,6 +1750,26 @@ async def test_compute_runahead(
assert int(str(schd.pool.runahead_limit_point)) == 5 # +1


async def test_compute_runahead_with_no_tasks(flow, scheduler, run):
"""It should handle the case of an empty workflow.
See https://github.com/cylc/cylc-flow/issues/6225
"""
id_ = flow(
{
'scheduling': {
'initial cycle point': '2000',
'graph': {'R1': 'foo'},
},
}
)
schd = scheduler(id_, startcp='2002', paused_start=False)
async with run(schd):
assert schd.pool.compute_runahead() is False
assert schd.pool.runahead_limit_point is None
assert schd.pool.get_tasks() == []


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

0 comments on commit dc9f01b

Please sign in to comment.