Fix: Prevent AttributeError crash in prek when run inside container#57497
Fix: Prevent AttributeError crash in prek when run inside container#57497jscheffl merged 13 commits intoapache:mainfrom
Conversation
…e failing Revert virtualenv connections/variables access and logging as tests are failing in https://github.com/apache/airflow/actions/runs/18896380254. The issue here is that it's a socket initialisation error that occurs when CommsDecoder tries to create a socket from stdin (file descriptor 0) in subprocess environments where stdin is not a socket. This reverts commit fb8b590 (PR apache#57213) which allowed virtualenv code to access connections/variables and send logs via supervisor comms reinitialization.
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
|
You should still print something using built-in |
potiuk
left a comment
There was a problem hiding this comment.
NICE! Thanks for the investigation and fix !
With the caveat that the comment from @uranusjr will be addressed. In this case indeed the problem is that ich is not importable, but print should work |
jscheffl
left a comment
There was a problem hiding this comment.
Cool! Thanks for the fix!
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
… container (#57497) * Revert virtualenv connections/variables access and logging as test are failing Revert virtualenv connections/variables access and logging as tests are failing in https://github.com/apache/airflow/actions/runs/18896380254. The issue here is that it's a socket initialisation error that occurs when CommsDecoder tries to create a socket from stdin (file descriptor 0) in subprocess environments where stdin is not a socket. This reverts commit fb8b590 (PR #57213) which allowed virtualenv code to access connections/variables and send logs via supervisor comms reinitialization. * Address review: Use built-in print as fallback --------- (cherry picked from commit 5002660) Co-authored-by: Gurram Sai Ganesh <gurramsaiganesh93@gmail.com> Co-authored-by: Ankit Chaurasia <8670962+sunank200@users.noreply.github.com>
… container (#57497) (#57649) * Revert virtualenv connections/variables access and logging as test are failing Revert virtualenv connections/variables access and logging as tests are failing in https://github.com/apache/airflow/actions/runs/18896380254. The issue here is that it's a socket initialisation error that occurs when CommsDecoder tries to create a socket from stdin (file descriptor 0) in subprocess environments where stdin is not a socket. This reverts commit fb8b590 (PR #57213) which allowed virtualenv code to access connections/variables and send logs via supervisor comms reinitialization. * Address review: Use built-in print as fallback --------- (cherry picked from commit 5002660) Co-authored-by: Gurram Sai Ganesh <gurramsaiganesh93@gmail.com> Co-authored-by: Ankit Chaurasia <8670962+sunank200@users.noreply.github.com>
… container (#57497) (#57649) * Revert virtualenv connections/variables access and logging as test are failing Revert virtualenv connections/variables access and logging as tests are failing in https://github.com/apache/airflow/actions/runs/18896380254. The issue here is that it's a socket initialisation error that occurs when CommsDecoder tries to create a socket from stdin (file descriptor 0) in subprocess environments where stdin is not a socket. This reverts commit fb8b590 (PR #57213) which allowed virtualenv code to access connections/variables and send logs via supervisor comms reinitialization. * Address review: Use built-in print as fallback --------- (cherry picked from commit 5002660) Co-authored-by: Gurram Sai Ganesh <gurramsaiganesh93@gmail.com> Co-authored-by: Ankit Chaurasia <8670962+sunank200@users.noreply.github.com>
… container (#57497) (#57649) * Revert virtualenv connections/variables access and logging as test are failing Revert virtualenv connections/variables access and logging as tests are failing in https://github.com/apache/airflow/actions/runs/18896380254. The issue here is that it's a socket initialisation error that occurs when CommsDecoder tries to create a socket from stdin (file descriptor 0) in subprocess environments where stdin is not a socket. This reverts commit fb8b590 (PR #57213) which allowed virtualenv code to access connections/variables and send logs via supervisor comms reinitialization. * Address review: Use built-in print as fallback --------- (cherry picked from commit 5002660) Co-authored-by: Gurram Sai Ganesh <gurramsaiganesh93@gmail.com> Co-authored-by: Ankit Chaurasia <8670962+sunank200@users.noreply.github.com>
…pache#57497) * Revert virtualenv connections/variables access and logging as test are failing Revert virtualenv connections/variables access and logging as tests are failing in https://github.com/apache/airflow/actions/runs/18896380254. The issue here is that it's a socket initialisation error that occurs when CommsDecoder tries to create a socket from stdin (file descriptor 0) in subprocess environments where stdin is not a socket. This reverts commit fb8b590 (PR apache#57213) which allowed virtualenv code to access connections/variables and send logs via supervisor comms reinitialization. * Address review: Use built-in print as fallback --------- Co-authored-by: Ankit Chaurasia <8670962+sunank200@users.noreply.github.com>
This PR fixes an
AttributeError: 'NoneType' object has no attribute 'print'that occurs when runningprekinside the Breeze shell.The
consoleobject isNonein a non-TTY environment, and this PR addsif console:checks to prevent the script from crashing whenconsole.print()is called.This fixes the bug I found in the #new-contributors Slack.