sovereign 1.0.0b122__py3-none-any.whl → 1.0.0b123.post2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of sovereign might be problematic. Click here for more details.
- sovereign/server.py +1 -1
- sovereign/worker.py +20 -2
- {sovereign-1.0.0b122.dist-info → sovereign-1.0.0b123.post2.dist-info}/METADATA +1 -1
- {sovereign-1.0.0b122.dist-info → sovereign-1.0.0b123.post2.dist-info}/RECORD +7 -7
- {sovereign-1.0.0b122.dist-info → sovereign-1.0.0b123.post2.dist-info}/LICENSE.txt +0 -0
- {sovereign-1.0.0b122.dist-info → sovereign-1.0.0b123.post2.dist-info}/WHEEL +0 -0
- {sovereign-1.0.0b122.dist-info → sovereign-1.0.0b123.post2.dist-info}/entry_points.txt +0 -0
sovereign/server.py
CHANGED
|
@@ -78,7 +78,7 @@ def write_supervisor_conf() -> Path:
|
|
|
78
78
|
conf["program:data"] = worker = {
|
|
79
79
|
**base,
|
|
80
80
|
"numprocs": "1",
|
|
81
|
-
"command": "nice -n
|
|
81
|
+
"command": "nice -n 2 sovereign-worker", # run worker with reduced CPU priority (higher niceness value)
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
if user := asgi_config.user:
|
sovereign/worker.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
+
import os
|
|
2
3
|
from typing import Optional
|
|
3
4
|
from multiprocessing import Process, cpu_count
|
|
4
5
|
from contextlib import asynccontextmanager
|
|
@@ -60,9 +61,26 @@ if config.sources is not None:
|
|
|
60
61
|
context_middleware.append(poller.add_to_context)
|
|
61
62
|
|
|
62
63
|
|
|
64
|
+
def _render_process_entry(job: rendering.RenderJob): # runs in child
|
|
65
|
+
"""Entry point for render subprocess; increase niceness so it is lower priority.
|
|
66
|
+
|
|
67
|
+
We deliberately raise the niceness (positive value) so these CPU bound template
|
|
68
|
+
renders cannot starve the worker's main event loop handling incoming requests.
|
|
69
|
+
"""
|
|
70
|
+
try:
|
|
71
|
+
try:
|
|
72
|
+
# Always lower scheduling priority by adding +2 niceness relative to parent
|
|
73
|
+
os.nice(2) # best-effort; ignored if insufficient privileges
|
|
74
|
+
except Exception:
|
|
75
|
+
pass
|
|
76
|
+
rendering.generate(job)
|
|
77
|
+
except Exception:
|
|
78
|
+
log.exception("Render process failed for %s", job.id)
|
|
79
|
+
|
|
80
|
+
|
|
63
81
|
def render(job: rendering.RenderJob):
|
|
64
|
-
log.debug(f"Spawning render process for {job.id}")
|
|
65
|
-
process = Process(target=
|
|
82
|
+
log.debug(f"Spawning render process for {job.id} with lowered priority")
|
|
83
|
+
process = Process(target=_render_process_entry, args=(job,), daemon=True)
|
|
66
84
|
process.start()
|
|
67
85
|
return process
|
|
68
86
|
|
|
@@ -18,7 +18,7 @@ sovereign/modifiers/lib.py,sha256=Cx0VrpTKbSjb3YmHyG4Jy6YEaPlrwpeqNaom3zu1_hw,28
|
|
|
18
18
|
sovereign/rendering.py,sha256=MIA7se7-C4WTWf7xZSgqpf7NvhDT7NkZbR3_G9N1dHI,5015
|
|
19
19
|
sovereign/response_class.py,sha256=beMAFV-4L6DwyWzJzy71GkEW4gb7fzH1jd8-Tul13cU,427
|
|
20
20
|
sovereign/schemas.py,sha256=Jf_w2mAX1b31eCAtJuxSZgy9KMVRKntmnEbbCZGZCxQ,38067
|
|
21
|
-
sovereign/server.py,sha256=
|
|
21
|
+
sovereign/server.py,sha256=uviXN0mX-Wbhv36xjWlHiybzIlZrJsCwRf4xyRnibXQ,2970
|
|
22
22
|
sovereign/sources/__init__.py,sha256=g9hEpFk8j5i1ApHQpbc9giTyJW41Ppgsqv5P9zGxOJk,78
|
|
23
23
|
sovereign/sources/file.py,sha256=prUThsDCSPNwZaZpkKXhAm-GVRZWbBoGKGU0It4HHXs,690
|
|
24
24
|
sovereign/sources/inline.py,sha256=pP77m7bHjqE3sSoqZthcuw1ARVMf9gooVwbz4B8OAek,1003
|
|
@@ -59,9 +59,9 @@ sovereign/views/crypto.py,sha256=7y0eHWtt-bbr2CwHEkH7odPaJ1IEviU-71U-MYJD0Kc,336
|
|
|
59
59
|
sovereign/views/discovery.py,sha256=B_D1ckfbN1dSKBvuFCTyfB79GUUriCADTB53OwZ8D4Q,2409
|
|
60
60
|
sovereign/views/healthchecks.py,sha256=TaXbxkX679jyQ8v5FxtBa2Qa0Z7KuqQ10WgAqfuVGUc,1743
|
|
61
61
|
sovereign/views/interface.py,sha256=FmQ7LiUPLSvkEDOKCncrnKMD9g1lJKu-DQNbbyi8mqk,6346
|
|
62
|
-
sovereign/worker.py,sha256=
|
|
63
|
-
sovereign-1.0.
|
|
64
|
-
sovereign-1.0.
|
|
65
|
-
sovereign-1.0.
|
|
66
|
-
sovereign-1.0.
|
|
67
|
-
sovereign-1.0.
|
|
62
|
+
sovereign/worker.py,sha256=JyDD6Ei0qfUZvBDG_d0pwftjO8lnOecnt1-VZihWCy4,5955
|
|
63
|
+
sovereign-1.0.0b123.post2.dist-info/LICENSE.txt,sha256=2X125zvAb9AYLjCgdMDQZuufhm0kwcg31A8pGKj_-VY,560
|
|
64
|
+
sovereign-1.0.0b123.post2.dist-info/METADATA,sha256=xOrKDrcRoa-og210CfD5xqxESzxEbY20u-Ig9X-Byfw,6310
|
|
65
|
+
sovereign-1.0.0b123.post2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
66
|
+
sovereign-1.0.0b123.post2.dist-info/entry_points.txt,sha256=VKJdnnN_HNL8xYQMXsFXfFmN6QkdXMEk5S964avxQJI,1404
|
|
67
|
+
sovereign-1.0.0b123.post2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|