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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
