You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "mistercrunch (via GitHub)" <gi...@apache.org> on 2025/01/09 01:04:10 UTC
[PR] feat: allowing print() statements to be unbuffered in docker [superset]
mistercrunch opened a new pull request, #31760:
URL: https://github.com/apache/superset/pull/31760
I finally looked into something that's been bugging me for a while:
python print() statements not showing up in docker logs. Digging a bit,
turns out in non-interactive mode (aka docker environment), the print
statements are buffered, meaning they don't show up in logs until the
program exits. From what I read this is a legacy behavior around the
concern that printing is more expensive than writing to file. Anyhow,
created confusion for me trying to debug with prints in the past, I
would print, and to see the output I'd have to save a file, which - in
our dev environments - triggers flask to restart, and flush the buffer,
meaning prints aren't in-line with logger.info statements. Anyhow,
I learned to use logger instead of prints while debugging for that reason.
Another byproduct of that is buffer growth, which can explain at least a
bit of memory leak in our environments. Everything you print stays
in-memory until the interpreted exits - minimal, but could see potential
issues with that. In any case solution is as simple as setting
PYTHONUNBUFFERED=1 in our docker containers to solve. Seems like a no
brainer.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: allowing print() statements to be unbuffered in docker [superset]
Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch merged PR #31760:
URL: https://github.com/apache/superset/pull/31760
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org