You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "matthewblock (via GitHub)" <gi...@apache.org> on 2025/04/04 23:37:45 UTC

[I] Allow tasks downstream of `setup` tasks to have `trigger_rule` other than `ALL_SUCCESS` [airflow]

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: commits-unsubscribe@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Allow tasks downstream of `setup` tasks to have `trigger_rule` other than `ALL_SUCCESS` [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on issue #48823:
URL: https://github.com/apache/airflow/issues/48823#issuecomment-2788567273

   Same issue as #48451 -> converting to a discussion. Setup and teardown are designed in the way that they MUST succed. If you want to do conditional behaviour of those, you have to implement "ifs" in your taskflow code that is used for setup/teardown and avoid doing any job, but still succeed. This is far simpler and straightforward and follows the - clearly documented semantics of setup/teardown tasks.
   
   The setup tasks mus be "green" (no matter what they do or don't do) in order to exacute whatever depends on setup. This is the basic assumption here.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Allow tasks downstream of `setup` tasks to have `trigger_rule` other than `ALL_SUCCESS` [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk closed issue #48823: Allow tasks downstream of `setup` tasks to have `trigger_rule` other than `ALL_SUCCESS`
URL: https://github.com/apache/airflow/issues/48823


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org