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

Exceptions become a mess in logs using a Python 3.11 docker operator #33692

Closed
potiuk opened this issue Aug 24, 2023 Discussed in #33052 · 3 comments · Fixed by #43840
Closed

Exceptions become a mess in logs using a Python 3.11 docker operator #33692

potiuk opened this issue Aug 24, 2023 Discussed in #33052 · 3 comments · Fixed by #43840

Comments

@potiuk
Copy link
Member

potiuk commented Aug 24, 2023

Discussed in #33052

Originally posted by notatallshaw-gts August 2, 2023
We drive a lot of our scripts via the DockerOperator as we define our Python script environment separately from our Airflow environment.

Recently we upgraded our script environment to Python 3.11 and an issue has come up using the default Airflow log capturing, Python 3.11 introduced these nice arrows: https://realpython.com/python311-error-messages/#improvements-in-python-311

But they don't always stay on one line in the Airflow logs and can end up looking a bit of a mess, e.g. here is a snippet of part of an exception in one of our logs:

File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
^^^^
^^^^^^
^^^^^^^
^^^^^^^
^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^
^^^^^^^^^
^^^^^^

Has anyone else suffered this and fixed it? Or would someone be able to give some hints on maybe how to solve this.

Copy link

This issue has been automatically marked as stale because it has been open for 365 days without any activity. There has been several Airflow releases since last activity on this issue. Kindly asking to recheck the report against latest Airflow version and let us know if the issue is reproducible. The issue will be closed in next 30 days if no further activity occurs from the issue author.

@notatallshaw-gts
Copy link
Contributor

Still an issue, I just have yet not managed to prioritize raising a PR 🙁

@potiuk
Copy link
Member Author

potiuk commented Sep 3, 2024

Maybe someone can step up :) ?

mrk-andreev added a commit to mrk-andreev/airflow that referenced this issue Nov 9, 2024
mrk-andreev added a commit to mrk-andreev/airflow that referenced this issue Nov 9, 2024
mrk-andreev added a commit to mrk-andreev/airflow that referenced this issue Nov 9, 2024
mrk-andreev added a commit to mrk-andreev/airflow that referenced this issue Nov 9, 2024
Python 3.11’s multi-line error arrows don’t display correctly in Airflow’s DockerOperator logs due to leading spaces being removed, making error messages hard to read.

Before fix:
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^

After fix:
return self.main(*args, **kwargs)
       ^^^^^^^^^^^^^^^^

Fixes: apache#33692
@potiuk potiuk closed this as completed in 74bc872 Nov 9, 2024
ellisms pushed a commit to ellisms/airflow that referenced this issue Nov 13, 2024
…pache#43840)

Python 3.11’s multi-line error arrows don’t display correctly in Airflow’s DockerOperator logs due to leading spaces being removed, making error messages hard to read.

Before fix:
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^

After fix:
return self.main(*args, **kwargs)
       ^^^^^^^^^^^^^^^^

Fixes: apache#33692
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants