Repository navigation
Keep replication ids increasing across spawn calls - #4182
Merged
Merged
Conversation
quaquel
reviewed
Nov 22, 2026
| for i in range(n) | ||
| for i, seed in enumerate(child_seeds) | ||
| ] | ||
| object.__setattr__(self, "_replications_spawned", start + len(replications)) |
Contributor
Author
There was a problem hiding this comment.
i simplified the numbering to use enumerate(child_seeds, start=start). object.setattr is there because Scenario is frozen; normal assignment to the counter raises TypeError. keeping the update after the list also means a failed child constructor does not advance the id counter. the pickle behavior is unchanged. the scenario tests passed five times and the full suite passed.
|
Performance benchmarks:
|
quaquel
approved these changes
Nov 23, 2026
This was referenced Nov 25, 2026
EwoutH
added a commit
that referenced
this pull request
Nov 30, 2026
* Update release notes and version for 4.0.0a1 Add the 4.0.0a1 release notes to HISTORY.md, leaving out changes already released in Mesa 3.5.1 to 3.5.4, and bump the version to 4.0.0a1. Move the #4182 replication id fix, which was added under 4.0.0a0, into the 4.0.0a1 notes where it was released. Assisted-by: Claude Opus 5.5 * Leave dependabot and pre-commit.ci bumps out of the 4.0.0a1 notes Assisted-by: Claude Opus 5.5 * Add PRs merged on 2026-11-30 to the 4.0.0a1 notes Seven PRs were merged after the notes were drafted: #4284, #3960, #4261, #3979, #4286, #4216 and #4301. Also moves the release date to 2026-11-30. Assisted-by: Claude Code
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.
Pre-PR Checklist
Summary
Continue replication ids across repeated
spawn_replications()calls on the same parent.Bug / Issue
Fixes #4076.
The seeds advance on each call, but the ids restart at zero. Later batches can then replace earlier results with the same run ids.
Implementation
Keep a private count on the parent and use it as the starting id for the next batch, following the approach discussed in #4076. Save the count and child-seed position when pickling a scenario.
This replaces the runner-level check proposed in #4078. No runner or store behavior changes.
Testing
Tests cover repeated batches, separate experiments sharing an in-memory store, memory and disk output, process workers, deterministic seeds, empty and invalid batches, subclasses and pickling.
The test runs report 16 Python multiprocessing fork warnings. The original scenario suite also reports this warning; the extra process-worker cases exercise it six more times.
Additional Notes
The counter is private and does not become a model parameter. This does not add DiskStore append or resume support.