Airflow scheduler does not appear to be running. Last heartbeat was received 20 minutes ago. The DAGs list may not update : Resolved

Apache Airflow

You may get an error in Airflow as 

“The scheduler does not appear to be running. Last heartbeat was received 20 minutes ago. The DAGs list may not update, and new tasks will not be scheduled.”
If you are able to see the Airflow home page and the above message , you can first try this 
Got to the instance , instance where the Airflow is hosted, we assume here its AWS EC2
Got to the path where Airflow is hosted , if its in Virtual environment , you need to navigate to that path 
python3 -m venv virtualenv
source virtualenv/bin/activate
export AIRFLOW_HOME=/home/ubuntu/workspace/airflow
cd $AIRFLOW_HOME
nohup airflow scheduler > airflow_scheduler.log &

Troubleshooting Steps

Check the Scheduler’s Log

Go to the log directory where Airflow stores its logs and check the scheduler’s logs for any errors or warnings. You might find some useful information about why the scheduler is not running.

Check Scheduler’s Process

Use process monitoring commands (ps, top, or htop) to check whether the scheduler process is running or not.

If it’s not running, you might need to start it manually.

Check DAGs

Check if there are any errors in your DAGs which might be causing the scheduler to crash. You can do this by running airflow dags list or by going to the Airflow Web UI and looking at the DAGs.

Check Resources

Sometimes, lack of resources (memory, CPU) can cause the scheduler to crash or stop running. Ensure that your machine has sufficient resources.

Check Database Connection

The scheduler communicates with the metadata database, so you should ensure that the database is reachable and that there are no connection issues.

Restart the Scheduler

If you don’t see any issues, try restarting the scheduler and see if it resolves the problem.

Commands

Here are the common commands to manage the Airflow scheduler:

To start the scheduler:

airflow scheduler
To check the status of the scheduler:
ps aux | grep "airflow scheduler"
All this is for the Standalone Airflow hosted in your instance
Read more on Airflow here :
Author: user

Leave a Reply