diff --git a/run_xexe.sh b/run_xexe.sh index 141c9a7..4ffdd50 100644 --- a/run_xexe.sh +++ b/run_xexe.sh @@ -12,8 +12,8 @@ else fi # Messages to be sent to Slack -slack_failure_message=":rotating_light::rotating_light::rotating_light: One or more failures during scheduled `xexe` run in production. :rotating_light::rotating_light::rotating_light:" -slack_success_message=":white_check_mark::white_check_mark::white_check_mark: `xexe` run executed successfully in production. :white_check_mark::white_check_mark::white_check_mark:" +slack_failure_message=":rotating_light::rotating_light::rotating_light: One or more failures during scheduled xexe run in production. :rotating_light::rotating_light::rotating_light:" +slack_success_message=":white_check_mark::white_check_mark::white_check_mark: xexe run executed successfully in production. :white_check_mark::white_check_mark::white_check_mark:" # Initialize the failure flag has_any_step_failed=0 @@ -22,15 +22,12 @@ cd /home/azureuser/data-xexe # Update from git echo "Updating xexe project from git." | while IFS= read -r line; do printf '%s %s\n' "$(date)" "$line"; done >> /home/azureuser/xexe_run.log 2>&1 -#git checkout master | while IFS= read -r line; do printf '%s %s\n' "$(date)" "$line"; done >> /home/azureuser/xexe_run.log 2>&1 -#git pull | while IFS= read -r line; do printf '%s %s\n' "$(date)" "$line"; done >> /home/azureuser/xexe_run.log 2>&1 - -# Activate venv -poetry shell +git checkout master | while IFS= read -r line; do printf '%s %s\n' "$(date)" "$line"; done >> /home/azureuser/xexe_run.log 2>&1 +git pull | while IFS= read -r line; do printf '%s %s\n' "$(date)" "$line"; done >> /home/azureuser/xexe_run.log 2>&1 # DWH-healthcheck echo "Running DWH healthcheck..." | while IFS= read -r line; do printf '%s %s\n' "$(date)" "$line"; done >> /home/azureuser/xexe_run.log 2>&1 -xexe dwh-healthcheck | while IFS= read -r line; do printf '%s %s\n' "$(date)" "$line"; done >> /home/azureuser/xexe_run.log 2>&1 +poetry run xexe dwh-healthcheck | while IFS= read -r line; do printf '%s %s\n' "$(date)" "$line"; done >> /home/azureuser/xexe_run.log 2>&1 if [ $? -ne 0 ]; then has_any_step_failed=1 echo "Something went wrong when healthchecking DWH." | while IFS= read -r line; do printf '%s %s\n' "$(date)" "$line"; done >> /home/azureuser/xexe_run.log 2>&1 @@ -38,7 +35,7 @@ fi # xe healthcheck echo "Running XE.com healthcheck..." | while IFS= read -r line; do printf '%s %s\n' "$(date)" "$line"; done >> /home/azureuser/xexe_run.log 2>&1 -xexe xe-healthcheck | while IFS= read -r line; do printf '%s %s\n' "$(date)" "$line"; done >> /home/azureuser/xexe_run.log 2>&1 +poetry run xexe xe-healthcheck | while IFS= read -r line; do printf '%s %s\n' "$(date)" "$line"; done >> /home/azureuser/xexe_run.log 2>&1 if [ $? -ne 0 ]; then has_any_step_failed=1 echo "Something went wrong when healthchecking xe.com." | while IFS= read -r line; do printf '%s %s\n' "$(date)" "$line"; done >> /home/azureuser/xexe_run.log 2>&1 @@ -51,7 +48,7 @@ end_date=$(date -d "yesterday" +"%Y-%m-%d") # run the actual thing echo "Getting rates from xe.com..." | while IFS= read -r line; do printf '%s %s\n' "$(date)" "$line"; done >> /home/azureuser/xexe_run.log 2>&1 -xexe get-rates --currencies "$currencies" --start-date "$start_date" --end-date "$end_date" --rates-source xe --output dwh --ignore-warnings | while IFS= read -r line; do printf '%s %s\n' "$(date)" "$line"; done >> /home/azureuser/xexe_run.log 2>&1 +poetry run xexe get-rates --currencies "$currencies" --start-date "$start_date" --end-date "$end_date" --rates-source xe --output dwh --ignore-warnings | while IFS= read -r line; do printf '%s %s\n' "$(date)" "$line"; done >> /home/azureuser/xexe_run.log 2>&1 if [ $? -ne 0 ]; then has_any_step_failed=1 echo "Something went wrong when getting rates." | while IFS= read -r line; do printf '%s %s\n' "$(date)" "$line"; done >> /home/azureuser/xexe_run.log 2>&1