File tree Expand file tree Collapse file tree 12 files changed +21
-22
lines changed
Expand file tree Collapse file tree 12 files changed +21
-22
lines changed Original file line number Diff line number Diff line change 1818# https://hub.docker.com/_/python
1919FROM python:3.8
2020
21+ # Allow statements and log messages to immediately appear in the Cloud Run logs
22+ ENV PYTHONUNBUFFERED True
23+
2124# Copy application dependency manifests to the container image.
2225# Copying this separately prevents re-running pip install on every code change.
2326COPY requirements.txt ./
Original file line number Diff line number Diff line change 1515# [START run_broken_service]
1616import json
1717import os
18- import sys
1918
2019from flask import Flask
2120
@@ -35,9 +34,6 @@ def index():
3534 raise Exception ("Missing required service parameter." )
3635 # [END run_broken_service_problem]
3736
38- # Flush the stdout to avoid log buffering.
39- sys .stdout .flush ()
40-
4137 return f"Hello { NAME } "
4238# [END run_broken_service]
4339
@@ -58,9 +54,6 @@ def improved():
5854 print (json .dumps (error_message ))
5955 # [END run_broken_service_upgrade]
6056
61- # Flush the stdout to avoid log buffering.
62- sys .stdout .flush ()
63-
6457 return f"Hello { NAME } "
6558
6659
Original file line number Diff line number Diff line change 1616# https://hub.docker.com/_/python
1717FROM python:3.8
1818
19+ # Allow statements and log messages to immediately appear in the Cloud Run logs
20+ ENV PYTHONUNBUFFERED True
21+
1922# Copy application dependency manifests to the container image.
2023# Copying this separately prevents re-running pip install on every code change.
2124COPY requirements.txt ./
Original file line number Diff line number Diff line change 1616import base64
1717import json
1818import os
19- import sys
2019
2120from flask import Flask , request
2221
@@ -62,8 +61,6 @@ def index():
6261
6362 try :
6463 image .blur_offensive_images (data )
65- # Flush the stdout to avoid log buffering.
66- sys .stdout .flush ()
6764 return ('' , 204 )
6865
6966 except Exception as e :
Original file line number Diff line number Diff line change 1616# https://hub.docker.com/_/python
1717FROM python:3.8
1818
19+ # Allow statements and log messages to immediately appear in the Cloud Run logs
20+ ENV PYTHONUNBUFFERED True
21+
1922# Copy application dependency manifests to the container image.
2023# Copying this separately prevents re-running pip install on every code change.
2124COPY requirements.txt ./
Original file line number Diff line number Diff line change 1414
1515import json
1616import os
17- import sys
1817
1918from flask import Flask , request
2019
@@ -52,9 +51,6 @@ def index():
5251 print (json .dumps (entry ))
5352 # [END run_manual_logging]
5453
55- # Flush the stdout to avoid log buffering.
56- sys .stdout .flush ()
57-
5854 return 'Hello Logger!'
5955
6056
Original file line number Diff line number Diff line change 1616# https://hub.docker.com/_/python
1717FROM python:3.8-slim
1818
19+ # Allow statements and log messages to immediately appear in the Cloud Run logs
20+ ENV PYTHONUNBUFFERED True
21+
1922# Copy application dependency manifests to the container image.
2023# Copying this separately prevents re-running pip install on every code change.
2124COPY requirements.txt ./
Original file line number Diff line number Diff line change 1616# https://hub.docker.com/_/python
1717FROM python:3.8-slim
1818
19+ # Allow statements and log messages to immediately appear in the Cloud Run logs
20+ ENV PYTHONUNBUFFERED True
21+
1922# Copy application dependency manifests to the container image.
2023# Copying this separately prevents re-running pip install on every code change.
2124COPY requirements.txt ./
Original file line number Diff line number Diff line change 1818# https://hub.docker.com/_/python
1919FROM python:3.8
2020
21+ # Allow statements and log messages to immediately appear in the Cloud Run logs
22+ ENV PYTHONUNBUFFERED True
23+
2124# Copy application dependency manifests to the container image.
2225# Copying this separately prevents re-running pip install on every code change.
2326COPY requirements.txt ./
Original file line number Diff line number Diff line change 1515# [START run_pubsub_server_setup]
1616import base64
1717import os
18- import sys
1918
2019from flask import Flask , request
2120
@@ -46,9 +45,6 @@ def index():
4645
4746 print (f'Hello { name } !' )
4847
49- # Flush the stdout to avoid log buffering.
50- sys .stdout .flush ()
51-
5248 return ('' , 204 )
5349# [END run_pubsub_handler]
5450
You can’t perform that action at this time.
0 commit comments