Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/tlo/analysis/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,13 +511,13 @@ def format_gbd(gbd_df: pd.DataFrame):
return gbd_df


def create_pickles_locally(scenario_output_dir, compressed_file_name_prefix=None):
def create_pickles_locally(scenario_output_dir, compressed_file_name_prefix=None, level: int = logging.INFO):
"""For a run from the Batch system that has not resulted in the creation of the pickles, reconstruct the pickles
locally."""

def turn_log_into_pickles(logfile):
print(f"Opening {logfile}")
outputs = parse_log_file(logfile)
outputs = parse_log_file(logfile, level)
for key, output in outputs.items():
if key.startswith("tlo."):
print(f" - Writing {key}.pickle")
Expand All @@ -541,7 +541,8 @@ def uncompress_and_save_logfile(compressed_file) -> Path:
logfile = [x for x in os.listdir(run_folder) if x.endswith('.log')][0]
else:
compressed_file_name = [
x for x in os.listdir(run_folder) if x.startswith(compressed_file_name_prefix)
x for x in os.listdir(run_folder) if x.startswith(compressed_file_name_prefix) and
x.endswith('.log.gz')
][0]
logfile = uncompress_and_save_logfile(Path(run_folder) / compressed_file_name)

Expand Down