easthy-alterpost opened a new issue #19344:
URL: https://github.com/apache/airflow/issues/19344


   ### Apache Airflow version
   
   2.1.4
   
   ### Operating System
   
   Amazon Linux 2 AMI
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Other
   
   ### Deployment details
   
   Cloudformation template based on 
https://github.com/villasv/aws-airflow-stack/blob/v2/aws/cloud-formation-template.yml
   
   ### What happened
   
   DAG can have multiple active runs despite of `max_active_runs` set to 1 when 
it is triggered externally from TriggerDagRunOperator
   
   ### What you expected to happen
   
   If DAG has max_active_runs = 1 it should never start more than once
   
   ### How to reproduce
   
   DAG #1
   ```
   with DAG('dag_1',
                   default_args=default_args,
                   max_active_runs=1,
                   start_date=datetime(2021, 11, 1),
                   schedule_interval="* * * * *",
                   dagrun_timeout=timedelta(minutes=1),
                   catchup=False) as dag:
   
       TriggerDagRunOperator(task_id='trigger_dag_2',
                                                             
trigger_dag_id='dag_2')
   ```
   
   DAG #2
   ```
   from airflow.operators.bash import BashOperator
   
   with DAG('dag_2',
                   default_args=default_args,
                   max_active_runs=1,
                   start_date=datetime(2021, 11, 1),
                   schedule_interval=None,
                   dagrun_timeout=timedelta(minutes=10),
                   catchup=False) as dag:
   
       BashOperator(
           task_id="dag_keeper",
           bash_command="sleep 5m"
       )
   ```
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to