GitHub user mdenison edited a discussion: Airflow 3.1.0 TriggerDagRunOperator 
fails with fail_when_dag_is_paused=True

Hello everyone, I am currently in the process of migrating from Airflow 2.x to 
3.1.0. 

We have a bunch of DAGs we combined into an overarching DAG in order to also 
run them separately. To achieve this I've used the TriggerDagRunOperator, 
before the flag `fail_when_dag_is_paused` was introduced, I had a wrapper that 
used to look into the DagModel via `DagModel.get_dagmodel(dag_id)`to check if 
the DAG is paused. This of course ran into the `"Direct database access via the 
ORM is not allowed in Airflow 3.0"` Issue. 

Using the parameter `fail_when_dag_is_paused=True` on the TriggerDagRunOperator 
I get the same issue with Airflow 3.1.0. I assume that happens since Airflow 
3.1.0. 

I assume it still happens do to 
https://airflow.apache.org/docs/apache-airflow/stable/installation/upgrading_to_airflow3.html#database-access-restrictions
 . 

But, am I doing something wrong or missing a point? 

DAG which shall be triggered:
```
@dag(dag_id="hello_world", default_args=default_args, schedule=None, 
max_active_runs=1)
def generate_dag():
    BashOperator(
        task_id="print",
        bash_command='echo hello world',
    )

generate_dag()
```

DAG which is triggering the other DAG:
```
@dag(dag_id="run_hello_world", default_args=default_args, schedule=None, 
max_active_runs=1)
def generate_dag():
    TriggerDagRunOperator(
        task_id="run_hello_world_dag_task",
        trigger_dag_id="hello_world",
        wait_for_completion=True,
        fail_when_dag_is_paused=True,
    )

generate_dag()
```

GitHub link: https://github.com/apache/airflow/discussions/56615

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to