Agents.jl icon indicating copy to clipboard operation
Agents.jl copied to clipboard

Allow writing data during `run!`

Open kavir1698 opened this issue 2 years ago • 8 comments

Adds an option to run! so that collected data can be written to file during the simulation. It is useful when collected data are too large to fit the memory by the end of the simulation.

kavir1698 avatar Jun 08 '22 02:06 kavir1698

Codecov Report

Merging #630 (1f2241d) into master (dbddf76) will increase coverage by 0.17%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #630      +/-   ##
==========================================
+ Coverage   91.04%   91.22%   +0.17%     
==========================================
  Files          24       24              
  Lines        1631     1664      +33     
==========================================
+ Hits         1485     1518      +33     
  Misses        146      146              
Impacted Files Coverage Δ
src/Agents.jl 100.00% <ø> (ø)
src/simulations/collect.jl 100.00% <100.00%> (ø)

:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

codecov-commenter avatar Jun 08 '22 02:06 codecov-commenter

@kavir1698 thanks for the PR! This is a good feature, however I believe we should not complicate the run! function more, it already has a lot of options. I would recommend to make a new function that does this functionality. I suggest as name offline_run!, but feel free to suggest better ones. Given that the function is supposed to operate when final data are too large to fit in memory, then the function also shouldn't return anything.

Datseris avatar Jul 04 '22 21:07 Datseris

I don't mind creating a new function. But that would create a lot of duplicate code because ensemblerun! may also support writing outputs during runs.

kavir1698 avatar Jul 05 '22 09:07 kavir1698

But then ensemble run would also need extra code because it would need to somehow clarify the extra column. While it is sad that we will have code duplication, I think it will lead to simpler development in the long run if we have smaller functions instead of really large functions that do many things in once with a bunch of if statements inside.

Datseris avatar Jul 05 '22 09:07 Datseris

Apologies @kavir1698 , I need to release 5.4, so this will go in in the next minor release, since we need some time to think what is the best interface for this feature.

Datseris avatar Jul 06 '22 18:07 Datseris

Apologies @kavir1698 , I need to release 5.4, so this will go in in the next minor release, since we need some time to think what is the best interface for this feature.

Sure. It would take me some time to rewrite this PR.

kavir1698 avatar Jul 07 '22 08:07 kavir1698

@kavir1698 I'll be releasing v5.5 sometime soon, perhaps you want to get this in there?

Datseris avatar Jul 29 '22 12:07 Datseris

I'll work on it! :)

kavir1698 avatar Jul 30 '22 15:07 kavir1698

Hey @kavir1698, are you still planning to continue work on this PR? Recently there has been some interest in writing data to disk during simulation runs (specifically for paramscans but that's just more of the same). It might be worthwhile to pick this PR up again, fix the minor doubts from @Datseris and update it for the current Agents version. If you don't have any time for this, I might pick it up where you left it and try to finish it.

fbanning avatar Nov 16 '22 10:11 fbanning

Hi @fbanning I am currently distracted because of the situation in my country, Iran. I can't promise to finish it soon. If you have time, by all means, finish this PR please.

kavir1698 avatar Nov 16 '22 10:11 kavir1698

I am currently distracted because of the situation in my country, Iran.

✊🏻

If you have time, by all means, finish this PR please.

I'll talk to the person over on Slack who is interested in this topic and see if they want to pick it up, otherwise I'll do it.

fbanning avatar Nov 16 '22 10:11 fbanning

I would need this and can try to get this done soon-ish. Did something relevant change since the PR was initiated?

mastrof avatar Jun 02 '23 19:06 mastrof

no

Datseris avatar Jun 02 '23 19:06 Datseris

Closing in favor of #815

Datseris avatar Jun 07 '23 22:06 Datseris