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

Don't release from runahead if paused. #4617

Closed
wants to merge 3 commits into from

Conversation

hjoliver
Copy link
Member

@hjoliver hjoliver commented Jan 27, 2022

These changes close #4278

Requirements check-list

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg and conda-environment.yml.
  • Appropriate tests are included (unit and/or functional).
  • Appropriate change log entry included.
  • No documentation update required.

@hjoliver hjoliver added the bug Something is wrong :( label Jan 27, 2022
@hjoliver hjoliver added this to the cylc-8.0rc1 milestone Jan 27, 2022
@hjoliver hjoliver requested a review from MetRonnie January 27, 2022 06:57
@hjoliver hjoliver self-assigned this Jan 27, 2022
@hjoliver
Copy link
Member Author

If starting the #4278 example paused, task pool logging now shows only one task //1/foo:

  • * 1/foo waiting(held)(runahead) job:00 flows:1 status=waiting runahead=True queued=False

i.e. we before the preparing stage, so all good.

The initial task pool looks different because subsequent foos have not even been spawned yet, but that's fine.

@hjoliver
Copy link
Member Author

Integration tests fixed and extended.

This could break func tests, if any, that check the task pool at paused start-up. Hopefully there are none, gotta go ... 👋

@hjoliver
Copy link
Member Author

Damn it, one integration test is failing here, but I can't get it to fail locally. That's me done for now though.

Copy link
Member

@MetRonnie MetRonnie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also get test_filter_task_proxies[Task state] passing locally. I think the reason it might fail is because you've changed it so it is no longer paused at start, and the GHA runner must be quicker than our local machines, so the tasks get released and are no longer waiting when the mod_run fixture shuts down?

async def _run_flow(
run_dir: Path,
caplog: Optional[pytest.LogCaptureFixture],
scheduler: Scheduler,
level: int = logging.INFO
):
"""Start a scheduler."""
contact = (run_dir / scheduler.workflow / WorkflowFiles.Service.DIRNAME /
WorkflowFiles.Service.CONTACT)
if caplog:
caplog.set_level(level, CYLC_LOG)
task = None
started = False
await scheduler.install()
try:
task = asyncio.get_event_loop().create_task(scheduler.run())
started = await _poll_file(contact)
yield caplog
finally:
if started:
# ask the scheduler to shut down nicely
async with timeout(5):
scheduler._set_stop(StopMode.REQUEST_NOW_NOW)
await task
if task:
# leave everything nice and tidy
task.cancel()

@@ -1455,7 +1455,7 @@ async def main_loop(self):
tinit = time()

# Useful for debugging core scheduler issues:
# self.pool.log_task_pool(logging.CRITICAL)
self.pool.log_task_pool(logging.CRITICAL)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you'll want to re-comment-out this?

Suggested change
self.pool.log_task_pool(logging.CRITICAL)
# self.pool.log_task_pool(logging.CRITICAL)

) -> None:
"""Test TaskPool.filter_task_proxies().

The NOTE before EXAMPLE_FLOW_CFG above explains which tasks should be
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the note need updating?

# NOTE: foo & bar have no parents so at start-up (even with the workflow
# paused) they are spawned out to the runahead limit.

+# NOTE: foo & bar have no parents so at start-up they are
+spawned out to the runahead limit (only when not paused at start-up).

@@ -1470,7 +1470,7 @@ async def main_loop(self):

self.process_command_queue()

if self.pool.release_runahead_tasks():
if not self.is_paused and self.pool.release_runahead_tasks():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this would appear to be the reverse of a previous commit:

22e7a20#diff-90711b005fe27b9f894e6cd09f08816d847dcf853518894c6b7e2139784cbcb8R1444

Copy link
Member

@oliver-sanders oliver-sanders Jan 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think runahead tasks should still be released in "paused" mode, but that the "paused" state should stop them from running.

I.E. as implemented in #4436

Copy link
Member Author

@hjoliver hjoliver Jan 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spotting! Admittedly this attempted fix was done in a desperate rush.

Copy link
Member

@oliver-sanders oliver-sanders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a regression of #4436, suggesting #4620 as an alternative.

@MetRonnie
Copy link
Member

Closing this, then (if needs be can reopen)

@MetRonnie MetRonnie closed this Jan 28, 2022
@oliver-sanders oliver-sanders removed this from the cylc-8.0rc1 milestone Jan 28, 2022
@hjoliver hjoliver deleted the hold-at-paused-startup branch February 1, 2022 21:09
@hjoliver hjoliver restored the hold-at-paused-startup branch April 25, 2023 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is wrong :( superseded
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resuming after play --pause can make held tasks run
3 participants