Skip to content

Commit

Permalink
Disable Python buffering of standard output/error streams.
Browse files Browse the repository at this point in the history
The code uses `print` to log messages, so disable buffering to output the messages as soon as they are written.

Fixes Netflix#437.
  • Loading branch information
fumoboy007 committed Sep 9, 2024
1 parent d24ee48 commit c812b4d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,9 @@ RUN /root/services/ui_backend_service/download_ui.sh
ADD services/migration_service /root/services/migration_service
RUN pip3 install -r /root/services/migration_service/requirements.txt

# The program uses `print` to log messages, so disable buffering to output the messages as soon as
# they are written.
ENV PYTHONUNBUFFERED=1

RUN chmod 777 /root/services/migration_service/run_script.py
CMD python3 services/migration_service/run_script.py
7 changes: 6 additions & 1 deletion Dockerfile.metadata_service
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ ADD services/metadata_service /root/services/metadata_service
ADD setup.py setup.cfg /root/
WORKDIR /root
RUN pip install --editable .
CMD metadata_service

# The program uses `print` to log messages, so disable buffering to output the messages as soon as
# they are written.
ENV PYTHONUNBUFFERED=1

CMD metadata_service
7 changes: 6 additions & 1 deletion Dockerfile.migration_service
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@ ADD services/migration_service /root/services/migration_service
ADD setup.py setup.cfg run_goose.py /root/
WORKDIR /root
RUN pip install --editable .
CMD migration_service

# The program uses `print` to log messages, so disable buffering to output the messages as soon as
# they are written.
ENV PYTHONUNBUFFERED=1

CMD migration_service
4 changes: 4 additions & 0 deletions Dockerfile.ui_service
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@ RUN /root/services/ui_backend_service/download_ui.sh

RUN pip install --editable .

# The program uses `print` to log messages, so disable buffering to output the messages as soon as
# they are written.
ENV PYTHONUNBUFFERED=1

CMD ui_backend_service

0 comments on commit c812b4d

Please sign in to comment.