Skip to content

Commit 1a503bf

Browse files
committed
feat: added patch gunicorn
1 parent 941dd4f commit 1a503bf

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Changelog
22

33
This file documents any relevant changes.
4+
## [0.9.6] - 2023-09-15
5+
- fix: updated grpcio to support python 3.11
6+
- fix: gunicorn will be patched on start up
7+
8+
49
## [0.9.5] - 2023-09-14
510
- fix: updated werkzeug and gunicorn
611

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ install_requires =
2323
pyyaml==6.0
2424
gunicorn==21.2.0
2525
fs==2.4.16
26-
grpcio==1.44.0
26+
grpcio==1.58.0
2727

2828
[options.packages.find]
2929
where = src

src/app_server/__init__.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515

16-
__version__ = "0.9.5"
16+
__version__ = "0.9.6"
1717

1818
subprocesses = []
1919

@@ -253,6 +253,21 @@ def envVars(application_id, args):
253253
if args.tasks:
254254
os.environ["TASKS_EMULATOR"] = f"{args.host}:{args.tasks_port}"
255255

256+
def patch_gunicorn():
257+
import gunicorn.workers.base
258+
with open(gunicorn.workers.base.__file__, 'r+') as file:
259+
content = file.read()
260+
261+
if "except (SyntaxError, NameError) as e:" in content:
262+
return 0
263+
264+
file.seek(0)
265+
file.write(content.replace(
266+
' except SyntaxError as e:',
267+
' except (SyntaxError, NameError) as e:'
268+
))
269+
270+
256271
def start_gunicorn(args, appYaml, appFolder, myFolder):
257272
# Gunicorn call command
258273
entrypoint = appYaml.get("entrypoint", "gunicorn -b :$PORT -w $WORKER --threads $THREADS "
@@ -307,7 +322,7 @@ def main():
307322

308323
args = ap.parse_args()
309324
envVars(args.app_id, args)
310-
325+
patch_gunicorn()
311326
myFolder = os.getcwd()
312327
appFolder = os.path.abspath(args.config_paths[0])
313328

0 commit comments

Comments
 (0)