How do I restart airflow webserver?
I advice running airflow in a robust way, with auto-recovery with systemd
so you can do:
- to start systemctl start airflow
- to stop systemctl stop airflow
- to restart systemctl restart airflow
For this you'll need a systemd 'unit' file.
As a (working) example you can use the following:put it in /lib/systemd/system/airflow.service
[Unit]
Description=Airflow webserver daemon
After=network.target postgresql.service mysql.service redis.service rabbitmq-server.service
Wants=postgresql.service mysql.service redis.service rabbitmq-server.service
[Service]
PIDFile=/run/airflow/webserver.pid
EnvironmentFile=/home/airflow/airflow.env
User=airflow
Group=airflow
Type=simple
ExecStart=/bin/bash -c 'export AIRFLOW_HOME=/home/airflow ; airflow webserver --pid /run/airflow/webserver.pid'
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
Restart=on-failure
RestartSec=42s
PrivateTmp=true
[Install]
WantedBy=multi-user.target
P.S: change AIRFLOW_HOME to where your airflow folder with the config
How to restart Airflow webserver and scheduler?
If tied to systemctl
you can restart the webserver as
sudo systemctl restart airflow-webserver
How can I restart the airflow server on Google Composer?
Since Cloud Composer is an Apache Airflow managed service, it is not possible to restart the whole service. You can restart though the single instances of the service, as described here, but this will not help to apply to the plugin changes.
To apply the plugin changes, you should install the plugin after loading it into the plugin
folder, automatically created when you created the environment:
gcloud composer environments storage plugins import --environment ENVIRONMENT_NAME \
--location LOCATION \
--source PATH_TO_LOCAL_FILE \
--destination PATH_IN_SUBFOLDER
DAG updates are performed automatically and some other must be applied using
gcloud composer environments update
command.
Restarting the airflow scheduler
Run ps aux | grep airflow
and check if airflow webserver
or airflow scheduler
processes are running. If they are kill them and rerun using airflow scheduler -D
Start Airflow Webserver Automaticalll as a Service
For anyone who gets the same Error:
Main PID: 5913 (code=exited, status=217/USER)
this indicates that the user is incorrect. After adapting the user and group, this service worked for me.
Related Topics
How to Hide Tkinter Python Gui
Convert a Python Int into a Big-Endian String of Bytes
How to Pass a .Txt File to a Function in Python
How to Drop Rows of Pandas Dataframe Whose Value in a Certain Column Is Nan
Python Data Frame How to Find the Local Maximum in a 2D Array
How Does the Code Prints 1 2 6 24 as Output and Not 24 6 2 1
Vscode: There Is No Pip Installer Available in the Selected Environment
Replace Single Quote to Double Quote Python Pandas Dataframe
How to Remove Commas and Dots of Individual Word in Two Dimensional List
Stripping Whitespaces from a List Inside the List of Tuples
Key Error: None of [Int64Index...] Dtype='Int64] Are in the Columns
How to Expand Input Buffer Size of Pyserial
How to Repeat a Function N Times
How to Check If a String Contains 2 of the Same Character
How to Get String Objects Instead of Unicode from Json
In Python, How to Check If a String Only Contains Certain Characters