overthesun / simoc

A scalable model of an interactive, off-world community
https://ngs.simoc.space/
GNU General Public License v3.0
2 stars 2 forks source link

Missing last step #82

Closed ezio-melotti closed 5 years ago

ezio-melotti commented 5 years ago

On a 100 hours simulation, I request steps 1-100 (inclusive), but I only get steps 1-99 and the FE gets stuck asking for the 100th step. I also tried asking for steps 0-99, but the first step I receive is step 1. I'm not sure if this is because step 100 doesn't exist so the server has nothing to return, or if it's because I requested 10 steps so the server is waiting for more steps before returning them all.

The request I send after receiving step 99 includes 'min_step_num': 100, 'n_steps': 10.

@breathnach @Pebody can you look into this?

breathnach commented 5 years ago

The logic in get_steps is pretty simple. If you ask for min_step 1 nsteps 100, it will try to get all step data for steps >= 1 and <= 1+100-1. It will return data for all step numbers found on ModelRecord && StepRecord. So from the perspective of this route, the only thing that can prevent all data being returned is if it isn't in both StepRecord and ModelRecord.

breathnach commented 5 years ago

From further discussion, it seems passing step_num= 100 to get_step_to only results in steps 1-99 being calculated.

In get_step in game_runner.py it looks like the code should run up to and including step_num, unless agent_model.is_terminated. So I'm not sure if the agent_model is somehow being terminated in the penultimate step. But Iurii will be better able to answer this than me.

ezio-melotti commented 5 years ago

I think this is caused by the fix applied in #81. I tried to revert to the parent changeset and I received all the steps (from 1 to 100 inclusive), even though the last step of each batch (including step 100) were missing the values as reported in #81.

iurii-milovanov commented 5 years ago

Fixed in https://github.com/kstaats/simoc/commit/d07ad96785eefa56acf19e1eb11e4725dcf0da10