Repository navigation
Fix empty batch_run results when model_reporters is None - #3579
Merged
Merged
Conversation
quaquel
approved these changes
Mar 19, 2026
EwoutH
pushed a commit
to EwoutH/mesa
that referenced
this pull request
Nov 22, 2026
* Fix partial model data collection after reporter failures Signed-off-by: Sahil Kumar Singh <[email protected]> * test(datacollector): cover model reporter evaluation and copy failures Signed-off-by: Sahil Kumar Singh <[email protected]> --------- Signed-off-by: Sahil Kumar Singh <[email protected]> Co-authored-by: Jan Kwakkel <[email protected]> Adapted for 3.5.x: 3.5 records the collection step even without model reporters (mesa#3579), so the step is appended after the model reporter block, once all model reporters have succeeded, instead of inside it. (cherry picked from commit 7379e9e) Assisted-by: Claude Opus 5.5
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.
Note
Use this template for bug fixes only. For enhancements/new features, use the feature template and get maintainer approval in an issue/discussion before opening a PR.
Pre-PR Checklist
Summary
batch_rundrops all agent data and returns an empty list [] if a model only uses agent reporters (model_reporters=None)Bug / Issue
See #3311
When
model_reportersis None, the simulation time step (model.time) was skipped because the recording logic was nested inside the ifself.model_reportersblock. Because the time steps were never recorded in_collection_steps,batch_runassumed an empty history and returned zero results.Credits to @soelderer for finding the bug
Implementation
Hoisted the
self._collection_steps.append(model.time)logic out of themodel_reporterscondition inDataCollector.collect(). The simulation time is now correctly recorded regardless of which reporters (model, agent, or agent-type) are active.Testing
All tests passed locally