ominfra 0.0.0.dev121__py3-none-any.whl → 0.0.0.dev123__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- ominfra/deploy/_executor.py +10 -1
- ominfra/journald/messages.py +1 -1
- ominfra/pyremote/_runcommands.py +10 -1
- ominfra/scripts/journald2aws.py +10 -2
- ominfra/scripts/supervisor.py +2227 -2043
- ominfra/supervisor/context.py +16 -41
- ominfra/supervisor/dispatchers.py +88 -58
- ominfra/supervisor/events.py +59 -70
- ominfra/supervisor/groups.py +162 -0
- ominfra/supervisor/main.py +27 -11
- ominfra/supervisor/poller.py +51 -53
- ominfra/supervisor/process.py +267 -352
- ominfra/supervisor/signals.py +52 -0
- ominfra/supervisor/states.py +26 -47
- ominfra/supervisor/supervisor.py +105 -81
- ominfra/supervisor/types.py +57 -6
- ominfra/supervisor/{compat.py → utils.py} +34 -53
- {ominfra-0.0.0.dev121.dist-info → ominfra-0.0.0.dev123.dist-info}/METADATA +3 -3
- {ominfra-0.0.0.dev121.dist-info → ominfra-0.0.0.dev123.dist-info}/RECORD +23 -21
- {ominfra-0.0.0.dev121.dist-info → ominfra-0.0.0.dev123.dist-info}/LICENSE +0 -0
- {ominfra-0.0.0.dev121.dist-info → ominfra-0.0.0.dev123.dist-info}/WHEEL +0 -0
- {ominfra-0.0.0.dev121.dist-info → ominfra-0.0.0.dev123.dist-info}/entry_points.txt +0 -0
- {ominfra-0.0.0.dev121.dist-info → ominfra-0.0.0.dev123.dist-info}/top_level.txt +0 -0
@@ -1,16 +1,20 @@
|
|
1
1
|
# ruff: noqa: UP006 UP007
|
2
2
|
import errno
|
3
3
|
import os
|
4
|
-
import signal
|
5
4
|
import sys
|
6
5
|
import tempfile
|
7
6
|
import types
|
8
7
|
import typing as ta
|
9
8
|
|
9
|
+
from .signals import sig_name
|
10
|
+
|
10
11
|
|
11
12
|
T = ta.TypeVar('T')
|
12
13
|
|
13
14
|
|
15
|
+
##
|
16
|
+
|
17
|
+
|
14
18
|
def as_bytes(s: ta.Union[str, bytes], encoding: str = 'utf8') -> bytes:
|
15
19
|
if isinstance(s, bytes):
|
16
20
|
return s
|
@@ -18,13 +22,23 @@ def as_bytes(s: ta.Union[str, bytes], encoding: str = 'utf8') -> bytes:
|
|
18
22
|
return s.encode(encoding)
|
19
23
|
|
20
24
|
|
21
|
-
def as_string(s: ta.Union[str, bytes], encoding='utf8') -> str:
|
25
|
+
def as_string(s: ta.Union[str, bytes], encoding: str = 'utf8') -> str:
|
22
26
|
if isinstance(s, str):
|
23
27
|
return s
|
24
28
|
else:
|
25
29
|
return s.decode(encoding)
|
26
30
|
|
27
31
|
|
32
|
+
def find_prefix_at_end(haystack: bytes, needle: bytes) -> int:
|
33
|
+
l = len(needle) - 1
|
34
|
+
while l and not haystack.endswith(needle[:l]):
|
35
|
+
l -= 1
|
36
|
+
return l
|
37
|
+
|
38
|
+
|
39
|
+
##
|
40
|
+
|
41
|
+
|
28
42
|
def compact_traceback() -> ta.Tuple[
|
29
43
|
ta.Tuple[str, str, int],
|
30
44
|
ta.Type[BaseException],
|
@@ -52,17 +66,14 @@ def compact_traceback() -> ta.Tuple[
|
|
52
66
|
return (file, function, line), t, v, info # type: ignore
|
53
67
|
|
54
68
|
|
55
|
-
def find_prefix_at_end(haystack: bytes, needle: bytes) -> int:
|
56
|
-
l = len(needle) - 1
|
57
|
-
while l and not haystack.endswith(needle[:l]):
|
58
|
-
l -= 1
|
59
|
-
return l
|
60
|
-
|
61
|
-
|
62
69
|
class ExitNow(Exception): # noqa
|
63
70
|
pass
|
64
71
|
|
65
72
|
|
73
|
+
def real_exit(code: int) -> None:
|
74
|
+
os._exit(code) # noqa
|
75
|
+
|
76
|
+
|
66
77
|
##
|
67
78
|
|
68
79
|
|
@@ -80,7 +91,7 @@ def decode_wait_status(sts: int) -> ta.Tuple[int, str]:
|
|
80
91
|
return es, msg
|
81
92
|
elif os.WIFSIGNALED(sts):
|
82
93
|
sig = os.WTERMSIG(sts)
|
83
|
-
msg = f'terminated by {
|
94
|
+
msg = f'terminated by {sig_name(sig)}'
|
84
95
|
if hasattr(os, 'WCOREDUMP'):
|
85
96
|
iscore = os.WCOREDUMP(sts)
|
86
97
|
else:
|
@@ -93,49 +104,10 @@ def decode_wait_status(sts: int) -> ta.Tuple[int, str]:
|
|
93
104
|
return -1, msg
|
94
105
|
|
95
106
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
def signame(sig: int) -> str:
|
100
|
-
global _signames
|
101
|
-
if _signames is None:
|
102
|
-
_signames = _init_signames()
|
103
|
-
return _signames.get(sig) or 'signal %d' % sig
|
104
|
-
|
105
|
-
|
106
|
-
def _init_signames() -> ta.Dict[int, str]:
|
107
|
-
d = {}
|
108
|
-
for k, v in signal.__dict__.items():
|
109
|
-
k_startswith = getattr(k, 'startswith', None)
|
110
|
-
if k_startswith is None:
|
111
|
-
continue
|
112
|
-
if k_startswith('SIG') and not k_startswith('SIG_'):
|
113
|
-
d[v] = k
|
114
|
-
return d
|
115
|
-
|
116
|
-
|
117
|
-
class SignalReceiver:
|
118
|
-
def __init__(self) -> None:
|
119
|
-
super().__init__()
|
120
|
-
self._signals_recvd: ta.List[int] = []
|
121
|
-
|
122
|
-
def receive(self, sig: int, frame: ta.Any) -> None:
|
123
|
-
if sig not in self._signals_recvd:
|
124
|
-
self._signals_recvd.append(sig)
|
125
|
-
|
126
|
-
def install(self, *sigs: int) -> None:
|
127
|
-
for sig in sigs:
|
128
|
-
signal.signal(sig, self.receive)
|
129
|
-
|
130
|
-
def get_signal(self) -> ta.Optional[int]:
|
131
|
-
if self._signals_recvd:
|
132
|
-
sig = self._signals_recvd.pop(0)
|
133
|
-
else:
|
134
|
-
sig = None
|
135
|
-
return sig
|
107
|
+
##
|
136
108
|
|
137
109
|
|
138
|
-
def
|
110
|
+
def read_fd(fd: int) -> bytes:
|
139
111
|
try:
|
140
112
|
data = os.read(fd, 2 << 16) # 128K
|
141
113
|
except OSError as why:
|
@@ -180,8 +152,7 @@ def mktempfile(suffix: str, prefix: str, dir: str) -> str: # noqa
|
|
180
152
|
return filename
|
181
153
|
|
182
154
|
|
183
|
-
|
184
|
-
os._exit(code) # noqa
|
155
|
+
##
|
185
156
|
|
186
157
|
|
187
158
|
def get_path() -> ta.Sequence[str]:
|
@@ -199,6 +170,9 @@ def normalize_path(v: str) -> str:
|
|
199
170
|
return os.path.normpath(os.path.abspath(os.path.expanduser(v)))
|
200
171
|
|
201
172
|
|
173
|
+
##
|
174
|
+
|
175
|
+
|
202
176
|
ANSI_ESCAPE_BEGIN = b'\x1b['
|
203
177
|
ANSI_TERMINATORS = (b'H', b'f', b'A', b'B', b'C', b'D', b'R', b's', b'u', b'J', b'K', b'h', b'l', b'p', b'm')
|
204
178
|
|
@@ -223,3 +197,10 @@ def strip_escapes(s: bytes) -> bytes:
|
|
223
197
|
show = 0
|
224
198
|
i += 1
|
225
199
|
return result
|
200
|
+
|
201
|
+
|
202
|
+
##
|
203
|
+
|
204
|
+
|
205
|
+
def timeslice(period: int, when: float) -> int:
|
206
|
+
return int(when - (when % period))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ominfra
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev123
|
4
4
|
Summary: ominfra
|
5
5
|
Author: wrmsr
|
6
6
|
License: BSD-3-Clause
|
@@ -12,8 +12,8 @@ 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.
|
16
|
-
Requires-Dist: omlish ==0.0.0.
|
15
|
+
Requires-Dist: omdev ==0.0.0.dev123
|
16
|
+
Requires-Dist: omlish ==0.0.0.dev123
|
17
17
|
Provides-Extra: all
|
18
18
|
Requires-Dist: paramiko ~=3.5 ; extra == 'all'
|
19
19
|
Requires-Dist: asyncssh ~=2.18 ; extra == 'all'
|
@@ -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=
|
25
|
+
ominfra/deploy/_executor.py,sha256=q5XLH1nnj23QrM_5SFHqcBABfprfR7JpfBCsP4KixKw,34594
|
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
|
@@ -51,40 +51,42 @@ ominfra/deploy/poly/venv.py,sha256=BoipDEa4NTeodjf3L57KJfq9eGKLagFNKwD8pS4yrzA,1
|
|
51
51
|
ominfra/journald/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
52
52
|
ominfra/journald/fields.py,sha256=NjjVn7GW4jkcGdyiiizVjEfQqSFnolXYk3kDcSQcMmc,12278
|
53
53
|
ominfra/journald/genmessages.py,sha256=rLTS-K2v7otNOtTz4RoOEVYCm0fQuuBzf47e0T61tA8,1857
|
54
|
-
ominfra/journald/messages.py,sha256=
|
54
|
+
ominfra/journald/messages.py,sha256=Wr7TjWMOySc0WnKwp_-idR8RfeKlbyJQ_KkELr0VB70,2192
|
55
55
|
ominfra/journald/tailer.py,sha256=5abcFMfgi7fnY9ZEQe2ZVobaJxjQkeu6d9Kagw33a1w,33525
|
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=
|
59
|
+
ominfra/pyremote/_runcommands.py,sha256=zlNvob9gaUdwG2UJkra5sz0PpxJcQvaidah43ySKfys,28430
|
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=
|
64
|
-
ominfra/scripts/supervisor.py,sha256=
|
63
|
+
ominfra/scripts/journald2aws.py,sha256=1bP8b-k9Z-so4Yk0AY6GZkheknO2Wdtf3V_6Y3M2bbk,128480
|
64
|
+
ominfra/scripts/supervisor.py,sha256=2AcNVdw7e68TcNrl4R9XeFtJFr_x3mPxNsI0UFoBVB8,174176
|
65
65
|
ominfra/supervisor/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
|
66
66
|
ominfra/supervisor/__main__.py,sha256=I0yFw-C08OOiZ3BF6lF1Oiv789EQXu-_j6whDhQUTEA,66
|
67
|
-
ominfra/supervisor/compat.py,sha256=mutfnQbSCDaE7TSuQArOcFdfGVw4uEE_E04rIhs1IqU,5312
|
68
67
|
ominfra/supervisor/configs.py,sha256=TtVyWdxinrd3tueM6q8j2YVcEqauFTJqlbykkSjByEo,3524
|
69
|
-
ominfra/supervisor/context.py,sha256=
|
68
|
+
ominfra/supervisor/context.py,sha256=m0TWdMMG8VOHQg2CMLYIuX2HeR0zdEDjlLiBAH_kH5U,15294
|
70
69
|
ominfra/supervisor/datatypes.py,sha256=UnXO_UlCyJD9u0uvea1wvnk_UZCzxNMeFvPK83gv530,4432
|
71
|
-
ominfra/supervisor/dispatchers.py,sha256=
|
72
|
-
ominfra/supervisor/events.py,sha256=
|
70
|
+
ominfra/supervisor/dispatchers.py,sha256=rpcYYGb2CkCgmPMrxeN-jTxr-PZffZ1OA9lQr4FfV34,11011
|
71
|
+
ominfra/supervisor/events.py,sha256=01pet30KrzS4LszeKy0JUCMhMO8_OwuxvvDjfI_eGQQ,6593
|
73
72
|
ominfra/supervisor/exceptions.py,sha256=Qbu211H3CLlSmi9LsSikOwrcL5HgJP9ugvcKWlGTAoI,750
|
74
|
-
ominfra/supervisor/
|
75
|
-
ominfra/supervisor/
|
76
|
-
ominfra/supervisor/
|
77
|
-
ominfra/supervisor/
|
78
|
-
ominfra/supervisor/
|
79
|
-
ominfra/supervisor/
|
73
|
+
ominfra/supervisor/groups.py,sha256=VgFHgDwtCFumM8Qr5kbQ6e4xoau6tBQuW4lrKox_Z9o,4610
|
74
|
+
ominfra/supervisor/main.py,sha256=fxPKeJuPT-fqcGaADZct0HTd_Ovje03vEMovsL9wtCc,4570
|
75
|
+
ominfra/supervisor/poller.py,sha256=-gY_GIjuYr0J6ql_tFwKhlzRN4_mQaiVgMDOEHx_54Y,7693
|
76
|
+
ominfra/supervisor/process.py,sha256=dpVG7eX8q9nsIA0uH7KrJwdZGbhtw6ZAXWG8LsMpWnY,28306
|
77
|
+
ominfra/supervisor/signals.py,sha256=tv1CJm3Xrb69KVSswqm_u2vr2Lb2AbTxBVtQqIOSeyk,1176
|
78
|
+
ominfra/supervisor/states.py,sha256=9yoNOSwalRcKEnCP9zG6tVS0oivo5tCeuH6AaaW7Jpc,890
|
79
|
+
ominfra/supervisor/supervisor.py,sha256=7A4qVIaD6yf6nfcFU9NkKZTbZoxGXRK7pmq7cML6PMU,13105
|
80
|
+
ominfra/supervisor/types.py,sha256=GhBNQiB4oU-ruCoDZm10omUJB1fC0Tg3xYT_E_ta_Wk,2623
|
81
|
+
ominfra/supervisor/utils.py,sha256=jlUy5WaCIG7YqOLRoV_9aU5i26K0Cn7ID4_Mj-Y0Z2w,4368
|
80
82
|
ominfra/tailscale/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
81
83
|
ominfra/tailscale/api.py,sha256=C5-t_b6jZXUWcy5k8bXm7CFnk73pSdrlMOgGDeGVrpw,1370
|
82
84
|
ominfra/tailscale/cli.py,sha256=DSGp4hn5xwOW-l_u_InKlSF6kIobxtUtVssf_73STs0,3567
|
83
85
|
ominfra/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
84
86
|
ominfra/tools/listresources.py,sha256=4qVg5txsb10EHhvqXXeM6gJ2jx9LbroEnPydDv1uXs0,6176
|
85
|
-
ominfra-0.0.0.
|
86
|
-
ominfra-0.0.0.
|
87
|
-
ominfra-0.0.0.
|
88
|
-
ominfra-0.0.0.
|
89
|
-
ominfra-0.0.0.
|
90
|
-
ominfra-0.0.0.
|
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,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|