You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "SamWheating (via GitHub)" <gi...@apache.org> on 2023/09/15 18:00:44 UTC
[GitHub] [airflow] SamWheating commented on issue #34154: "@task.virtualenv" cannot appear in a comment inside a `@task.virtualenv` task
SamWheating commented on issue #34154:
URL: https://github.com/apache/airflow/issues/34154#issuecomment-1721651606
I was able to replicase on `main`... this is a really funny bug and appears to stem from this section of code:
https://github.com/apache/airflow/blob/827962878e6fb39e014639d83cff7d0881595ecb/airflow/utils/decorators.py#L59-L81
Since if the decorator name is included in the code, the result of the `split` operation will be more than 2 items, and anything after the second use of the decorator will be ignored.
Knowing this, we can replicate the issue in other ways too - this task will also succeed:
```python
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")
```
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
--
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