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

BranchPythonOperator.execute cannot be called outside TaskInstance! #47511

Open
1 of 2 tasks
tomplus opened this issue Mar 7, 2025 · 3 comments
Open
1 of 2 tasks

BranchPythonOperator.execute cannot be called outside TaskInstance! #47511

tomplus opened this issue Mar 7, 2025 · 3 comments
Labels
area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet

Comments

@tomplus
Copy link

tomplus commented Mar 7, 2025

Apache Airflow version

2.10.5

If "Other Airflow 2 version" selected, which one?

No response

What happened?

For some reason BranchPythonOperator reports warning:

[2025-03-07, 18:13:18 UTC] {local_task_job_runner.py:123} ▶ Pre task execution logs
[2025-03-07, 18:13:19 UTC] {baseoperator.py:424} WARNING - BranchPythonOperator.execute cannot be called outside TaskInstance!
[2025-03-07, 18:13:19 UTC] {python.py:240} INFO - Done. Returned value was: branch_b
[2025-03-07, 18:13:19 UTC] {branch.py:38} INFO - Branch into branch_b
[2025-03-07, 18:13:19 UTC] {skipmixin.py:233} INFO - Following branch ('branch_b',)
[2025-03-07, 18:13:19 UTC] {skipmixin.py:281} INFO - Skipping tasks [('branch_c', -1), ('branch_d', -1), ('branch_a', -1)]
[2025-03-07, 18:13:19 UTC] {taskinstance.py:341} ▶ Post task execution logs

it's from example_branch_operator.

What you think should happen instead?

No response

How to reproduce

Run example 'example_branch_operator'.

Operating System

Ubuntu 22

Versions of Apache Airflow Providers

It's a fresh installation (pip install airflow)

Deployment

Virtualenv installation

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@tomplus tomplus added area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet labels Mar 7, 2025
Copy link

boring-cyborg bot commented Mar 7, 2025

Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

@insomnes
Copy link
Contributor

insomnes commented Mar 9, 2025

There was similar issue, where it was mentioned that it's not fixed yet:

#45498 (comment)

I've also seen the same behaviour on current main branch with TriggerDagRunOpertator

@insomnes
Copy link
Contributor

I think I was able to reproduce reliably, identify, and fix this bug in:

#47552

But the code behind all of this is tricky so I am not 100% sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants