matthewblock opened a new issue, #48823: URL: https://github.com/apache/airflow/issues/48823
### Description I have a DAG where I want to leverage `setup` and `teardown` tasks. However, the `setup` task is optional - I want it to be skipped if the value of an Airflow variable is `False`. If it's skipped, I still want its downstream task to execute - In order to do this, the downstream task must have `trigger_rule=NONE_FAILED`. The [implicit `ALL_SUCCESS` contstraint](https://airflow.apache.org/docs/apache-airflow/stable/howto/setup-and-teardown.html#implicit-all-success-constraint) prevents me from doing this, causing a DAG parse failure: > Any task in the scope of a setup has an implicit `all_success` constraint on its setups. This is necessary to ensure that if a task with indirect setups is cleared, it will wait for them to complete. If a setup fails or is skipped, the work tasks which depend them will be marked ask failures or skips. We also require that any non-teardown directly downstream of a setup must have trigger rule `ALL_SUCCESS`. ### Use case/motivation On our Airflow instance deployed to our server, we want to drop a database's replication slot in the `setup` task, then we have several tasks that insert data into the database, then we add back the replication slot in the `teardown` task. When we run this DAG locally, there is no replication slot, so I want to show the `setup`/`teardown` task are `skipped` because they won't actually do anything. Right now, I can't set the tasks downstream of the `setup` task to have `trigger_rule=NONE_FAILED` because they are required to have `trigger_rule=ALL_SUCCESS`. ### Related issues _No response_ ### Are you willing to submit a 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]
