From 8b79013e6ce737d80791212018bdb90ac6cb3a06 Mon Sep 17 00:00:00 2001
From: "Ian Grant (aider)" <ian.conway.grant@gmail.com>
Date: Thu, 15 May 2025 17:10:07 -0400
Subject: [PATCH] refactor: copy config file to output_dir instead of logging
 contents

---
 run_on_maap.py | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/run_on_maap.py b/run_on_maap.py
index 6df7330..2bbb389 100644
--- a/run_on_maap.py
+++ b/run_on_maap.py
@@ -31,6 +31,7 @@ Usage:
 import datetime
 import logging
 import os
+import shutil
 from pathlib import Path
 from typing import Dict, List
 
@@ -186,18 +187,14 @@ def main(
     if redo_of:
         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)
     try:
-        with open(model_config_path, "r") as config_file:
-            full_model_config = config_file.read()
+        shutil.copy(model_config_path, output_dir / Path(model_config_path).name)
     except Exception as e:
-        logging.error("Error reading config file"
-                      f"from {model_config_path}: {str(e)}")
+        logging.error(f"Error copying config file from {model_config_path}: {str(e)}")
         raise
 
-    logging.debug(f"Configuration:\n{full_model_config}")
-
     # Query the CMR for granules
     product_granules: Dict[str, List[Granule]] = {}
     for product in ["l1b", "l2a", "l4a"]:
-- 
GitLab