Update upgrade_airflow_worker.sh script

The current script is fragile to the introduction of a DEBUG logging
level. This change addresses the specifics of logging records being
returned when invoking the airflow command enough to make the dag_status
result end up being the last result as the script desires, so the script
is returned to working order, even if the logging level is set to DEBUG.

This change goes a little further to the point of removing all records
that indicate a logging level of DEBUG|INFO|WARN|ERROR.

Change-Id: Ic72358097e3a476e20fa3713008d0d0bcd35463e
Bryan Strassner 2019-04-17 08:36:35 -05:00
parent b36bf8abb7
commit 6f995d1fb2
1 changed files with 2 additions and 1 deletions

View File

@ -63,7 +63,8 @@ do
cd "${0%/*}"
# Get current state of dag using Airflow CLI
check_dag_state=`airflow dag_state ${dag_id} ${dag_execution_date}`
# Use grep to remove logging messages that can pollute the status response
check_dag_state=`airflow dag_state ${dag_id} ${dag_execution_date} | grep -vE "DEBUG|INFO|WARN|ERROR"`
echo -e ${check_dag_state} >> /usr/local/airflow/upgrade_airflow_worker.log
# We will need to extract the last word in the 'check_dag_state'