Skip to content

Don't recompute runahead unnecessarily in main loop - #7400

Open
hjoliver wants to merge 3 commits into
cylc:8.6.xfrom
hjoliver:tweak-compute_runahead
Open

Don't recompute runahead unnecessarily in main loop#7400
hjoliver wants to merge 3 commits into
cylc:8.6.xfrom
hjoliver:tweak-compute_runahead

Conversation

@hjoliver

@hjoliver hjoliver commented Jul 24, 2026

Copy link
Copy Markdown
Member

Follow-up #7237 (see last paragraph of #7237 (comment) )

I did not think that calling compute_runahead once per main loop would be a significant efficiency hit in inactive workflows because the method returns early if the base point hasn't changed. So in inactive workflows it really only does this:

base_point = min(self.active_tasks)

HOWEVER, it's certainly better not to call it at all if nothing is happening - so fair call @oliver-sanders and @MetRonnie

Note the change in task_pool.py (commit 2) is not necessary, it's just to separate out the soon-to-be-gone Cylc 7 compat bit, allowing the Cylc 8 case to be cleaner (and avoids a Python loop).

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 if present).
  • Tests are included (or explain why tests are not needed).
  • Changelog entry included if this is a change that can affect users
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@hjoliver hjoliver self-assigned this Jul 24, 2026
@hjoliver
hjoliver changed the base branch from master to 8.6.x July 24, 2026 03:08
@hjoliver
hjoliver force-pushed the tweak-compute_runahead branch from a5648b2 to 0f74adb Compare July 24, 2026 03:16
@hjoliver
hjoliver changed the base branch from 8.6.x to master July 24, 2026 03:18
@hjoliver
hjoliver changed the base branch from master to 8.6.x July 24, 2026 03:18
@hjoliver
hjoliver force-pushed the tweak-compute_runahead branch from 0f74adb to b37f5cd Compare July 24, 2026 03:22
@hjoliver

Copy link
Copy Markdown
Member Author

(Changed PR branch base several times after accidentally screwing up 8.6.x in my own fork 😬 )

@hjoliver

Copy link
Copy Markdown
Member Author

Lint fail unrelated - see #7403

@hjoliver
hjoliver requested review from MetRonnie and oliver-sanders and removed request for MetRonnie July 27, 2026 22:09
@hjoliver hjoliver added small could be better Not exactly a bug, but not ideal. labels Jul 27, 2026
@hjoliver hjoliver added this to the 8.6.6 milestone Jul 27, 2026
@hjoliver
hjoliver force-pushed the tweak-compute_runahead branch 2 times, most recently from 007ce68 to 8a84fed Compare July 28, 2026 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

could be better Not exactly a bug, but not ideal. small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants