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

@task.bash warn only if multiple_outputs=True #37875

Merged

Conversation

Taragolis
Copy link
Contributor

Some small side effect with warnings after #37297.
@task.bash constantly warns even if multiple_outputs doesn't set

In addition change stack level to show in which file this decorator use

stacklevel=1

/opt/airflow/airflow/models/baseoperator.py:445 UserWarning: `multiple_outputs=True` is not supported in @task.bash tasks. Ignoring.

stacklevel=3

/files/dags/sample_bash.py:14 UserWarning: `multiple_outputs=True` is not supported in @task.bash tasks. Ignoring.

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

Copy link
Member

@hussein-awala hussein-awala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@Taragolis
Copy link
Contributor Author

Good catch!

I've thinking maybe it is also a good idea to explicit provide into the super().__init__(..., multiple_outputs=False)

airflow/decorators/bash.py Outdated Show resolved Hide resolved
@Taragolis Taragolis merged commit ff40c06 into apache:main Mar 5, 2024
59 checks passed
@Taragolis Taragolis deleted the bash-decorator-multiple-outputs-true branch March 5, 2024 08:20
@utkarsharma2 utkarsharma2 added the type:bug-fix Changelog: Bug Fixes label Mar 6, 2024
@utkarsharma2 utkarsharma2 added this to the Airflow 2.8.3 milestone Mar 6, 2024
utkarsharma2 pushed a commit to astronomer/airflow that referenced this pull request Apr 22, 2024
* `@task.bash` warn only if `multiple_outputs=True`

* Update airflow/decorators/bash.py

Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>

* Add explicit multiple_outputs=False

* Add explicit UserWarning category

---------

Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants