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")