From 5231d4cc2cc45cfbb486a153e2e73d15eb3ad19d Mon Sep 17 00:00:00 2001 From: idipanshu Date: Mon, 7 Aug 2023 16:41:37 +0530 Subject: [PATCH] fix: S3 path bug --- automation/deploy_glue_job.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/automation/deploy_glue_job.sh b/automation/deploy_glue_job.sh index 9fbd11b..2299baf 100755 --- a/automation/deploy_glue_job.sh +++ b/automation/deploy_glue_job.sh @@ -14,10 +14,13 @@ do # Check if the job exists, if not create it, else update it job_exists=$(aws glue get-job --job-name $file_name | jq -r .Job.Name) + # Create S3 path to the main.py file + script_location="s3://$s3_path/$file_name/main.py" + if [ "$job_exists" != "$file_name" ]; then # Set the script name in the glue_job.json file using jq json_data=$(jq --arg SCRIPT_NAME "$file_name" '.Name=$SCRIPT_NAME' automation/create_glue_job.json) - json_data=$(jq --arg LOCATION "$s3_path/$file_name/main.py" '.Command.ScriptLocation=$LOCATION' <<< $json_data) + json_data=$(jq --arg LOCATION $script_location '.Command.ScriptLocation=$LOCATION' <<< $json_data) # Create the glue job echo "Creating glue job $file_name" @@ -25,7 +28,7 @@ do else # Set the script name in the glue_job.json file using jq json_data=$(jq --arg SCRIPT_NAME "$file_name" '.JobName=$SCRIPT_NAME' automation/update_glue_job.json) - json_data=$(jq --arg LOCATION "$s3_path/$file_name/main.py" '.JobUpdate.Command.ScriptLocation=$LOCATION' <<< $json_data) + json_data=$(jq --arg LOCATION $script_location '.JobUpdate.Command.ScriptLocation=$LOCATION' <<< $json_data) # Update the glue job echo -e "\nUpdating glue job $file_name"