omserv 0.0.0.dev30__tar.gz → 0.0.0.dev32__tar.gz
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.
- {omserv-0.0.0.dev30/omserv.egg-info → omserv-0.0.0.dev32}/PKG-INFO +2 -2
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/nginx/build.py +2 -2
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/__init__.py +1 -1
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/multiprocess.py +11 -11
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32/omserv.egg-info}/PKG-INFO +2 -2
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv.egg-info/SOURCES.txt +0 -2
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv.egg-info/requires.txt +1 -1
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/pyproject.toml +2 -2
- omserv-0.0.0.dev30/omserv/dbs.py +0 -24
- omserv-0.0.0.dev30/omserv/secrets.py +0 -12
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/LICENSE +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/MANIFEST.in +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/README.rst +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/.manifests.json +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/__about__.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/__init__.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/apps/__init__.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/apps/base.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/apps/inject.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/apps/markers.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/apps/routes.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/apps/sessions.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/apps/templates.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/nginx/__init__.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/nginx/configs.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/nginx/patches/__init__.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/nginx/patches/nginx-1.27.1_http_status.patch +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/nginx/stubstatus.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/node/__init__.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/node/models.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/node/registry.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/node/sql.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/LICENSE +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/config.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/debug.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/events.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/headers.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/lifespans.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/protocols/__init__.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/protocols/h11.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/protocols/h2.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/protocols/protocols.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/protocols/types.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/resources/__init__.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/resources/favicon.ico +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/sockets.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/ssl.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/streams/__init__.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/streams/httpstream.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/streams/utils.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/streams/wsstream.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/taskspawner.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/tcpserver.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/types.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/workercontext.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/server/workers.py +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv.egg-info/dependency_links.txt +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv.egg-info/top_level.txt +0 -0
- {omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: omserv
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev32
|
4
4
|
Summary: omserv
|
5
5
|
Author: wrmsr
|
6
6
|
License: BSD-3-Clause
|
@@ -12,7 +12,7 @@ Classifier: Operating System :: OS Independent
|
|
12
12
|
Classifier: Operating System :: POSIX
|
13
13
|
Requires-Python: ~=3.12
|
14
14
|
License-File: LICENSE
|
15
|
-
Requires-Dist: omlish==0.0.0.
|
15
|
+
Requires-Dist: omlish==0.0.0.dev32
|
16
16
|
Provides-Extra: all
|
17
17
|
Requires-Dist: h11~=0.14; extra == "all"
|
18
18
|
Requires-Dist: h2~=4.1; extra == "all"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import multiprocessing
|
1
|
+
import multiprocessing as mp
|
2
2
|
import os.path
|
3
3
|
import shutil
|
4
4
|
import subprocess
|
@@ -102,7 +102,7 @@ def build_nginx() -> None:
|
|
102
102
|
|
103
103
|
#
|
104
104
|
|
105
|
-
make_jobs = max(
|
105
|
+
make_jobs = max(mp.cpu_count() // 2, 1)
|
106
106
|
subprocess.check_call([
|
107
107
|
'make',
|
108
108
|
f'-j{make_jobs}',
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import functools
|
2
|
-
import multiprocessing
|
2
|
+
import multiprocessing as mp
|
3
3
|
import multiprocessing.connection
|
4
4
|
import multiprocessing.context
|
5
5
|
import multiprocessing.synchronize
|
@@ -20,7 +20,7 @@ from .workers import serve
|
|
20
20
|
|
21
21
|
|
22
22
|
async def check_multiprocess_shutdown_event(
|
23
|
-
shutdown_event:
|
23
|
+
shutdown_event: mp.synchronize.Event,
|
24
24
|
sleep: ta.Callable[[float], ta.Awaitable[ta.Any]],
|
25
25
|
) -> None:
|
26
26
|
while True:
|
@@ -33,7 +33,7 @@ def _multiprocess_serve(
|
|
33
33
|
app: AsgiFramework,
|
34
34
|
config: Config,
|
35
35
|
sockets: Sockets | None = None,
|
36
|
-
shutdown_event:
|
36
|
+
shutdown_event: mp.synchronize.Event | None = None,
|
37
37
|
) -> None:
|
38
38
|
if sockets is not None:
|
39
39
|
for sock in sockets.insecure_sockets:
|
@@ -62,7 +62,7 @@ def serve_multiprocess(
|
|
62
62
|
sockets = create_sockets(config)
|
63
63
|
|
64
64
|
exitcode = 0
|
65
|
-
ctx =
|
65
|
+
ctx = mp.get_context('spawn')
|
66
66
|
|
67
67
|
active = True
|
68
68
|
shutdown_event = ctx.Event()
|
@@ -72,7 +72,7 @@ def serve_multiprocess(
|
|
72
72
|
shutdown_event.set()
|
73
73
|
active = False
|
74
74
|
|
75
|
-
processes: list[
|
75
|
+
processes: list[mp.Process] = []
|
76
76
|
while active:
|
77
77
|
# Ignore SIGINT before creating the processes, so that they inherit the signal handling. This means that the
|
78
78
|
# shutdown function controls the shutdown.
|
@@ -92,7 +92,7 @@ def serve_multiprocess(
|
|
92
92
|
if hasattr(signal, signal_name):
|
93
93
|
signal.signal(getattr(signal, signal_name), shutdown)
|
94
94
|
|
95
|
-
|
95
|
+
mp.connection.wait(process.sentinel for process in processes)
|
96
96
|
|
97
97
|
exitcode = _join_exited(processes)
|
98
98
|
if exitcode != 0:
|
@@ -111,17 +111,17 @@ def serve_multiprocess(
|
|
111
111
|
|
112
112
|
|
113
113
|
def _populate(
|
114
|
-
processes: list[
|
114
|
+
processes: list[mp.Process],
|
115
115
|
app: AsgiFramework,
|
116
116
|
config: Config,
|
117
117
|
worker_func: ta.Callable,
|
118
118
|
sockets: Sockets,
|
119
|
-
shutdown_event:
|
120
|
-
ctx:
|
119
|
+
shutdown_event: mp.synchronize.Event,
|
120
|
+
ctx: mp.context.BaseContext,
|
121
121
|
) -> None:
|
122
122
|
num_workers = config.workers or 1
|
123
123
|
if num_workers < 0:
|
124
|
-
num_workers =
|
124
|
+
num_workers = mp.cpu_count()
|
125
125
|
for _ in range(num_workers - len(processes)):
|
126
126
|
process = ctx.Process( # type: ignore
|
127
127
|
target=worker_func,
|
@@ -145,7 +145,7 @@ def _populate(
|
|
145
145
|
time.sleep(0.1)
|
146
146
|
|
147
147
|
|
148
|
-
def _join_exited(processes: list[
|
148
|
+
def _join_exited(processes: list[mp.Process]) -> int:
|
149
149
|
exitcode = 0
|
150
150
|
for index in reversed(range(len(processes))):
|
151
151
|
worker = processes[index]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: omserv
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev32
|
4
4
|
Summary: omserv
|
5
5
|
Author: wrmsr
|
6
6
|
License: BSD-3-Clause
|
@@ -12,7 +12,7 @@ Classifier: Operating System :: OS Independent
|
|
12
12
|
Classifier: Operating System :: POSIX
|
13
13
|
Requires-Python: ~=3.12
|
14
14
|
License-File: LICENSE
|
15
|
-
Requires-Dist: omlish==0.0.0.
|
15
|
+
Requires-Dist: omlish==0.0.0.dev32
|
16
16
|
Provides-Extra: all
|
17
17
|
Requires-Dist: h11~=0.14; extra == "all"
|
18
18
|
Requires-Dist: h2~=4.1; extra == "all"
|
@@ -12,7 +12,7 @@ authors = [
|
|
12
12
|
urls = {source = 'https://github.com/wrmsr/omlish'}
|
13
13
|
license = {text = 'BSD-3-Clause'}
|
14
14
|
requires-python = '~=3.12'
|
15
|
-
version = '0.0.0.
|
15
|
+
version = '0.0.0.dev32'
|
16
16
|
classifiers = [
|
17
17
|
'License :: OSI Approved :: BSD License',
|
18
18
|
'Development Status :: 2 - Pre-Alpha',
|
@@ -22,7 +22,7 @@ classifiers = [
|
|
22
22
|
]
|
23
23
|
description = 'omserv'
|
24
24
|
dependencies = [
|
25
|
-
'omlish == 0.0.0.
|
25
|
+
'omlish == 0.0.0.dev32',
|
26
26
|
]
|
27
27
|
|
28
28
|
[project.optional-dependencies]
|
omserv-0.0.0.dev30/omserv/dbs.py
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
|
3
|
-
from .secrets import load_secrets # noqa
|
4
|
-
|
5
|
-
|
6
|
-
def get_secret_db_url() -> str:
|
7
|
-
cfg = load_secrets()
|
8
|
-
return f'postgresql+asyncpg://{cfg["postgres_user"]}:{cfg["postgres_pass"]}@{cfg["postgres_host"]}:5432'
|
9
|
-
|
10
|
-
|
11
|
-
def get_docker_db_url() -> str:
|
12
|
-
from omlish import docker
|
13
|
-
cc = docker.ComposeConfig('omlish-', file_path='docker/compose.yml')
|
14
|
-
svc = cc.get_services()['postgres']
|
15
|
-
port = docker.get_compose_port(svc, 5432)
|
16
|
-
env = svc['environment']
|
17
|
-
return f'postgresql+asyncpg://{env["POSTGRES_USER"]}:{env["POSTGRES_PASSWORD"]}@127.0.0.1:{port}'
|
18
|
-
|
19
|
-
|
20
|
-
def get_db_url() -> str:
|
21
|
-
if os.environ.get('PROD', '').lower() in ('1', 'true'): # FIXME: lol
|
22
|
-
return get_secret_db_url()
|
23
|
-
else:
|
24
|
-
return get_docker_db_url()
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import os.path
|
2
|
-
import typing as ta
|
3
|
-
|
4
|
-
import yaml
|
5
|
-
|
6
|
-
|
7
|
-
SECRETS_PATH = os.getenv('SECRETS_PATH', os.path.expanduser('~/Dropbox/.dotfiles/secrets.yml'))
|
8
|
-
|
9
|
-
|
10
|
-
def load_secrets() -> dict[str, ta.Any]:
|
11
|
-
with open(SECRETS_PATH) as f:
|
12
|
-
return yaml.safe_load(f)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{omserv-0.0.0.dev30 → omserv-0.0.0.dev32}/omserv/nginx/patches/nginx-1.27.1_http_status.patch
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|