Skip to content

Conversation

rht
Copy link
Contributor

@rht rht commented Apr 21, 2022

Fixes #1221, projectmesa/mesa-viz-tornado#25.

This will prevent a user gotcha where they forget to call
self.datacollector.collect(self) during the model init.
Additionally, this auto-assign the data collector to self.datacollector.

Though, an extra document is needed to tell users that the attribute name is datacollector.

Tests not yet written, because this PR is made so that this feature can be tried.

@codecov
Copy link

codecov bot commented Apr 21, 2022

Codecov Report

Merging #1287 (21ccdf3) into main (f4f44ad) will increase coverage by 0.06%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    projectmesa/mesa#1287      +/-   ##
==========================================
+ Coverage   89.05%   89.12%   +0.06%     
==========================================
  Files          19       19              
  Lines        1243     1251       +8     
  Branches      244      246       +2     
==========================================
+ Hits         1107     1115       +8     
  Misses        101      101              
  Partials       35       35              
Impacted Files Coverage Δ
mesa/model.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f4f44ad...21ccdf3. Read the comment docs.

Copy link
Member

@tpike3 tpike3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make sure I am getting the dev process for this down:
- we merge
- test is out (for example add to some of the example models)
- add to tests and documentation

This seems to be a break from our current approach where we would not merge into core until that is done

@rht
Copy link
Contributor Author

rht commented Apr 21, 2022

By trying this PR, I did not mean for it to be merged. I meant for the PR to be installed as is.

@jackiekazil
Copy link
Member

jackiekazil commented Apr 22, 2022 via email

@rht rht changed the title model: Implement initialize_data_collector [WIP] model: Implement initialize_data_collector Apr 22, 2022
@tpike3 tpike3 added this to the Quartzsite (next release) milestone May 15, 2022
This will prevent a user gotcha where they forget to call
self.datacollector.collect(self) during the model init.
@rht rht force-pushed the datacollection branch from fe85f80 to 21ccdf3 Compare May 15, 2022 12:15
@rht rht changed the title [WIP] model: Implement initialize_data_collector model: Implement initialize_data_collector May 15, 2022
@rht
Copy link
Contributor Author

rht commented May 15, 2022

@tpike3 this PR is ready.

Copy link
Member

@tpike3 tpike3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM -- I will also update the tutorial with the namespace updates

@tpike3 tpike3 merged commit fd3a118 into projectmesa:main May 15, 2022
@rht rht deleted the datacollection branch May 15, 2022 12:40
@EwoutH
Copy link
Member

EwoutH commented Sep 25, 2024

This methods is not consequently used, and it now interferes with the removal of the schedulers, so I'm proposing to remove it. We can just include it somewhere in the conventions, and maybe add a warning in the batch_run function itself.

And maybe the new batch runner will take a datacollector object or whatever that becomes inexplicitly.

CC @quaquel @Corvince

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: batch_run assumes model datacollector is called datacollector
4 participants