It would be very useful to be able to checkpoint a simulation. Meaning to be able to save its entire state and restart it at the exact time it was checkpointed.
The simpy mailing group brought up os.fork() (Linux-only) as a possible solution, but that isn't fully compatible with all OS-es, and there may be use cases where checkpointing may want to save to a file for later use.
Initial thoughts for what this requires:
- Storing all state values (mostly done)
- Storing all knowledge
- Recording positions in tasks
- Recording all events in Simpy's queue
- Enforcing assumptions - such as only using UPSTAGE events, actors, and tasks. Processes or other complications likely won't work.
- Reloading, playing through a task network to reach the correct position, setting the states, etc.
It would be very useful to be able to checkpoint a simulation. Meaning to be able to save its entire state and restart it at the exact time it was checkpointed.
The simpy mailing group brought up
os.fork()(Linux-only) as a possible solution, but that isn't fully compatible with all OS-es, and there may be use cases where checkpointing may want to save to a file for later use.Initial thoughts for what this requires: