Skip to content

fix and improve run_dev_instance.sh

Mforns requested to merge fix-run-dev-instance into main

This MR fixes a bug and adds a couple improvements to the run_dev_instance.sh script.

BUG: We moved a variable definition up in the code, but it needed to be below the shifting of the optional arguments. This change moves the variable definition back under the shifting.

IMPROVEMENT 1: The script now automatically extracts the kerberos keytab of the user if present (in addition to the kerberos principal and ccache) and adds it to the airflow.cfg file. This allows to run the run_dev_instance.sh script with any user, just by sudoing into it. Note that system users don't have a $HOME defined, and it is needed for Conda to work properly. So, if you're runing the script with a system user, you have to specify a temporary HOME folder with the option -m. Examples:

# For regular users
./run_dev_instance.sh -p 8765 analytics
# For system users
sudo -u analytics-privatedata ./run_dev_instance -m /tmp/mforns_airflow_development -p 8765 analytics

IMPROVEMENT 2: The script now explicitly kills (SIGTERM) the Airflow webserver and scheduler processes when doing the cleanup (at Ctrl+C). This prevents the orphaned/zombie processes that were usually left behind after using the script.

Edited by Mforns

Merge request reports