ominfra 0.0.0.dev123__py3-none-any.whl → 0.0.0.dev124__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.
@@ -0,0 +1,28 @@
1
+ Supervisor is licensed under the following license:
2
+
3
+ A copyright notice accompanies this license document that identifies the copyright holders.
4
+
5
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
6
+ following conditions are met:
7
+
8
+ 1. Redistributions in source code must retain the accompanying copyright notice, this list of conditions, and the
9
+ following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the accompanying copyright notice, this list of conditions, and the
12
+ following disclaimer in the documentation and/or other materials provided with the distribution.
13
+
14
+ 3. Names of the copyright holders must not be used to endorse or promote products derived from this software without
15
+ prior written permission from the copyright holders.
16
+
17
+ 4. If any files are modified, you must cause the modified files to carry prominent notices stating that you changed
18
+ the files and the date of any change.
19
+
20
+ Disclaimer
21
+
22
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
23
+ NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
24
+ EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,81 @@
1
+ # ruff: noqa: UP006 UP007
2
+ import functools
3
+ import typing as ta
4
+
5
+ from omlish.lite.inject import Injector
6
+ from omlish.lite.inject import InjectorBindingOrBindings
7
+ from omlish.lite.inject import InjectorBindings
8
+ from omlish.lite.inject import inj
9
+
10
+ from .configs import ProcessConfig
11
+ from .configs import ProcessGroupConfig
12
+ from .configs import ServerConfig
13
+ from .context import ServerContext
14
+ from .context import ServerEpoch
15
+ from .events import EventCallbacks
16
+ from .groups import ProcessGroup
17
+ from .groups import SubprocessFactory
18
+ from .poller import Poller
19
+ from .poller import get_poller_impl
20
+ from .process import InheritedFds
21
+ from .process import Subprocess
22
+ from .signals import SignalReceiver
23
+ from .supervisor import ProcessGroupFactory
24
+ from .supervisor import ProcessGroups
25
+ from .supervisor import SignalHandler
26
+ from .supervisor import Supervisor
27
+ from .types import AbstractProcessGroup
28
+ from .types import AbstractServerContext
29
+ from .types import AbstractSubprocess
30
+
31
+
32
+ ##
33
+
34
+
35
+ def bind_server(
36
+ config: ServerConfig,
37
+ *,
38
+ server_epoch: ta.Optional[ServerEpoch] = None,
39
+ inherited_fds: ta.Optional[InheritedFds] = None,
40
+ ) -> InjectorBindings:
41
+ lst: ta.List[InjectorBindingOrBindings] = [
42
+ inj.bind(config),
43
+
44
+ inj.bind(get_poller_impl(), key=Poller, singleton=True),
45
+
46
+ inj.bind(ServerContext, singleton=True),
47
+ inj.bind(AbstractServerContext, to_key=ServerContext),
48
+
49
+ inj.bind(EventCallbacks, singleton=True),
50
+
51
+ inj.bind(SignalReceiver, singleton=True),
52
+
53
+ inj.bind(SignalHandler, singleton=True),
54
+ inj.bind(ProcessGroups, singleton=True),
55
+ inj.bind(Supervisor, singleton=True),
56
+ ]
57
+
58
+ #
59
+
60
+ def make_process_group_factory(injector: Injector) -> ProcessGroupFactory:
61
+ def inner(group_config: ProcessGroupConfig) -> ProcessGroup:
62
+ return injector.inject(functools.partial(ProcessGroup, group_config))
63
+ return ProcessGroupFactory(inner)
64
+ lst.append(inj.bind(make_process_group_factory))
65
+
66
+ def make_subprocess_factory(injector: Injector) -> SubprocessFactory:
67
+ def inner(process_config: ProcessConfig, group: AbstractProcessGroup) -> AbstractSubprocess:
68
+ return injector.inject(functools.partial(Subprocess, process_config, group))
69
+ return SubprocessFactory(inner)
70
+ lst.append(inj.bind(make_subprocess_factory))
71
+
72
+ #
73
+
74
+ if server_epoch is not None:
75
+ lst.append(inj.bind(server_epoch, key=ServerEpoch))
76
+ if inherited_fds is not None:
77
+ lst.append(inj.bind(inherited_fds, key=InheritedFds))
78
+
79
+ #
80
+
81
+ return inj.as_bindings(*lst)
@@ -1,41 +1,24 @@
1
1
  #!/usr/bin/env python3
2
2
  # ruff: noqa: UP006 UP007
3
3
  # @omlish-amalg ../scripts/supervisor.py
4
- import functools
5
4
  import itertools
6
5
  import os.path
7
6
  import typing as ta
8
7
 
9
- from omlish.lite.inject import Injector
10
- from omlish.lite.inject import InjectorBindingOrBindings
11
- from omlish.lite.inject import InjectorBindings
8
+ from omlish.lite.http.coroserver import CoroHttpServer
12
9
  from omlish.lite.inject import inj
13
10
  from omlish.lite.journald import journald_log_handler_factory
14
11
  from omlish.lite.logs import configure_standard_logging
15
12
 
16
13
  from ..configs import read_config_file
17
- from .configs import ProcessConfig
18
- from .configs import ProcessGroupConfig
19
14
  from .configs import ServerConfig
20
15
  from .configs import prepare_server_config
21
16
  from .context import ServerContext
22
17
  from .context import ServerEpoch
23
- from .events import EventCallbacks
24
- from .groups import ProcessGroup
25
- from .groups import SubprocessFactory
26
- from .poller import Poller
27
- from .poller import get_poller_impl
18
+ from .inject import bind_server
28
19
  from .process import InheritedFds
29
- from .process import Subprocess
30
- from .signals import SignalReceiver
31
20
  from .states import SupervisorState
32
- from .supervisor import ProcessGroupFactory
33
- from .supervisor import ProcessGroups
34
- from .supervisor import SignalHandler
35
21
  from .supervisor import Supervisor
36
- from .types import AbstractProcessGroup
37
- from .types import AbstractServerContext
38
- from .types import AbstractSubprocess
39
22
  from .utils import ExitNow
40
23
  from .utils import get_open_fds
41
24
 
@@ -43,63 +26,15 @@ from .utils import get_open_fds
43
26
  ##
44
27
 
45
28
 
46
- def build_server_bindings(
47
- config: ServerConfig,
48
- *,
49
- server_epoch: ta.Optional[ServerEpoch] = None,
50
- inherited_fds: ta.Optional[InheritedFds] = None,
51
- ) -> InjectorBindings:
52
- lst: ta.List[InjectorBindingOrBindings] = [
53
- inj.bind(config),
54
-
55
- inj.bind(get_poller_impl(), key=Poller, singleton=True),
56
-
57
- inj.bind(ServerContext, singleton=True),
58
- inj.bind(AbstractServerContext, to_key=ServerContext),
59
-
60
- inj.bind(EventCallbacks, singleton=True),
61
-
62
- inj.bind(SignalReceiver, singleton=True),
63
-
64
- inj.bind(SignalHandler, singleton=True),
65
- inj.bind(ProcessGroups, singleton=True),
66
- inj.bind(Supervisor, singleton=True),
67
- ]
68
-
69
- #
70
-
71
- def make_process_group_factory(injector: Injector) -> ProcessGroupFactory:
72
- def inner(group_config: ProcessGroupConfig) -> ProcessGroup:
73
- return injector.inject(functools.partial(ProcessGroup, group_config))
74
- return ProcessGroupFactory(inner)
75
- lst.append(inj.bind(make_process_group_factory))
76
-
77
- def make_subprocess_factory(injector: Injector) -> SubprocessFactory:
78
- def inner(process_config: ProcessConfig, group: AbstractProcessGroup) -> AbstractSubprocess:
79
- return injector.inject(functools.partial(Subprocess, process_config, group))
80
- return SubprocessFactory(inner)
81
- lst.append(inj.bind(make_subprocess_factory))
82
-
83
- #
84
-
85
- if server_epoch is not None:
86
- lst.append(inj.bind(server_epoch, key=ServerEpoch))
87
- if inherited_fds is not None:
88
- lst.append(inj.bind(inherited_fds, key=InheritedFds))
89
-
90
- #
91
-
92
- return inj.as_bindings(*lst)
93
-
94
-
95
- ##
96
-
97
-
98
29
  def main(
99
30
  argv: ta.Optional[ta.Sequence[str]] = None,
100
31
  *,
101
32
  no_logging: bool = False,
102
33
  ) -> None:
34
+ server_cls = CoroHttpServer # noqa
35
+
36
+ #
37
+
103
38
  import argparse
104
39
 
105
40
  parser = argparse.ArgumentParser()
@@ -133,14 +68,14 @@ def main(
133
68
  prepare=prepare_server_config,
134
69
  )
135
70
 
136
- injector = inj.create_injector(build_server_bindings(
71
+ injector = inj.create_injector(bind_server(
137
72
  config,
138
73
  server_epoch=ServerEpoch(epoch),
139
74
  inherited_fds=inherited_fds,
140
75
  ))
141
76
 
142
- context = injector.provide(ServerContext)
143
- supervisor = injector.provide(Supervisor)
77
+ context = injector[ServerContext]
78
+ supervisor = injector[Supervisor]
144
79
 
145
80
  try:
146
81
  supervisor.main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ominfra
3
- Version: 0.0.0.dev123
3
+ Version: 0.0.0.dev124
4
4
  Summary: ominfra
5
5
  Author: wrmsr
6
6
  License: BSD-3-Clause
@@ -12,12 +12,11 @@ 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: omdev ==0.0.0.dev123
16
- Requires-Dist: omlish ==0.0.0.dev123
15
+ Requires-Dist: omdev==0.0.0.dev124
16
+ Requires-Dist: omlish==0.0.0.dev124
17
17
  Provides-Extra: all
18
- Requires-Dist: paramiko ~=3.5 ; extra == 'all'
19
- Requires-Dist: asyncssh ~=2.18 ; extra == 'all'
18
+ Requires-Dist: paramiko~=3.5; extra == "all"
19
+ Requires-Dist: asyncssh~=2.18; extra == "all"
20
20
  Provides-Extra: ssh
21
- Requires-Dist: paramiko ~=3.5 ; extra == 'ssh'
22
- Requires-Dist: asyncssh ~=2.18 ; extra == 'ssh'
23
-
21
+ Requires-Dist: paramiko~=3.5; extra == "ssh"
22
+ Requires-Dist: asyncssh~=2.18; extra == "ssh"
@@ -22,7 +22,7 @@ ominfra/clouds/aws/journald2aws/poster.py,sha256=hz1XuctW8GtLmfjhRvCFY6py52D4BzX
22
22
  ominfra/clouds/gcp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  ominfra/clouds/gcp/auth.py,sha256=3PyfRJNgajjMqJFem3SKui0CqGeHEsZlvbRhuxFcZG8,1348
24
24
  ominfra/deploy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
- ominfra/deploy/_executor.py,sha256=q5XLH1nnj23QrM_5SFHqcBABfprfR7JpfBCsP4KixKw,34594
25
+ ominfra/deploy/_executor.py,sha256=AZ6F7zcVMQRKZwOxfFTfsrj1IA42bIrZF22jiDLapoE,34654
26
26
  ominfra/deploy/configs.py,sha256=qi0kwT7G2NH7dXLOQic-u6R3yeadup_QtvrjwWIggbM,435
27
27
  ominfra/deploy/remote.py,sha256=6ACmpXU1uBdyGs3Xsp97ktKFq30cJlzN9LRWNUWlGY4,2144
28
28
  ominfra/deploy/executor/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
@@ -37,7 +37,7 @@ ominfra/deploy/executor/concerns/systemd.py,sha256=MtsSEToEa1HNouern_JukcYTnypw_
37
37
  ominfra/deploy/executor/concerns/user.py,sha256=j5LDfQXquIp-eEM7t6aShsrYoQrM_ILXZycTmTcRVxA,686
38
38
  ominfra/deploy/executor/concerns/venv.py,sha256=jbRriqJHO4r9Zyo5Hfl_qVmcU6Qm6UgrouBroKcPn2g,775
39
39
  ominfra/deploy/poly/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
40
- ominfra/deploy/poly/_main.py,sha256=N-ajqT7UPdacBbFViTyzDkbM8y2kyH4lzGKsV4lN7uo,24198
40
+ ominfra/deploy/poly/_main.py,sha256=1I6fQY-_iUk4FmT1fQviSRQReuy4VCHQKGLenda1F_g,24176
41
41
  ominfra/deploy/poly/base.py,sha256=Bd-CzUTaDvTRbdXKiTxMxs77WCEXItwNoBYCRnTk1u4,4167
42
42
  ominfra/deploy/poly/configs.py,sha256=9bzWdbxhOk_Q4KokDjmRz254KHnUU71Vl1frLlhQyU4,584
43
43
  ominfra/deploy/poly/deploy.py,sha256=tMYKslXLjstcv86siRt5j37USsS0Wd6lsfeGRE26zio,544
@@ -56,12 +56,13 @@ ominfra/journald/tailer.py,sha256=5abcFMfgi7fnY9ZEQe2ZVobaJxjQkeu6d9Kagw33a1w,33
56
56
  ominfra/manage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
57
  ominfra/manage/manage.py,sha256=BttL8LFEknHZE_h2Pt5dAqbfUkv6qy43WI0raXBZ1a8,151
58
58
  ominfra/pyremote/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
- ominfra/pyremote/_runcommands.py,sha256=zlNvob9gaUdwG2UJkra5sz0PpxJcQvaidah43ySKfys,28430
59
+ ominfra/pyremote/_runcommands.py,sha256=EDTp6NOgux8ZJw-tcIHtfafc-fHLh5KuhghA3Xemhy8,28490
60
60
  ominfra/pyremote/bootstrap.py,sha256=RvMO3YGaN1E4sgUi1JEtiPak8cjvqtc_vRCq1yqbeZg,3370
61
61
  ominfra/pyremote/runcommands.py,sha256=bviS0_TDIoZVAe4h-_iavbvJtVSFu8lnk7fQ5iasCWE,1571
62
62
  ominfra/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
- ominfra/scripts/journald2aws.py,sha256=1bP8b-k9Z-so4Yk0AY6GZkheknO2Wdtf3V_6Y3M2bbk,128480
64
- ominfra/scripts/supervisor.py,sha256=2AcNVdw7e68TcNrl4R9XeFtJFr_x3mPxNsI0UFoBVB8,174176
63
+ ominfra/scripts/journald2aws.py,sha256=veQDwe0RQ3EYLW5jSsNJCUOx6RTLb_7FXUN7fBSgWUc,128540
64
+ ominfra/scripts/supervisor.py,sha256=eapWDO0oWjj_nAggu7LhzI3GgbmgjxD5HtSDRl20AgE,206584
65
+ ominfra/supervisor/LICENSE.txt,sha256=JRTq7xHjDCpDPCeo0OfCYymSm9Vwl7n7rQWg342NpxI,1780
65
66
  ominfra/supervisor/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
66
67
  ominfra/supervisor/__main__.py,sha256=I0yFw-C08OOiZ3BF6lF1Oiv789EQXu-_j6whDhQUTEA,66
67
68
  ominfra/supervisor/configs.py,sha256=TtVyWdxinrd3tueM6q8j2YVcEqauFTJqlbykkSjByEo,3524
@@ -71,7 +72,8 @@ ominfra/supervisor/dispatchers.py,sha256=rpcYYGb2CkCgmPMrxeN-jTxr-PZffZ1OA9lQr4F
71
72
  ominfra/supervisor/events.py,sha256=01pet30KrzS4LszeKy0JUCMhMO8_OwuxvvDjfI_eGQQ,6593
72
73
  ominfra/supervisor/exceptions.py,sha256=Qbu211H3CLlSmi9LsSikOwrcL5HgJP9ugvcKWlGTAoI,750
73
74
  ominfra/supervisor/groups.py,sha256=VgFHgDwtCFumM8Qr5kbQ6e4xoau6tBQuW4lrKox_Z9o,4610
74
- ominfra/supervisor/main.py,sha256=fxPKeJuPT-fqcGaADZct0HTd_Ovje03vEMovsL9wtCc,4570
75
+ ominfra/supervisor/inject.py,sha256=srRErrQkxytLSKUedN4HFoFF5Eb4f_TEw1eu0aKlHMU,2599
76
+ ominfra/supervisor/main.py,sha256=gd9tBBg46sJInxCk_OCkRFkAaQ3qhLKfjZeRXvU2LNY,2324
75
77
  ominfra/supervisor/poller.py,sha256=-gY_GIjuYr0J6ql_tFwKhlzRN4_mQaiVgMDOEHx_54Y,7693
76
78
  ominfra/supervisor/process.py,sha256=dpVG7eX8q9nsIA0uH7KrJwdZGbhtw6ZAXWG8LsMpWnY,28306
77
79
  ominfra/supervisor/signals.py,sha256=tv1CJm3Xrb69KVSswqm_u2vr2Lb2AbTxBVtQqIOSeyk,1176
@@ -84,9 +86,9 @@ ominfra/tailscale/api.py,sha256=C5-t_b6jZXUWcy5k8bXm7CFnk73pSdrlMOgGDeGVrpw,1370
84
86
  ominfra/tailscale/cli.py,sha256=DSGp4hn5xwOW-l_u_InKlSF6kIobxtUtVssf_73STs0,3567
85
87
  ominfra/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
86
88
  ominfra/tools/listresources.py,sha256=4qVg5txsb10EHhvqXXeM6gJ2jx9LbroEnPydDv1uXs0,6176
87
- ominfra-0.0.0.dev123.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
88
- ominfra-0.0.0.dev123.dist-info/METADATA,sha256=0WOejBCOaFJ0T1GfM0nHTQ2EgEu8qWIdPjJsxLBMATA,742
89
- ominfra-0.0.0.dev123.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
90
- ominfra-0.0.0.dev123.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
91
- ominfra-0.0.0.dev123.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
92
- ominfra-0.0.0.dev123.dist-info/RECORD,,
89
+ ominfra-0.0.0.dev124.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
90
+ ominfra-0.0.0.dev124.dist-info/METADATA,sha256=D1ueiVHDML8TevQC4EPHfEyeKZK_bfl2JY_lPoLxMkQ,731
91
+ ominfra-0.0.0.dev124.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
92
+ ominfra-0.0.0.dev124.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
93
+ ominfra-0.0.0.dev124.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
94
+ ominfra-0.0.0.dev124.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.5.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5