From 5f71205ca63c9d2441e99d64943445b0cac8f966 Mon Sep 17 00:00:00 2001 From: laestrada Date: Wed, 6 Dec 2023 11:49:26 -0500 Subject: [PATCH] wrap conditional around s3_upload.py script --- run_imi.sh | 4 +++- src/utilities/s3_upload.py | 5 +---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/run_imi.sh b/run_imi.sh index e928ec75..22c8cd59 100755 --- a/run_imi.sh +++ b/run_imi.sh @@ -198,6 +198,8 @@ cp $ConfigFile "${RunDirs}/config_${RunName}.yml" # Upload output to S3 if specified cd $InversionPath -python src/utilities/s3_upload.py $ConfigFile +if "$S3Upload"; then + python src/utilities/s3_upload.py $ConfigFile +fi exit 0 diff --git a/src/utilities/s3_upload.py b/src/utilities/s3_upload.py index 5a1677bf..9fcb81ab 100644 --- a/src/utilities/s3_upload.py +++ b/src/utilities/s3_upload.py @@ -81,10 +81,7 @@ def zip_and_upload_to_s3(file_paths, bucket_name, s3_key): config_path = sys.argv[1] with open(config_path, "r") as f: config = yaml.safe_load(f) - - if config["S3Upload"] != "true": - sys.exit(0) - + bucket = extract_s3_part(config["S3UploadPath"], "bucket") key = extract_s3_part(config["S3UploadPath"], "key")