-
Notifications
You must be signed in to change notification settings - Fork 94
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
task_pool: fix compute_runahead calculation #5833
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,13 +51,13 @@ | |
from cylc.flow.task_state import ( | ||
TASK_STATUSES_ACTIVE, | ||
TASK_STATUSES_FINAL, | ||
TASK_STATUS_WAITING, | ||
TASK_STATUS_EXPIRED, | ||
TASK_STATUS_FAILED, | ||
TASK_STATUS_PREPARING, | ||
TASK_STATUS_SUBMITTED, | ||
TASK_STATUS_RUNNING, | ||
TASK_STATUS_SUBMITTED, | ||
TASK_STATUS_SUCCEEDED, | ||
TASK_STATUS_FAILED, | ||
TASK_STATUS_WAITING, | ||
TASK_OUTPUT_EXPIRED, | ||
TASK_OUTPUT_FAILED, | ||
TASK_OUTPUT_SUCCEEDED, | ||
|
@@ -362,20 +362,35 @@ def compute_runahead(self, force=False) -> bool: | |
# Find the earliest point with unfinished tasks. | ||
for point, itasks in sorted(self.get_tasks_by_point().items()): | ||
if ( | ||
points # got the limit already so this point too | ||
or any( | ||
not itask.state( | ||
TASK_STATUS_FAILED, | ||
TASK_STATUS_SUCCEEDED, | ||
TASK_STATUS_EXPIRED | ||
) | ||
Comment on lines
-367
to
-371
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This counted waiting runahead tasks. It should be superfluous if |
||
or ( | ||
# For Cylc 7 back-compat, ignore incomplete tasks. | ||
# (Success is required in back-compat mode, so | ||
# failedtasks end up as incomplete; and Cylc 7 | ||
# ignores failed tasks in computing the limit). | ||
itask.state.outputs.is_incomplete() | ||
and not cylc.flow.flags.cylc7_back_compat | ||
any( | ||
# filter out runahead tasks | ||
itask.state(is_runahead=False) | ||
and ( | ||
# waiting tasks | ||
# * tasks with partially satisfied prereqs | ||
# * tasks with incomplete xtriggers | ||
# * held tasks | ||
oliver-sanders marked this conversation as resolved.
Show resolved
Hide resolved
|
||
itask.state(TASK_STATUS_WAITING) | ||
|
||
# unfinished tasks (back-compat mode) | ||
# * Cylc 7 runahead logic considered a cycle to be | ||
# active if it had "unfinished" tasks | ||
or ( | ||
cylc.flow.flags.cylc7_back_compat | ||
and not itask.state( | ||
TASK_STATUS_FAILED, | ||
TASK_STATUS_SUCCEEDED, | ||
TASK_STATUS_EXPIRED, | ||
) | ||
) | ||
|
||
# incomplete tasks (optional outputs) | ||
# * tasks with one or more required outputs | ||
# incomplete | ||
or ( | ||
not cylc.flow.flags.cylc7_back_compat | ||
and itask.state.outputs.is_incomplete() | ||
) | ||
) | ||
for itask in itasks | ||
) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,11 +34,12 @@ testpaths = | |
tests/integration/ | ||
env = | ||
# a weird timezone to check that tests aren't assuming the local timezone | ||
TZ=XXX-09:35 | ||
# Note: this doesn't work properly with pytest-xdist | ||
# TZ=XXX-09:35 | ||
Comment on lines
36
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This prevents the new test from failing. Setting the TZ variable in this way doesn't work as intended. A solution will arrive in #5826 |
||
doctest_optionflags = | ||
NORMALIZE_WHITESPACE | ||
IGNORE_EXCEPTION_DETAIL | ||
ELLIPSIS | ||
asyncio_mode = auto | ||
markers= | ||
linkcheck: Test links | ||
linkcheck: Test links |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -64,3 +64,21 @@ These methods both shut down the workflow / clean up after themselves. | |||||||||
|
||||||||||
It is necessary to shut down workflows correctly to clean up resorces and | ||||||||||
running tasks. | ||||||||||
|
||||||||||
## Module Scoped Fixtures | ||||||||||
|
||||||||||
There's a reasonable overhead to some text fixtures, especially the ones which | ||||||||||
involve writing files to disk or starting Cylc schedulers. | ||||||||||
|
||||||||||
To make tests run faster you can use module-scoped fixtures, these are test | ||||||||||
fixtures which are created once, then reused for all tests in the module. | ||||||||||
|
||||||||||
You'll find a bunch of module-scoped fixtues prefixed with `mod_`, e.g. | ||||||||||
`mod_start` is the module-scoped version of `start`. When using module-scoped | ||||||||||
fixtures, ensure that tests do not modify the fixture object as this will enable | ||||||||||
tests to interact. | ||||||||||
|
||||||||||
In order to get speedup from module-scoped fixtures when running with | ||||||||||
pytest-xdist, we configure pytest-xdist to run all of the tests in a module in | ||||||||||
series using the same pytest runner. This incentivises breaking up larger test | ||||||||||
modules. | ||||||||||
Comment on lines
+83
to
+84
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Possible alternative
Suggested change
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could never be true as points is populated on a different branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's populated on this branch too, within the same loop. So the logic says to automatically append the next points once we have added the first one based on the state checks. (However, I'm not sure why it wasn't just stopping at the first one, since then we just take the min anyway).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're iterating in sorted order the earlier cycles should come first, so a
break
should make sense?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's using points later in ways which don't cause test failures, so I'll restore the original to avoid breakages.Actually, no, adding this line back breaks the new tests. I'm not sure why we would add cycle points with no active tasks to the points list?