-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for saving and loading simulation state to / from files (#…
…1227) * Factor out parts of simulate method * Further refactoring of Simulation * Add methods for saving and loading simulations * Add initial test for simulation saving and loading * Factor out and add additional simulation test checks * Explicitly set logger output file when loading from pickle Avoids deadlock on trying to acquire lock on loaded file handler * Check next date in event queue before popping Ensures event not lost in partial simulations * Make pytest seed parameter session scoped Allows use in fixtures with non-function scope * Don't use next on counter in test check Has side effect of mutating counter * Refactor global constants to fixtures in simulation tests + additional tests * Move logging configuration out of load_from_pickle Better to be explicit * Add test for exception when simulation past end date * Add docstrings for new methods * Add errors when running without initialising or initialising multiple times * Add dill to dependencies * Sort imports * Fix fenceposting error in simulation end date * Fix explicit comparison to type * Add option to configure logging when loading from pickle * Move check for open log file in close_output_file method * Tidy up docstrings and type hints * Remove use of configure_logging in test * Update scenario to allow suspending and resuming Co-authored-by: Asif Tamuri <[email protected]> * Add utility function to merge log files * Add test to check equality of parsed log files in suspend-resume * Fix import sort order * Update pinned dill version to 0.3.8 * Adding log message when loading suspended simulation * Adding log message when saving suspended simulation * Increase simulation pop size and duration in test * Avoid reading in log files to be merged all at once * Add tests for merge_log_files function * Fix import order sorting * Fix import order sorting (second attempt) --------- Co-authored-by: Asif Tamuri <[email protected]>
- Loading branch information
1 parent
5b4f328
commit a23e57d
Showing
10 changed files
with
825 additions
and
172 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.