Skip to content

Commit 180b9ab

Browse files
authored
Add PULP_USE_UVLOOP envvar to activate uvloop in the content-app (#360)
1 parent 0239250 commit 180b9ab

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ RUN patch -p1 -d /usr/local/lib/pulp/lib/python${PYTHON_VERSION}/site-packages <
146146
COPY images/assets/patches/0019-Adds-LabelsMixin-to-ReadOnlyContentViewSet.patch /tmp/
147147
RUN patch -p1 -d /usr/local/lib/pulp/lib/python${PYTHON_VERSION}/site-packages < /tmp/0019-Adds-LabelsMixin-to-ReadOnlyContentViewSet.patch
148148

149+
COPY images/assets/patches/0020-Add-uvloop-as-the-the-Gunicorn-worker-eventloop.patch /tmp/
150+
RUN patch -p1 -d /usr/local/lib/pulp/lib/python${PYTHON_VERSION}/site-packages < /tmp/0020-Add-uvloop-as-the-the-Gunicorn-worker-eventloop.patch
151+
149152
RUN mkdir /licenses
150153
COPY LICENSE /licenses/LICENSE
151154

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
From c5eff869698b792044eeecafc23cea63da7160c3 Mon Sep 17 00:00:00 2001
2+
From: Pedro Brochado <[email protected]>
3+
Date: Thu, 14 Nov 2024 03:53:56 -0300
4+
Subject: [PATCH] Add uvloop as the the Gunicorn worker eventloop
5+
6+
---
7+
pulpcore/content/entrypoint.py | 6 +++++-
8+
1 file changed, 5 insertions(+), 1 deletion(-)
9+
10+
diff --git a/pulpcore/content/entrypoint.py b/pulpcore/content/entrypoint.py
11+
index 1179f782f..a654d977d 100644
12+
--- a/pulpcore/content/entrypoint.py
13+
+++ b/pulpcore/content/entrypoint.py
14+
@@ -1,11 +1,15 @@
15+
import click
16+
from pulpcore.app.pulpcore_gunicorn_application import PulpcoreGunicornApplication
17+
+import os
18+
19+
20+
class PulpcoreContentApplication(PulpcoreGunicornApplication):
21+
def load_app_specific_config(self):
22+
+ worker_class = "aiohttp.GunicornWebWorker"
23+
+ if os.getenv("PULP_USE_UVLOOP"):
24+
+ worker_class = "aiohttp.GunicornUVLoopWebWorker"
25+
self.set_option("default_proc_name", "pulpcore-content", enforced=True)
26+
- self.set_option("worker_class", "aiohttp.GunicornWebWorker", enforced=True)
27+
+ self.set_option("worker_class", worker_class, enforced=True)
28+
29+
def load(self):
30+
import pulpcore.content
31+
--
32+
2.48.1
33+

pulp_service/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ pulp-cli-gem
1010
sentry-sdk
1111
app-common-python
1212
oras==0.2.24
13+
uvloop==0.21.0

0 commit comments

Comments
 (0)