ominfra 0.0.0.dev129__py3-none-any.whl → 0.0.0.dev130__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 +15 -0
- ominfra/pyremote/_runcommands.py +15 -0
- ominfra/scripts/journald2aws.py +112 -0
- ominfra/scripts/supervisor.py +1233 -484
- ominfra/supervisor/dispatchers.py +7 -6
- ominfra/supervisor/dispatchersimpl.py +3 -7
- ominfra/supervisor/groups.py +16 -1
- ominfra/supervisor/http.py +130 -0
- ominfra/supervisor/inject.py +44 -5
- ominfra/supervisor/io.py +39 -24
- ominfra/supervisor/processimpl.py +3 -4
- ominfra/supervisor/spawningimpl.py +2 -2
- ominfra/supervisor/supervisor.py +5 -2
- ominfra/supervisor/types.py +6 -56
- {ominfra-0.0.0.dev129.dist-info → ominfra-0.0.0.dev130.dist-info}/METADATA +3 -3
- {ominfra-0.0.0.dev129.dist-info → ominfra-0.0.0.dev130.dist-info}/RECORD +20 -20
- ominfra/supervisor/poller.py +0 -240
- {ominfra-0.0.0.dev129.dist-info → ominfra-0.0.0.dev130.dist-info}/LICENSE +0 -0
- {ominfra-0.0.0.dev129.dist-info → ominfra-0.0.0.dev130.dist-info}/WHEEL +0 -0
- {ominfra-0.0.0.dev129.dist-info → ominfra-0.0.0.dev130.dist-info}/entry_points.txt +0 -0
- {ominfra-0.0.0.dev129.dist-info → ominfra-0.0.0.dev130.dist-info}/top_level.txt +0 -0
ominfra/deploy/_executor.py
CHANGED
@@ -85,6 +85,9 @@ if sys.version_info < (3, 8):
|
|
85
85
|
# ../../../../omlish/lite/cached.py
|
86
86
|
T = ta.TypeVar('T')
|
87
87
|
|
88
|
+
# ../../../../omlish/lite/check.py
|
89
|
+
SizedT = ta.TypeVar('SizedT', bound=ta.Sized)
|
90
|
+
|
88
91
|
|
89
92
|
########################################
|
90
93
|
# ../../configs.py
|
@@ -218,6 +221,18 @@ def check_single(vs: ta.Iterable[T]) -> T:
|
|
218
221
|
return v
|
219
222
|
|
220
223
|
|
224
|
+
def check_empty(v: SizedT) -> SizedT:
|
225
|
+
if len(v):
|
226
|
+
raise ValueError(v)
|
227
|
+
return v
|
228
|
+
|
229
|
+
|
230
|
+
def check_non_empty(v: SizedT) -> SizedT:
|
231
|
+
if not len(v):
|
232
|
+
raise ValueError(v)
|
233
|
+
return v
|
234
|
+
|
235
|
+
|
221
236
|
########################################
|
222
237
|
# ../../../../omlish/lite/json.py
|
223
238
|
|
ominfra/pyremote/_runcommands.py
CHANGED
@@ -44,6 +44,9 @@ if sys.version_info < (3, 8):
|
|
44
44
|
# ../../../omlish/lite/cached.py
|
45
45
|
T = ta.TypeVar('T')
|
46
46
|
|
47
|
+
# ../../../omlish/lite/check.py
|
48
|
+
SizedT = ta.TypeVar('SizedT', bound=ta.Sized)
|
49
|
+
|
47
50
|
|
48
51
|
########################################
|
49
52
|
# ../bootstrap.py
|
@@ -301,6 +304,18 @@ def check_single(vs: ta.Iterable[T]) -> T:
|
|
301
304
|
return v
|
302
305
|
|
303
306
|
|
307
|
+
def check_empty(v: SizedT) -> SizedT:
|
308
|
+
if len(v):
|
309
|
+
raise ValueError(v)
|
310
|
+
return v
|
311
|
+
|
312
|
+
|
313
|
+
def check_non_empty(v: SizedT) -> SizedT:
|
314
|
+
if not len(v):
|
315
|
+
raise ValueError(v)
|
316
|
+
return v
|
317
|
+
|
318
|
+
|
304
319
|
########################################
|
305
320
|
# ../../../omlish/lite/json.py
|
306
321
|
|
ominfra/scripts/journald2aws.py
CHANGED
@@ -59,6 +59,9 @@ TomlPos = int # ta.TypeAlias
|
|
59
59
|
# ../../../../../omlish/lite/cached.py
|
60
60
|
T = ta.TypeVar('T')
|
61
61
|
|
62
|
+
# ../../../../../omlish/lite/check.py
|
63
|
+
SizedT = ta.TypeVar('SizedT', bound=ta.Sized)
|
64
|
+
|
62
65
|
# ../../../../../omlish/lite/contextmanagers.py
|
63
66
|
ExitStackedT = ta.TypeVar('ExitStackedT', bound='ExitStacked')
|
64
67
|
|
@@ -997,6 +1000,18 @@ def check_single(vs: ta.Iterable[T]) -> T:
|
|
997
1000
|
return v
|
998
1001
|
|
999
1002
|
|
1003
|
+
def check_empty(v: SizedT) -> SizedT:
|
1004
|
+
if len(v):
|
1005
|
+
raise ValueError(v)
|
1006
|
+
return v
|
1007
|
+
|
1008
|
+
|
1009
|
+
def check_non_empty(v: SizedT) -> SizedT:
|
1010
|
+
if not len(v):
|
1011
|
+
raise ValueError(v)
|
1012
|
+
return v
|
1013
|
+
|
1014
|
+
|
1000
1015
|
########################################
|
1001
1016
|
# ../../../../../omlish/lite/json.py
|
1002
1017
|
|
@@ -1754,6 +1769,103 @@ class DelimitingBuffer:
|
|
1754
1769
|
i = p
|
1755
1770
|
|
1756
1771
|
|
1772
|
+
class ReadableListBuffer:
|
1773
|
+
def __init__(self) -> None:
|
1774
|
+
super().__init__()
|
1775
|
+
self._lst: list[bytes] = []
|
1776
|
+
|
1777
|
+
def feed(self, d: bytes) -> None:
|
1778
|
+
if d:
|
1779
|
+
self._lst.append(d)
|
1780
|
+
|
1781
|
+
def _chop(self, i: int, e: int) -> bytes:
|
1782
|
+
lst = self._lst
|
1783
|
+
d = lst[i]
|
1784
|
+
|
1785
|
+
o = b''.join([
|
1786
|
+
*lst[:i],
|
1787
|
+
d[:e],
|
1788
|
+
])
|
1789
|
+
|
1790
|
+
self._lst = [
|
1791
|
+
*([d[e:]] if e < len(d) else []),
|
1792
|
+
*lst[i + 1:],
|
1793
|
+
]
|
1794
|
+
|
1795
|
+
return o
|
1796
|
+
|
1797
|
+
def read(self, n: ta.Optional[int] = None) -> ta.Optional[bytes]:
|
1798
|
+
if n is None:
|
1799
|
+
o = b''.join(self._lst)
|
1800
|
+
self._lst = []
|
1801
|
+
return o
|
1802
|
+
|
1803
|
+
if not (lst := self._lst):
|
1804
|
+
return None
|
1805
|
+
|
1806
|
+
c = 0
|
1807
|
+
for i, d in enumerate(lst):
|
1808
|
+
r = n - c
|
1809
|
+
if (l := len(d)) >= r:
|
1810
|
+
return self._chop(i, r)
|
1811
|
+
c += l
|
1812
|
+
|
1813
|
+
return None
|
1814
|
+
|
1815
|
+
def read_until(self, delim: bytes = b'\n') -> ta.Optional[bytes]:
|
1816
|
+
if not (lst := self._lst):
|
1817
|
+
return None
|
1818
|
+
|
1819
|
+
for i, d in enumerate(lst):
|
1820
|
+
if (p := d.find(delim)) >= 0:
|
1821
|
+
return self._chop(i, p + len(delim))
|
1822
|
+
|
1823
|
+
return None
|
1824
|
+
|
1825
|
+
|
1826
|
+
class IncrementalWriteBuffer:
|
1827
|
+
def __init__(
|
1828
|
+
self,
|
1829
|
+
data: bytes,
|
1830
|
+
*,
|
1831
|
+
write_size: int = 0x10000,
|
1832
|
+
) -> None:
|
1833
|
+
super().__init__()
|
1834
|
+
|
1835
|
+
check_non_empty(data)
|
1836
|
+
self._len = len(data)
|
1837
|
+
self._write_size = write_size
|
1838
|
+
|
1839
|
+
self._lst = [
|
1840
|
+
data[i:i + write_size]
|
1841
|
+
for i in range(0, len(data), write_size)
|
1842
|
+
]
|
1843
|
+
self._pos = 0
|
1844
|
+
|
1845
|
+
@property
|
1846
|
+
def rem(self) -> int:
|
1847
|
+
return self._len - self._pos
|
1848
|
+
|
1849
|
+
def write(self, fn: ta.Callable[[bytes], int]) -> int:
|
1850
|
+
lst = check_non_empty(self._lst)
|
1851
|
+
|
1852
|
+
t = 0
|
1853
|
+
for i, d in enumerate(lst): # noqa
|
1854
|
+
n = fn(check_non_empty(d))
|
1855
|
+
if not n:
|
1856
|
+
break
|
1857
|
+
t += n
|
1858
|
+
|
1859
|
+
if t:
|
1860
|
+
self._lst = [
|
1861
|
+
*([d[n:]] if n < len(d) else []),
|
1862
|
+
*lst[i + 1:],
|
1863
|
+
]
|
1864
|
+
self._pos += t
|
1865
|
+
|
1866
|
+
return t
|
1867
|
+
|
1868
|
+
|
1757
1869
|
########################################
|
1758
1870
|
# ../../../../../omlish/lite/logs.py
|
1759
1871
|
"""
|