Repository navigation
fix(cluster_management): clean up leaked status records - #3738
Merged
Merged
Conversation
Status records of a worker that fails while obtaining a cluster instance were left behind. The stale records cleanup ignores records of live workers, so they stayed for the rest of the testrun: - a "prio" record kept all other workers waiting for the priority test until they timed out - a "respin in progress" record of a claimed respin, or of a respin that raised instead of returning, kept all workers away from the cluster instance Remove the "prio" record and the "respin in progress" record when `get_cluster_instance` raises, and hand back the claimed respin as "needs respin". Mark the cluster instance dead when `_respin` raises, same as when the cluster fails to start - the failure can be permanent, so the respin is not handed back in that case. Also call `on_test_stop` even when the log files check fails, so the resources locked by the test are released.
The fixtures preparing custom startup scripts returned the `start-cluster` file instead of its directory when the scripts were already generated by another worker. The respin with such `scriptsdir` fails and the cluster instance is marked dead. Also fix the epoch length in the `epoch_length_start_cluster` docstring and lock name - the fixture sets 1500, not 1200.
A `OneOf` filter in `use_resources` could select the same resource that a `OneOf` filter in `lock_resources` of the same request had just selected for locking. The test would then get one resource instead of two distinct ones. Pass the resources selected for locking to the selection of the resources for use, so the filters don't select them again.
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The cleanup and allocation fixes are consistent with existing coordination semantics and have focused unit coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Improves cluster-management cleanup and resource allocation reliability.
Changes:
- Cleans priority, respin, and resource records on failure paths.
- Ensures
OneOffilters select distinct resources. - Corrects cached startup-script paths and epoch-length naming.
| File | Description |
|---|---|
cluster_getter.py |
Adds failure cleanup and distinct resource selection. |
resources_management.py |
Supports excluding previously selected resources. |
tests/conftest.py |
Guarantees test-stop cleanup after log-check failures. |
tests/test_configuration.py |
Fixes cached script paths and epoch naming. |
tests/test_kes.py |
Returns the cached scripts directory. |
framework_tests/test_cluster_getter.py |
Tests cleanup and resource-selection behavior. |
framework_tests/test_resources_management.py |
Tests previously selected resource exclusion. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix cluster management bugs that could leave status records behind, or give a test fewer resources than it asked for. The stale records cleanup ignores records of live workers, so a leaked record stayed for the rest of the testrun.
Clean up records when obtaining a cluster instance fails. When
get_cluster_instanceraised (timeout, dead clusters check, an error during respin):Remove both records, and hand back the claimed respin as "needs respin" so other workers perform it once the instance is idle. When
_respinitself raises, mark the cluster instance dead, same as when the cluster fails to start - the failure can be permanent (e.g.FORBID_RESPIN), so the respin is not handed back in that case.Call
on_test_stopeven when the log files check fails, so the resources locked by the test are released.Make
OneOffilters inlock_resourcesanduse_resourcesof the same request select distinct resources. Previously the "use" filter could select the resource the "lock" filter had just selected, and the test got one resource instead of two. No current fixture mixes the two, so this was latent.Return the directory of cached custom startup scripts instead of the
start-clusterfile. The fixtures returned the file when the scripts were already generated by another worker, so the respin with suchscriptsdirfailed and the cluster instance was marked dead. Also fix the epoch length in theepoch_length_start_clusterdocstring and lock name (1500, not 1200).Unit tests were added for the record cleanup and the distinct
OneOfpicks; allframework_testspass.