max_active_runs failed in production env with multiple workers
Apache Airflow version: 1.10.10
Environment:
- Cloud provider or hardware configuration:
- OS (e.g. from /etc/os-release): centos 7.5
- Kernel (e.g.
uname -a):Linux prod-auto-ops001 3.10.0-1062.4.1.el7.x86_64 #1 SMP Fri Oct 18 17:15:30 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux - Install tools: pip
- Others:
What happened:
I have two environments, one is development, another is production. They uses CeleryExecutor and redis for broker, mysql for result backend and the airflow db. The only difference is production env got two worker.
I passed the params, max_active_runs in my dag defination , eg:
dag = DAG(
dag_id='test_max_active_runs',
default_args=default_args,
schedule_interval=None,
start_date=airflow.utils.dates.days_ago(1),
max_active_runs=1
)
In the dev env, when the task is scheduled, the dashboard will show 1/1 active dag runs in red color, while nothing happens in the production env.
May I suppose that the setting max_active_runs is not working in my production env?
What you expected to happen:
It should be exactly the same in the production env comparison to the dev env.
How to reproduce it: Let me know if you need further information
Thanks for opening your first issue here! Be sure to follow the issue template!
Have you scripted building your envs, eg can you provide docker-compose files?
Have you scripted building your envs, eg can you provide docker-compose files?
@svetli-n , I installed everything via pip (pip install apache-airflow[all]), except the local virtual env was installed by anaconda and the production was installed from source code. additionally, except the db or broker config, everything is the same.
@ChristianYeah Thanks. I can't reproduce it though. Feel free to share full dag run file including deafult settings and tasks, as well as how you trigger the dag run.
I’ll duplicate the production env to the test later later , see if it will be reproduced.
发自我的iPhone
------------------ Original ------------------ From: svetli-n <[email protected]> Date: Tue,Jun 9,2020 7:12 PM To: apache/airflow <[email protected]> Cc: ChristianYe <[email protected]>, Mention <[email protected]> Subject: Re: [apache/airflow] max_active_runs failed in production env with multiple workers (#9131)
@ChristianYeah Thanks. I can't reproduce it though. Feel free to share full dag run file including deafult settings and tasks, as well as how you trigger the dag run.
Hi, @svetli-n , sorry for the late reponse, here is the code
# coding:utf-8
import airflow
from airflow import DAG
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.python_operator import PythonOperator
from fabric import Connection
default_args = {
'owner': 'yexiaodong',
}
dag = DAG(
dag_id='sync_dags',
default_args=default_args,
schedule_interval=None,
start_date=airflow.utils.dates.days_ago(1),
max_active_runs=1,
)
def git_pull_function():
for host in ["172.16.16.178", "172.16.16.177"]:
with Connection(host=host, user='ops', port=22) as c:
result = c.run('cd /home/ops/code/master_dag_repo && git pull')
print(host, result)
git_pull = PythonOperator(
task_id='git-pull',
python_callable=git_pull_function,
dag=dag,
)
I would like to limit the max active dag run to 1 for ensuring the sync progress won't go wrong. It works on the local env, but the production env seems like not working as expected
This issue is reported against older version of Airflow. Please check against latest version. If needed we will reopen this issue.