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 a workflow with an empty graph #6229

Merged
merged 1 commit into from
Jul 15, 2024
Merged
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
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
Loading