Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Common tasks in downstream of multiple branches always set to skipped #7885

Closed
CodingJonas opened this issue Mar 26, 2020 · 4 comments
Closed
Labels
kind:bug This is a clearly a bug

Comments

@CodingJonas
Copy link
Contributor

Apache Airflow version: 1.10.9

Environment:

  • OS: Ubuntu 18.04
  • Kernel:
Linux DELL-5540-01 4.15.0-1076-oem #86-Ubuntu SMP Wed Mar 4 05:40:20 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

What happened:

Two branches join into the same task at one point of their downstream. This joint task and all following ones will set to be skipped due to one of the two branches being skipped.

What you expected to happen:

No matter which branch is chosen, the joint downstream should never be skipped, since at least one of the branches will end up into this joint downstream.

How to reproduce it:
I followed the code of this issue (AIRFLOW-3823) since it was, as I understood it, exactly about my issue. It works as described in the issue, but choosing the other branch will cause the rest of the DAG to be skipped.

import airflow
from airflow.models import DAG
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.python_operator import BranchPythonOperator
args = {"owner": "airflow", "start_date": airflow.utils.dates.days_ago(14)}
dag = DAG(
 dag_id="branch_test",
 default_args=args,
 schedule_interval="0 0 * * *",
)
branch = BranchPythonOperator(task_id="branch", python_callable=lambda: "t4", dag=dag)
t1 = DummyOperator(task_id="t1", dag=dag)
t2 = DummyOperator(task_id="t2", dag=dag)
t3 = DummyOperator(task_id="t3", dag=dag)
t4 = DummyOperator(task_id="t4", dag=dag)
t5 = DummyOperator(task_id="t5", dag=dag)
branch >> t1 >> t2 >> t3 >> t4
branch >> t4
t4 >> t5

screenshot

You can include images using the .md sytle of
alt text

@CodingJonas CodingJonas added the kind:bug This is a clearly a bug label Mar 26, 2020
@boring-cyborg
Copy link

boring-cyborg bot commented Mar 26, 2020

Thanks for opening your first issue here! Be sure to follow the issue template!

@madison-ookla
Copy link
Contributor

madison-ookla commented Mar 26, 2020

This is expected behavior, and is actually listed explicitly as a possible scenario in the docs: https://airflow.apache.org/docs/stable/concepts.html?highlight=branch#trigger-rules

This can be resolved by setting the trigger_rule of t4 to none_failed.

@CodingJonas
Copy link
Contributor Author

Thanks for the quick reply. Changing the trigger worked, but seems quite unintuitive to me in the first place. But that's on me. Have to learn more about this framework :)

@madison-ookla
Copy link
Contributor

Thanks for the quick reply. Changing the trigger worked, but seems quite unintuitive to me in the first place. But that's on me. Have to learn more about this framework :)

Read those docs! Hopefully they'll help too :) Best of luck 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug This is a clearly a bug
Projects
None yet
Development

No branches or pull requests

2 participants