Skip to content
Snippets Groups Projects
Commit 8b79013e authored by Ian's avatar Ian Committed by Ian
Browse files

refactor: copy config file to output_dir instead of logging contents

parent 00664fa8
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,7 @@ Usage: ...@@ -31,6 +31,7 @@ Usage:
import datetime import datetime
import logging import logging
import os import os
import shutil
from pathlib import Path from pathlib import Path
from typing import Dict, List from typing import Dict, List
...@@ -186,18 +187,14 @@ def main( ...@@ -186,18 +187,14 @@ def main(
if redo_of: if redo_of:
validate_redo_tag(run_config) validate_redo_tag(run_config)
# Read and log full model configuration # Copy config file into output directory for safekeeping
model_config_path = s3_url_to_local_path(run_config.model_config) model_config_path = s3_url_to_local_path(run_config.model_config)
try: try:
with open(model_config_path, "r") as config_file: shutil.copy(model_config_path, output_dir / Path(model_config_path).name)
full_model_config = config_file.read()
except Exception as e: except Exception as e:
logging.error("Error reading config file" logging.error(f"Error copying config file from {model_config_path}: {str(e)}")
f"from {model_config_path}: {str(e)}")
raise raise
logging.debug(f"Configuration:\n{full_model_config}")
# Query the CMR for granules # Query the CMR for granules
product_granules: Dict[str, List[Granule]] = {} product_granules: Dict[str, List[Granule]] = {}
for product in ["l1b", "l2a", "l4a"]: for product in ["l1b", "l2a", "l4a"]:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment