Comments (8)
Note that it would be possible to undo this as the default by a user setting in the .s2i/environment
file:
PYTHONUNBUFFERED=
That is, in the Dockerfile
use:
ENV PYTHONUNBUFFERED=1
A user can undo it by setting the same environment variable, but to an empty string, thus overriding the default. This works as the Python interpreter code is:
if (!saw_unbuffered_flag &&
(p = Py_GETENV("PYTHONUNBUFFERED")) && *p != '\0')
Py_UnbufferedStdioFlag = 1;
so only enables unbuffered stdio
if the environment variable is non empty.
from s2i-python-container.
For https://github.com/ncoghlan/srpminfo I'm seeing the problem where no logging output from the Python workers appears in the OpenShift console window, but setting PYTHONUNBUFFERED=1
in the S2I environment didn't appear to make any difference.
from s2i-python-container.
Try using oc logs
on pod. I have sometimes seen web console not showing logging. In your case the problem may be using gunicorn. It screws around with the stdout/stderr and can stuff things up. Maybe the case that default gunicorn options are suppressing it.
from s2i-python-container.
Possibly could be because you are using Flask.
from s2i-python-container.
I checked with ncoghlan/srpminfo@82fa7cc (using explicit print
calls to bypass the logging subsystem entirely) and it looks like the S2I image is configured to unconditionally throw away all console output from the WSGI process by default.
from s2i-python-container.
Oops, @GrahamDumpleton pointed out that the code inside the __main__
guard will never be called under gunicorn, so all my testing so far has been entirely invalid. Sorry for the noise :(
from s2i-python-container.
@GrahamDumpleton @sclorg/container-images this issue seems to be resolved already by #169.
from s2i-python-container.
Indeed, PYTHONUNBUFFERED
is already being set thanks to #169. Closing the issue.
from s2i-python-container.
Related Issues (20)
- Poetry backed project is not installed HOT 8
- Streamlit Update HOT 1
- No Action Required !! Testing automation workflow HOT 1
- No Action Required !! Testing automation workflow HOT 4
- Remove verification of installed packages HOT 3
- 3.9 Readme Instructions unclear HOT 6
- Python 3.10 RHEL image missing in RHEL Container catalog? HOT 4
- Unable to build a Python image from scratch on MacOS HOT 1
- Python 3.9+ for Centos 7 docker images HOT 4
- tests: test case should fail early when the prepare function fails HOT 3
- Distgen errors HOT 11
- Incorrect py-3 image HOT 11
- Support gunicorn >=20.1.0 defaults (do not require APP_ environment variables) HOT 1
- Add RHEL images for Python 3.11 HOT 4
- ERROR: No matching distribution found for numpy==1.19.2 HOT 4
- Use PIP_INDEX_URL with pipenv HOT 1
- ubi9/python-311:latest is using python3.9-rpm HOT 2
- Publish arm64 images HOT 8
- rh-python38 failed on `'npm-virtualenv-uwsgi-test-app' run_s2i_build` & `'pin-pipenv-version-test-app' run_s2i_build` HOT 2
- python311-devel not found by microdnf in python 3.11 minimal EL8 and C9s variants HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from s2i-python-container.