ominfra 0.0.0.dev90__py3-none-any.whl → 0.0.0.dev91__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- ominfra/clouds/aws/journald2aws/main.py +36 -19
- ominfra/clouds/aws/logs.py +2 -2
- ominfra/journald/__init__.py +0 -0
- ominfra/{clouds/aws/journald2aws/journald → journald}/messages.py +27 -15
- ominfra/journald/tailer.py +453 -0
- ominfra/scripts/journald2aws.py +548 -147
- ominfra/{clouds/aws/journald2aws/threadworker.py → threadworker.py} +6 -3
- {ominfra-0.0.0.dev90.dist-info → ominfra-0.0.0.dev91.dist-info}/METADATA +4 -4
- {ominfra-0.0.0.dev90.dist-info → ominfra-0.0.0.dev91.dist-info}/RECORD +14 -14
- ominfra/clouds/aws/journald2aws/journald/__init__.py +0 -1
- ominfra/clouds/aws/journald2aws/journald/tailer.py +0 -108
- /ominfra/{clouds/aws/journald2aws/journald → journald}/genmessages.py +0 -0
- {ominfra-0.0.0.dev90.dist-info → ominfra-0.0.0.dev91.dist-info}/LICENSE +0 -0
- {ominfra-0.0.0.dev90.dist-info → ominfra-0.0.0.dev91.dist-info}/WHEEL +0 -0
- {ominfra-0.0.0.dev90.dist-info → ominfra-0.0.0.dev91.dist-info}/entry_points.txt +0 -0
- {ominfra-0.0.0.dev90.dist-info → ominfra-0.0.0.dev91.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,10 @@
|
|
1
1
|
# ruff: noqa: UP007
|
2
|
+
# @omlish-lite
|
3
|
+
"""
|
4
|
+
TODO:
|
5
|
+
- implement stop lol
|
6
|
+
- collective heartbeat monitoring - ThreadWorkerGroups
|
7
|
+
"""
|
2
8
|
import abc
|
3
9
|
import threading
|
4
10
|
import time
|
@@ -59,6 +65,3 @@ class ThreadWorker(abc.ABC):
|
|
59
65
|
|
60
66
|
def stop(self) -> None:
|
61
67
|
raise NotImplementedError
|
62
|
-
|
63
|
-
def cleanup(self) -> None: # noqa
|
64
|
-
pass
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ominfra
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev91
|
4
4
|
Summary: ominfra
|
5
5
|
Author: wrmsr
|
6
6
|
License: BSD-3-Clause
|
@@ -10,10 +10,10 @@ Classifier: Development Status :: 2 - Pre-Alpha
|
|
10
10
|
Classifier: Intended Audience :: Developers
|
11
11
|
Classifier: Operating System :: OS Independent
|
12
12
|
Classifier: Operating System :: POSIX
|
13
|
-
Requires-Python:
|
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.dev91
|
16
|
+
Requires-Dist: omlish ==0.0.0.dev91
|
17
17
|
Provides-Extra: all
|
18
18
|
Requires-Dist: paramiko ~=3.5 ; extra == 'all'
|
19
19
|
Requires-Dist: asyncssh ~=2.18 ; extra == 'all'
|
@@ -3,21 +3,17 @@ ominfra/__about__.py,sha256=6i1AoruFYQCd-PyhhbDQDWY2d1tiQu9nkwWr-fXAqfY,705
|
|
3
3
|
ominfra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
ominfra/cmds.py,sha256=E0AfnvEmnKntXWvmLW5L05_NeDpBET1VBXn7vV6EwBQ,2083
|
5
5
|
ominfra/ssh.py,sha256=jQpc4WvkMckIfk4vILda8zFaeharRqc_6wxW50b0OjQ,5431
|
6
|
+
ominfra/threadworker.py,sha256=8rnWvgKjPIAdctS6wxiUiEIzm-mORRkWVD94YghVj0g,1413
|
6
7
|
ominfra/clouds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
8
|
ominfra/clouds/aws/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
9
|
ominfra/clouds/aws/__main__.py,sha256=HXMoxEl9KHhv6zOOPQxiJAftfR2SjBqeVTYw-og9aFw,163
|
9
10
|
ominfra/clouds/aws/auth.py,sha256=p50hnm8SU4CWAkLX0C4XCTAm7yAAg-HqcP1YvL5cW94,6205
|
10
11
|
ominfra/clouds/aws/cli.py,sha256=OJVVLIwSy1378drkgP1ke_JltbyzBmnrB_Lom6A83os,510
|
11
12
|
ominfra/clouds/aws/dataclasses.py,sha256=rKhtJKJ0JhMssU9n9CABX_JaUiokIboEATJ9TZgZQ6A,3868
|
12
|
-
ominfra/clouds/aws/logs.py,sha256=
|
13
|
+
ominfra/clouds/aws/logs.py,sha256=7Cl9vjco6G-5wW06TmuzU9GZ-diFP8V26X2UZnfJD3U,5232
|
13
14
|
ominfra/clouds/aws/metadata.py,sha256=XR1BuMdQheyeFjjA3MN8GCNWVAp5ahoPdbWXEmViutQ,2767
|
14
15
|
ominfra/clouds/aws/journald2aws/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
|
15
|
-
ominfra/clouds/aws/journald2aws/main.py,sha256=
|
16
|
-
ominfra/clouds/aws/journald2aws/threadworker.py,sha256=JFOrfBmDxQKCwk13qJ8-Zs8fxueMpHu0qRTEssdI7J0,1359
|
17
|
-
ominfra/clouds/aws/journald2aws/journald/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
|
18
|
-
ominfra/clouds/aws/journald2aws/journald/genmessages.py,sha256=3lB3W_Xl4GLAutNu1KvihdtMvkkukYqrfsamcqOS204,1583
|
19
|
-
ominfra/clouds/aws/journald2aws/journald/messages.py,sha256=YBU7mbMtqnuamQKM-fGoraJNlbfzf-c1g8bC0ATSnt4,1975
|
20
|
-
ominfra/clouds/aws/journald2aws/journald/tailer.py,sha256=XldM5QCZovJkfcot5hByj9Jq-F8sAptx65IPmrMo8b4,3042
|
16
|
+
ominfra/clouds/aws/journald2aws/main.py,sha256=6Et4NVf4MY8_8wOIw8tpEnAJhmsy2BhS1vA3-_JFe9E,9108
|
21
17
|
ominfra/deploy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
18
|
ominfra/deploy/_executor.py,sha256=zHn4zAz6Ch1i5R_EdKTfJv_4SE0QPNuQEk7O1ptB_7A,32834
|
23
19
|
ominfra/deploy/configs.py,sha256=qi0kwT7G2NH7dXLOQic-u6R3yeadup_QtvrjwWIggbM,435
|
@@ -45,6 +41,10 @@ ominfra/deploy/poly/runtime.py,sha256=G66AI-a27Wi6QYpG3M0ryqI7c5MnJkXt-_j9Qi8UiU
|
|
45
41
|
ominfra/deploy/poly/site.py,sha256=QJwDDJoVm2-kxi4bxIrp-mn4y2qDLuW3CAUax3W8gv8,239
|
46
42
|
ominfra/deploy/poly/supervisor.py,sha256=zkl6VQBcAZaMAhyR9DbbbqULcgFCDZoe9S_vP-mMFQ8,2289
|
47
43
|
ominfra/deploy/poly/venv.py,sha256=BoipDEa4NTeodjf3L57KJfq9eGKLagFNKwD8pS4yrzA,1552
|
44
|
+
ominfra/journald/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
45
|
+
ominfra/journald/genmessages.py,sha256=3lB3W_Xl4GLAutNu1KvihdtMvkkukYqrfsamcqOS204,1583
|
46
|
+
ominfra/journald/messages.py,sha256=2iMY4k63XGNcN3LPvBmmK55ftjupnNh8f_ijlW9mkhQ,2208
|
47
|
+
ominfra/journald/tailer.py,sha256=4CzBTQcAzlW9OQ--61fIdClZVgbMQQnYe2OD1d5P7e4,36780
|
48
48
|
ominfra/manage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
49
49
|
ominfra/manage/manage.py,sha256=BttL8LFEknHZE_h2Pt5dAqbfUkv6qy43WI0raXBZ1a8,151
|
50
50
|
ominfra/pyremote/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -52,7 +52,7 @@ ominfra/pyremote/_runcommands.py,sha256=2UVHaUJjmWP8jMZE79j2Qk1E5IOyVV1qNSUbdr-z
|
|
52
52
|
ominfra/pyremote/bootstrap.py,sha256=RvMO3YGaN1E4sgUi1JEtiPak8cjvqtc_vRCq1yqbeZg,3370
|
53
53
|
ominfra/pyremote/runcommands.py,sha256=bviS0_TDIoZVAe4h-_iavbvJtVSFu8lnk7fQ5iasCWE,1571
|
54
54
|
ominfra/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
55
|
-
ominfra/scripts/journald2aws.py,sha256=
|
55
|
+
ominfra/scripts/journald2aws.py,sha256=Tvslp_Xe8GqCO2QBNiuMU52vIs-O0S5kpHJPIYma6_w,91385
|
56
56
|
ominfra/scripts/supervisor.py,sha256=EU989AXWM-QJF4BmvKSlxkkBvRR3n2rz6yeXhjzo100,106149
|
57
57
|
ominfra/supervisor/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
|
58
58
|
ominfra/supervisor/__main__.py,sha256=usW9jjq5JPe_2SL8H5PrjDdksO75MX85Ir0HFfb35eM,72
|
@@ -72,9 +72,9 @@ ominfra/tailscale/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
72
72
|
ominfra/tailscale/cli.py,sha256=Ltg6RVFsMLLPjLzoGwM6sxjmwjEVEYHAdrqmCc4N1HM,3174
|
73
73
|
ominfra/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
74
74
|
ominfra/tools/listresources.py,sha256=L4t5rszm9ulcdWyr7n48_R9d5Etg4S2a4WQhlbHDtnQ,6106
|
75
|
-
ominfra-0.0.0.
|
76
|
-
ominfra-0.0.0.
|
77
|
-
ominfra-0.0.0.
|
78
|
-
ominfra-0.0.0.
|
79
|
-
ominfra-0.0.0.
|
80
|
-
ominfra-0.0.0.
|
75
|
+
ominfra-0.0.0.dev91.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
76
|
+
ominfra-0.0.0.dev91.dist-info/METADATA,sha256=R5KW9-xUh5mTaXSsnUIHXvf_-txxmoEIj7bqvo0HhKk,739
|
77
|
+
ominfra-0.0.0.dev91.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
78
|
+
ominfra-0.0.0.dev91.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
|
79
|
+
ominfra-0.0.0.dev91.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
|
80
|
+
ominfra-0.0.0.dev91.dist-info/RECORD,,
|
@@ -1 +0,0 @@
|
|
1
|
-
# @omlish-lite
|
@@ -1,108 +0,0 @@
|
|
1
|
-
# ruff: noqa: UP007
|
2
|
-
import fcntl
|
3
|
-
import os.path
|
4
|
-
import queue # noqa
|
5
|
-
import subprocess
|
6
|
-
import time
|
7
|
-
import typing as ta
|
8
|
-
|
9
|
-
from omlish.lite.cached import cached_nullary
|
10
|
-
from omlish.lite.check import check_not_none
|
11
|
-
from omlish.lite.logs import log
|
12
|
-
from omlish.lite.subprocesses import subprocess_shell_wrap_exec
|
13
|
-
|
14
|
-
from ..threadworker import ThreadWorker
|
15
|
-
from .messages import JournalctlMessage # noqa
|
16
|
-
from .messages import JournalctlMessageBuilder
|
17
|
-
|
18
|
-
|
19
|
-
class JournalctlTailerWorker(ThreadWorker):
|
20
|
-
DEFAULT_CMD: ta.ClassVar[ta.Sequence[str]] = ['journalctl']
|
21
|
-
|
22
|
-
def __init__(
|
23
|
-
self,
|
24
|
-
output, # type: queue.Queue[ta.Sequence[JournalctlMessage]]
|
25
|
-
*,
|
26
|
-
since: ta.Optional[str] = None,
|
27
|
-
after_cursor: ta.Optional[str] = None,
|
28
|
-
|
29
|
-
cmd: ta.Optional[ta.Sequence[str]] = None,
|
30
|
-
shell_wrap: bool = False,
|
31
|
-
|
32
|
-
read_size: int = 0x4000,
|
33
|
-
sleep_s: float = 1.,
|
34
|
-
|
35
|
-
**kwargs: ta.Any,
|
36
|
-
) -> None:
|
37
|
-
super().__init__(**kwargs)
|
38
|
-
|
39
|
-
self._output = output
|
40
|
-
|
41
|
-
self._since = since
|
42
|
-
self._after_cursor = after_cursor
|
43
|
-
|
44
|
-
self._cmd = cmd or self.DEFAULT_CMD
|
45
|
-
self._shell_wrap = shell_wrap
|
46
|
-
|
47
|
-
self._read_size = read_size
|
48
|
-
self._sleep_s = sleep_s
|
49
|
-
|
50
|
-
self._mb = JournalctlMessageBuilder()
|
51
|
-
|
52
|
-
self._proc: ta.Optional[subprocess.Popen] = None
|
53
|
-
|
54
|
-
@cached_nullary
|
55
|
-
def _full_cmd(self) -> ta.Sequence[str]:
|
56
|
-
cmd = [
|
57
|
-
*self._cmd,
|
58
|
-
'--output', 'json',
|
59
|
-
'--show-cursor',
|
60
|
-
'--follow',
|
61
|
-
]
|
62
|
-
|
63
|
-
if self._since is not None:
|
64
|
-
cmd.extend(['--since', self._since])
|
65
|
-
|
66
|
-
if self._after_cursor is not None:
|
67
|
-
cmd.extend(['--after-cursor', self._after_cursor])
|
68
|
-
|
69
|
-
if self._shell_wrap:
|
70
|
-
cmd = list(subprocess_shell_wrap_exec(*cmd))
|
71
|
-
|
72
|
-
return cmd
|
73
|
-
|
74
|
-
def _run(self) -> None:
|
75
|
-
with subprocess.Popen(
|
76
|
-
self._full_cmd(),
|
77
|
-
stdout=subprocess.PIPE,
|
78
|
-
) as self._proc:
|
79
|
-
stdout = check_not_none(self._proc.stdout)
|
80
|
-
|
81
|
-
fd = stdout.fileno()
|
82
|
-
fl = fcntl.fcntl(fd, fcntl.F_GETFL)
|
83
|
-
fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
|
84
|
-
|
85
|
-
while True:
|
86
|
-
if not self._heartbeat():
|
87
|
-
break
|
88
|
-
|
89
|
-
while stdout.readable():
|
90
|
-
if not self._heartbeat():
|
91
|
-
break
|
92
|
-
|
93
|
-
buf = stdout.read(self._read_size)
|
94
|
-
if not buf:
|
95
|
-
log.debug('Journalctl empty read')
|
96
|
-
break
|
97
|
-
|
98
|
-
log.debug('Journalctl read buffer: %r', buf)
|
99
|
-
msgs = self._mb.feed(buf)
|
100
|
-
if msgs:
|
101
|
-
self._output.put(msgs)
|
102
|
-
|
103
|
-
if self._proc.poll() is not None:
|
104
|
-
log.critical('Journalctl process terminated')
|
105
|
-
break
|
106
|
-
|
107
|
-
log.debug('Journalctl readable')
|
108
|
-
time.sleep(self._sleep_s)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|