Skip to content

Instantly share code, notes, and snippets.

@danielchalef
Created October 12, 2019 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielchalef/4fa408b2bcdc0624ceb920cb008fd58f to your computer and use it in GitHub Desktop.
Save danielchalef/4fa408b2bcdc0624ceb920cb008fd58f to your computer and use it in GitHub Desktop.
Clean up airflow dev environment and restart webserver/scheduler
#!/bin/bash
if [ -z "$AIRFLOW_HOME" ]
then
echo "AIRFLOW_HOME is not set"
exit 1
fi
if [ -f "$AIRFLOW_HOME/airflow-webserver.pid" ]
then
ps au | grep airflow | awk '{ print $2 }' | xargs kill 2> /dev/null
fi
AIRFLOW_DB=$AIRFLOW_HOME/airflow.db
if [ -f "$AIRFLOW_DB" ]
then
rm $AIRFLOW_HOME/airflow.db
fi
rm -rf $AIRFLOW_HOME/logs/*
airflow initdb
airflow webserver -p 8080 &>> $AIRFLOW_HOME/run.log &
airflow scheduler &>> $AIRFLOW_HOME/run.log &
sleep 5
airflow variables -i $AIRFLOW_HOME/variables.json
airflow connections -d --conn_id aws_default && \
airflow connections -a --conn_id aws_default --conn_type aws --conn_extra '{ "region_name": "us-west-2" }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment