-
Notifications
You must be signed in to change notification settings - Fork 16
Allow suspend/resume of simulations on Batch runs #1668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
tamuri
wants to merge
10
commits into
master
Choose a base branch
from
tamuri/1665-suspend-resume-batch
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f6a0556
Pass through command-line arguments to scenario
tamuri 70d721b
Expand environment variables in specified path if provided (quick fix…
tamuri 81c36d9
Close the log file handle before pickling the simulation
tamuri 4723a4e
Scenario for testing suspend/resume
tamuri fb3c80d
Rewrite the argument for resume-simulation argument
tamuri e040894
Use printing because logger only works when configured via simulation
tamuri 16b2618
Improve message
tamuri 91fa801
Allow user to specific a specific draw to resume simulation from
tamuri 509fc76
Override parameters when restoring simulation
tamuri 6a2ac5d
Handle resuming from multi-digit draws
tamuri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| """ | ||
| This file defines a batch run of a large population for a long time with all disease modules and full use of HSIs | ||
| It's used for calibrations (demographic patterns, health burdens and healthsystem usage) | ||
|
|
||
| Run on the batch system using: | ||
| ```tlo batch-submit src/scripts/calibration_analyses/scenarios/long_run_all_diseases.py``` | ||
|
|
||
| or locally using: | ||
| ```tlo scenario-run src/scripts/calibration_analyses/scenarios/long_run_all_diseases.py``` | ||
|
|
||
| """ | ||
|
|
||
| from tlo import Date, logging | ||
| from tlo.analysis.utils import get_parameters_for_status_quo | ||
| from tlo.methods.fullmodel import fullmodel | ||
| from tlo.scenario import BaseScenario | ||
|
|
||
|
|
||
| class SuspendResumeTest(BaseScenario): | ||
| def __init__(self): | ||
| super().__init__() | ||
| self.seed = 0 | ||
| self.start_date = Date(2010, 1, 1) | ||
| self.end_date = Date(2012, 1, 1) # The simulation will stop before reaching this date. | ||
| self.pop_size = 1_000 | ||
| self.number_of_draws = 2 | ||
| self.runs_per_draw = 2 | ||
|
|
||
| def log_configuration(self): | ||
| return { | ||
| 'filename': 'suspend_resume_test', # <- (specified only for local running) | ||
| 'directory': './outputs', # <- (specified only for local running) | ||
| 'custom_levels': { | ||
| '*': logging.WARNING, | ||
| 'tlo.methods.demography': logging.INFO, | ||
| 'tlo.methods.demography.detail': logging.WARNING, | ||
| 'tlo.methods.healthburden': logging.INFO, | ||
| 'tlo.methods.healthsystem': logging.INFO, | ||
| 'tlo.methods.healthsystem.summary': logging.INFO, | ||
| "tlo.methods.contraception": logging.INFO, | ||
| } | ||
| } | ||
|
|
||
| def modules(self): | ||
| return fullmodel() | ||
|
|
||
| def draw_parameters(self, draw_number, rng): | ||
| return get_parameters_for_status_quo() | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| from tlo.cli import scenario_run | ||
|
|
||
| scenario_run([__file__]) |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.