Skip to content

Commit

Permalink
wrap conditional around s3_upload.py script
Browse files Browse the repository at this point in the history
  • Loading branch information
laestrada committed Dec 6, 2023
1 parent beb957d commit 5f71205
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 3 additions & 1 deletion run_imi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 1 addition & 4 deletions src/utilities/s3_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 5f71205

Please sign in to comment.