-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
"@task.virtualenv" cannot appear in a comment inside a @task.virtualenv
task
#34154
Comments
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. |
I was able to replicase on airflow/airflow/utils/decorators.py Lines 59 to 81 in 8279628
Since if the decorator name is included in the code, the result of the Knowing this, we can replicate the issue in other ways too - this task will also succeed: def test_virtualenv():
print('This line gets printed')
# @setup @setup
print('This line does not')
raise Exception("The task will succeed because this line won't run either") And I suspect other DAGs which subclass We probably shouldn't be doing string manipulation on code anyways, could we maybe use some sort of actual AST parsing for this? Anyways, I will keep investigating, feel free to assign to me |
Apache Airflow version
Other Airflow 2 version (please specify below)
What happened
On Airflow 2.5.1 (on AWS MWAA), I ran this DAG:
The
test
task runs and succeeds, but it only executes the code that precedes the line# @task.virtualenv
. Everything after that line is ignored.In general, as long as "@task.virtualenv" is in the comment, it will kill all lines after it. The comment could be
# we're inside an @task.virtualenv
or# [email protected]
, same effect. If the comment does not have exactly that string in it, e.g.# we're inside a task.virtualenv
(no "@") or# we're inside an @ task.virtualenv
then the lines after it get executed.What you think should happen instead
All of the code in the task should get executed. Here's a log dump for a run of that task:
How to reproduce
Described above
Operating System
Linux? it's AWS MWAA
Versions of Apache Airflow Providers
No response
Deployment
Amazon (AWS) MWAA
Deployment details
No response
Anything else
No response
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: