Tomi-1997 commented on issue #55146: URL: https://github.com/apache/airflow/issues/55146#issuecomment-4040674602
Hey, I think I achieved the effect you wanted with these changes - I set the dependent task to have a trigger rule to run if none tasks failed - The short circuit to respect downstream trigger rules Also, If the dependent task is a direct child, it will be skipped- so I added an empty task to bridge between them. This is my result: <img width="610" height="246" alt="Image" src="https://github.com/user-attachments/assets/c1452182-4755-408c-878b-474f2b69720c" /> Here's the changes, let me know what you think ``` from airflow import DAG from airflow.models import Param from airflow.providers.standard.operators.empty import EmptyOperator from airflow.providers.standard.operators.python import ShortCircuitOperator from airflow.providers.standard.operators.bash import BashOperator from airflow.sdk import get_current_context from airflow.utils.trigger_rule import TriggerRule def check_continue(): ctx = get_current_context() skip_downstream = ctx["params"]["skip"] return not skip_downstream with DAG( dag_id="test_airflow_skip", schedule=None, params={ "skip": Param(default=False, type="boolean"), }, ) as dag: depends_on_past = EmptyOperator( task_id="depends_on_past", depends_on_past=True, wait_for_past_depends_before_skipping=True, trigger_rule=TriggerRule.NONE_FAILED, ) bridge = EmptyOperator( task_id="bridge", ) skip = ShortCircuitOperator( task_id="skip", python_callable=check_continue, ignore_downstream_trigger_rules=False, ) skip >> bridge >> depends_on_past ``` -- 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]
