Giter VIP home page Giter VIP logo

Comments (8)

GrahamDumpleton avatar GrahamDumpleton commented on July 2, 2024

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.

ncoghlan avatar ncoghlan commented on July 2, 2024

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.

GrahamDumpleton avatar GrahamDumpleton commented on July 2, 2024

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.

GrahamDumpleton avatar GrahamDumpleton commented on July 2, 2024

Possibly could be because you are using Flask.

from s2i-python-container.

ncoghlan avatar ncoghlan commented on July 2, 2024

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.

ncoghlan avatar ncoghlan commented on July 2, 2024

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.

rhcarvalho avatar rhcarvalho commented on July 2, 2024

@GrahamDumpleton @sclorg/container-images this issue seems to be resolved already by #169.

from s2i-python-container.

torsava avatar torsava commented on July 2, 2024

Indeed, PYTHONUNBUFFERED is already being set thanks to #169. Closing the issue.

from s2i-python-container.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.