ominfra 0.0.0.dev368__py3-none-any.whl → 0.0.0.dev501__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.
Potentially problematic release.
This version of ominfra might be problematic. Click here for more details.
- ominfra/{.manifests.json → .omlish-manifests.json} +6 -6
- ominfra/README.md +26 -0
- ominfra/__about__.py +6 -3
- ominfra/clouds/aws/auth.py +1 -0
- ominfra/clouds/aws/instancetypes/cache.json.gz +0 -0
- ominfra/clouds/aws/instancetypes/cli.py +1 -1
- ominfra/clouds/aws/journald2aws/cursor.py +5 -1
- ominfra/clouds/aws/journald2aws/driver.py +4 -1
- ominfra/clouds/aws/journald2aws/main.py +1 -1
- ominfra/clouds/aws/journald2aws/poster.py +5 -1
- ominfra/clouds/aws/models/{base.py → base/__init__.py} +7 -2
- ominfra/clouds/aws/models/base/_dataclasses.py +721 -0
- ominfra/clouds/aws/models/gen/cli.py +2 -1
- ominfra/clouds/aws/models/gen/gen.py +16 -7
- ominfra/clouds/aws/models/services/{ec2.py → ec2/__init__.py} +227 -1
- ominfra/clouds/aws/models/services/ec2/_dataclasses.py +30654 -0
- ominfra/clouds/aws/models/services/{lambda_.py → lambda_/__init__.py} +139 -1
- ominfra/clouds/aws/models/services/lambda_/_dataclasses.py +4182 -0
- ominfra/clouds/aws/models/services/{rds.py → rds/__init__.py} +254 -78
- ominfra/clouds/aws/models/services/rds/_dataclasses.py +8231 -0
- ominfra/clouds/aws/models/services/{s3.py → s3/__init__.py} +9 -1
- ominfra/clouds/aws/models/services/s3/_dataclasses.py +5014 -0
- ominfra/commands/runners.py +2 -0
- ominfra/commands/ssh.py +3 -0
- ominfra/journald/messages.py +4 -1
- ominfra/journald/tailer.py +13 -10
- ominfra/manage/bootstrap_.py +1 -1
- ominfra/manage/commands/base.py +7 -6
- ominfra/manage/deploy/commands.py +4 -1
- ominfra/manage/deploy/conf/specs.py +2 -2
- ominfra/manage/deploy/paths/owners.py +3 -2
- ominfra/manage/deploy/paths/paths.py +4 -3
- ominfra/manage/deploy/tags.py +8 -8
- ominfra/manage/inject.py +2 -1
- ominfra/manage/main.py +5 -3
- ominfra/manage/remote/_main.py +5 -1
- ominfra/manage/remote/channel.py +2 -1
- ominfra/manage/remote/execution.py +10 -6
- ominfra/manage/remote/spawning.py +2 -1
- ominfra/manage/system/commands.py +4 -1
- ominfra/manage/system/packages.py +2 -1
- ominfra/manage/system/platforms.py +7 -4
- ominfra/manage/targets/bestpython.sh +1 -1
- ominfra/manage/targets/connection.py +2 -1
- ominfra/manage/targets/targets.py +5 -5
- ominfra/scripts/journald2aws.py +5386 -2425
- ominfra/scripts/manage.py +10604 -7389
- ominfra/scripts/supervisor.py +7168 -4002
- ominfra/supervisor/configs.py +6 -6
- ominfra/supervisor/dispatchers.py +3 -0
- ominfra/supervisor/dispatchersimpl.py +9 -3
- ominfra/supervisor/events.py +13 -6
- ominfra/supervisor/groups.py +3 -0
- ominfra/supervisor/groupsimpl.py +3 -0
- ominfra/supervisor/http.py +1 -1
- ominfra/supervisor/inject.py +3 -0
- ominfra/supervisor/io.py +4 -1
- ominfra/supervisor/main.py +4 -4
- ominfra/supervisor/pipes.py +3 -0
- ominfra/supervisor/privileges.py +3 -0
- ominfra/supervisor/processimpl.py +4 -1
- ominfra/supervisor/setup.py +4 -2
- ominfra/supervisor/setupimpl.py +4 -1
- ominfra/supervisor/signals.py +7 -1
- ominfra/supervisor/spawning.py +3 -0
- ominfra/supervisor/supervisor.py +4 -1
- ominfra/supervisor/types.py +9 -8
- ominfra/supervisor/utils/collections.py +7 -2
- ominfra/supervisor/utils/diag.py +3 -0
- ominfra/supervisor/utils/fds.py +3 -0
- ominfra/supervisor/utils/fs.py +3 -0
- ominfra/supervisor/utils/os.py +3 -2
- ominfra/supervisor/utils/strings.py +1 -0
- ominfra/threadworkers.py +6 -2
- ominfra/tools/listresources.py +1 -1
- ominfra-0.0.0.dev501.dist-info/METADATA +54 -0
- {ominfra-0.0.0.dev368.dist-info → ominfra-0.0.0.dev501.dist-info}/RECORD +81 -75
- ominfra-0.0.0.dev368.dist-info/METADATA +0 -23
- {ominfra-0.0.0.dev368.dist-info → ominfra-0.0.0.dev501.dist-info}/WHEEL +0 -0
- {ominfra-0.0.0.dev368.dist-info → ominfra-0.0.0.dev501.dist-info}/entry_points.txt +0 -0
- {ominfra-0.0.0.dev368.dist-info → ominfra-0.0.0.dev501.dist-info}/licenses/LICENSE +0 -0
- {ominfra-0.0.0.dev368.dist-info → ominfra-0.0.0.dev501.dist-info}/top_level.txt +0 -0
ominfra/supervisor/configs.py
CHANGED
|
@@ -82,14 +82,14 @@ class ProcessConfig:
|
|
|
82
82
|
# containing group_name, host_node_name, process_num, program_name, and here (the directory of the supervisord
|
|
83
83
|
# config file). Values containing non-alphanumeric characters should be quoted (e.g. KEY="val:123",KEY2="val,456").
|
|
84
84
|
# Otherwise, quoting the values is optional but recommended. Note that the subprocess will inherit the environment
|
|
85
|
-
# variables of the shell used to start
|
|
85
|
+
# variables of the shell used to start "supervisord" except for the ones overridden here.
|
|
86
86
|
environment: ta.Optional[ta.Mapping[str, str]] = None
|
|
87
87
|
|
|
88
88
|
#
|
|
89
89
|
|
|
90
90
|
# The relative priority of the program in the start and shutdown ordering. Lower priorities indicate programs that
|
|
91
|
-
# start first and shut down last at startup and when aggregate commands are used in various clients (e.g.
|
|
92
|
-
# all
|
|
91
|
+
# start first and shut down last at startup and when aggregate commands are used in various clients (e.g. "start
|
|
92
|
+
# all"/"stop all"). Higher priorities indicate programs that start last and shut down first.
|
|
93
93
|
priority: int = 999
|
|
94
94
|
|
|
95
95
|
# If true, this program will start automatically when supervisord is started.
|
|
@@ -111,7 +111,7 @@ class ProcessConfig:
|
|
|
111
111
|
# successful (moving the process from the STARTING state to the RUNNING state). Set to 0 to indicate that the
|
|
112
112
|
# program needn't stay running for any particular amount of time.
|
|
113
113
|
#
|
|
114
|
-
# Note: Even if a process exits with an
|
|
114
|
+
# Note: Even if a process exits with an "expected" exit code (see exitcodes), the start will still be considered a
|
|
115
115
|
# failure if the process exits quicker than startsecs.
|
|
116
116
|
start_secs: int = 1
|
|
117
117
|
|
|
@@ -140,7 +140,7 @@ class ProcessConfig:
|
|
|
140
140
|
# taking care of its children as well, useful e.g with Python programs using multiprocessing.
|
|
141
141
|
kill_as_group: bool = False
|
|
142
142
|
|
|
143
|
-
# The list of
|
|
143
|
+
# The list of "expected" exit codes for this program used with autorestart. If the autorestart parameter is set to
|
|
144
144
|
# unexpected, and the process exits in any other way than as a result of a supervisor stop request, supervisord will
|
|
145
145
|
# restart the process if it exits with an exit code that is not defined in this list.
|
|
146
146
|
#
|
|
@@ -222,7 +222,7 @@ class ServerConfig:
|
|
|
222
222
|
logfile: str = 'supervisord.log'
|
|
223
223
|
|
|
224
224
|
# The maximum number of bytes that may be consumed by the activity log file before it is rotated (suffix multipliers
|
|
225
|
-
# like
|
|
225
|
+
# like "KB", "MB", and "GB" can be used in the value). Set this value to 0 to indicate an unlimited log size.
|
|
226
226
|
logfile_max_bytes: int = 50 * 1024 * 1024
|
|
227
227
|
|
|
228
228
|
# The number of backups to keep around resulting from activity log file rotation. If set to 0, no backups will be
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# ruff: noqa: UP006 UP007 UP045
|
|
2
|
-
import abc
|
|
3
2
|
import errno
|
|
4
3
|
import logging
|
|
5
4
|
import os
|
|
6
5
|
import typing as ta
|
|
7
6
|
|
|
8
|
-
from omlish.lite.
|
|
7
|
+
from omlish.lite.abstract import Abstract
|
|
8
|
+
from omlish.logs.modules import get_module_logger
|
|
9
9
|
|
|
10
10
|
from .configs import ProcessConfig
|
|
11
11
|
from .configs import ServerConfig
|
|
@@ -26,7 +26,13 @@ from .utils.strings import find_prefix_at_end
|
|
|
26
26
|
from .utils.strings import strip_escapes
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
log = get_module_logger(globals()) # noqa
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
##
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class BaseProcessDispatcherImpl(ProcessDispatcher, Abstract):
|
|
30
36
|
def __init__(
|
|
31
37
|
self,
|
|
32
38
|
process: Process,
|
ominfra/supervisor/events.py
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# ruff: noqa: UP006 UP007 UP045
|
|
2
|
-
import abc
|
|
3
2
|
import typing as ta
|
|
4
3
|
|
|
5
|
-
from .
|
|
4
|
+
from omlish.lite.abstract import Abstract
|
|
6
5
|
|
|
6
|
+
from .states import ProcessState
|
|
7
7
|
|
|
8
|
-
EventCallback = ta.Callable[['Event'], None]
|
|
9
8
|
|
|
9
|
+
EventCallback = ta.Callable[['Event'], None] # ta.TypeAlias
|
|
10
10
|
|
|
11
11
|
ProcessOutputChannel = ta.Literal['stdout', 'stderr'] # ta.TypeAlias
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ ProcessOutputChannel = ta.Literal['stdout', 'stderr'] # ta.TypeAlias
|
|
|
14
14
|
##
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
class Event(
|
|
17
|
+
class Event(Abstract):
|
|
18
18
|
"""Abstract event type."""
|
|
19
19
|
|
|
20
20
|
|
|
@@ -45,11 +45,12 @@ class EventCallbacks:
|
|
|
45
45
|
##
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
class ProcessLogEvent(Event,
|
|
48
|
+
class ProcessLogEvent(Event, Abstract):
|
|
49
49
|
channel: ta.ClassVar[ProcessOutputChannel]
|
|
50
50
|
|
|
51
51
|
def __init__(self, process, pid, data):
|
|
52
52
|
super().__init__()
|
|
53
|
+
|
|
53
54
|
self.process = process
|
|
54
55
|
self.pid = pid
|
|
55
56
|
self.data = data
|
|
@@ -66,7 +67,7 @@ class ProcessLogStderrEvent(ProcessLogEvent):
|
|
|
66
67
|
#
|
|
67
68
|
|
|
68
69
|
|
|
69
|
-
class ProcessCommunicationEvent(Event,
|
|
70
|
+
class ProcessCommunicationEvent(Event, Abstract):
|
|
70
71
|
# event mode tokens
|
|
71
72
|
BEGIN_TOKEN = b'<!--XSUPERVISOR:BEGIN-->'
|
|
72
73
|
END_TOKEN = b'<!--XSUPERVISOR:END-->'
|
|
@@ -75,6 +76,7 @@ class ProcessCommunicationEvent(Event, abc.ABC):
|
|
|
75
76
|
|
|
76
77
|
def __init__(self, process, pid, data):
|
|
77
78
|
super().__init__()
|
|
79
|
+
|
|
78
80
|
self.process = process
|
|
79
81
|
self.pid = pid
|
|
80
82
|
self.data = data
|
|
@@ -94,6 +96,7 @@ class ProcessCommunicationStderrEvent(ProcessCommunicationEvent):
|
|
|
94
96
|
class RemoteCommunicationEvent(Event):
|
|
95
97
|
def __init__(self, type, data): # noqa
|
|
96
98
|
super().__init__()
|
|
99
|
+
|
|
97
100
|
self.type = type
|
|
98
101
|
self.data = data
|
|
99
102
|
|
|
@@ -119,6 +122,7 @@ class SupervisorStoppingEvent(SupervisorStateChangeEvent):
|
|
|
119
122
|
class EventRejectedEvent: # purposely does not subclass Event
|
|
120
123
|
def __init__(self, process, event):
|
|
121
124
|
super().__init__()
|
|
125
|
+
|
|
122
126
|
self.process = process
|
|
123
127
|
self.event = event
|
|
124
128
|
|
|
@@ -133,6 +137,7 @@ class ProcessStateEvent(Event):
|
|
|
133
137
|
|
|
134
138
|
def __init__(self, process, from_state, expected=True):
|
|
135
139
|
super().__init__()
|
|
140
|
+
|
|
136
141
|
self.process = process
|
|
137
142
|
self.from_state = from_state
|
|
138
143
|
self.expected = expected
|
|
@@ -203,6 +208,7 @@ PROCESS_STATE_EVENT_MAP: ta.Mapping[ProcessState, ta.Type[ProcessStateEvent]] =
|
|
|
203
208
|
class ProcessGroupEvent(Event):
|
|
204
209
|
def __init__(self, group):
|
|
205
210
|
super().__init__()
|
|
211
|
+
|
|
206
212
|
self.group = group
|
|
207
213
|
|
|
208
214
|
|
|
@@ -222,6 +228,7 @@ class TickEvent(Event):
|
|
|
222
228
|
|
|
223
229
|
def __init__(self, when, supervisord):
|
|
224
230
|
super().__init__()
|
|
231
|
+
|
|
225
232
|
self.when = when
|
|
226
233
|
self.supervisord = supervisord
|
|
227
234
|
|
ominfra/supervisor/groups.py
CHANGED
ominfra/supervisor/groupsimpl.py
CHANGED
ominfra/supervisor/http.py
CHANGED
|
@@ -4,7 +4,7 @@ import json
|
|
|
4
4
|
import socket
|
|
5
5
|
import typing as ta
|
|
6
6
|
|
|
7
|
-
from omlish.http.coro.fdio import CoroHttpServerConnectionFdioHandler
|
|
7
|
+
from omlish.http.coro.server.fdio import CoroHttpServerConnectionFdioHandler
|
|
8
8
|
from omlish.http.handlers import HttpHandler
|
|
9
9
|
from omlish.http.handlers import HttpHandler_
|
|
10
10
|
from omlish.http.handlers import HttpHandlerRequest
|
ominfra/supervisor/inject.py
CHANGED
ominfra/supervisor/io.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import typing as ta
|
|
3
3
|
|
|
4
4
|
from omlish.io.fdio.pollers import FdioPoller
|
|
5
|
-
from omlish.
|
|
5
|
+
from omlish.logs.modules import get_module_logger
|
|
6
6
|
|
|
7
7
|
from .dispatchers import Dispatchers
|
|
8
8
|
from .types import ExitNow
|
|
@@ -10,6 +10,9 @@ from .types import HasDispatchers
|
|
|
10
10
|
from .utils.ostypes import Fd
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
log = get_module_logger(globals()) # noqa
|
|
14
|
+
|
|
15
|
+
|
|
13
16
|
##
|
|
14
17
|
|
|
15
18
|
|
ominfra/supervisor/main.py
CHANGED
|
@@ -37,12 +37,12 @@ import itertools
|
|
|
37
37
|
import os.path
|
|
38
38
|
import typing as ta
|
|
39
39
|
|
|
40
|
-
from omlish.http.coro.server import CoroHttpServer
|
|
40
|
+
from omlish.http.coro.server.server import CoroHttpServer
|
|
41
41
|
from omlish.lite.configs import load_config_file_obj
|
|
42
42
|
from omlish.lite.inject import inj
|
|
43
43
|
from omlish.lite.runtime import is_debugger_attached
|
|
44
|
-
from omlish.logs.standard import configure_standard_logging
|
|
45
|
-
from omlish.os.journald import
|
|
44
|
+
from omlish.logs.std.standard import configure_standard_logging
|
|
45
|
+
from omlish.os.journald import journald_logging_handler_factory
|
|
46
46
|
|
|
47
47
|
from .configs import ServerConfig
|
|
48
48
|
from .configs import prepare_server_config
|
|
@@ -83,7 +83,7 @@ def main(
|
|
|
83
83
|
if not no_logging:
|
|
84
84
|
configure_standard_logging(
|
|
85
85
|
'INFO',
|
|
86
|
-
handler_factory=
|
|
86
|
+
handler_factory=journald_logging_handler_factory if not (args.no_journald or is_debugger_attached()) else None, # noqa
|
|
87
87
|
)
|
|
88
88
|
|
|
89
89
|
#
|
ominfra/supervisor/pipes.py
CHANGED
ominfra/supervisor/privileges.py
CHANGED
|
@@ -7,8 +7,8 @@ import traceback
|
|
|
7
7
|
import typing as ta
|
|
8
8
|
|
|
9
9
|
from omlish.lite.check import check
|
|
10
|
-
from omlish.lite.logs import log
|
|
11
10
|
from omlish.lite.typing import Func1
|
|
11
|
+
from omlish.logs.modules import get_module_logger
|
|
12
12
|
|
|
13
13
|
from .configs import ProcessConfig
|
|
14
14
|
from .configs import RestartUnconditionally
|
|
@@ -36,6 +36,9 @@ class ProcessSpawningFactory(Func1[Process, ProcessSpawning]):
|
|
|
36
36
|
pass
|
|
37
37
|
|
|
38
38
|
|
|
39
|
+
log = get_module_logger(globals()) # noqa
|
|
40
|
+
|
|
41
|
+
|
|
39
42
|
##
|
|
40
43
|
|
|
41
44
|
|
ominfra/supervisor/setup.py
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import abc
|
|
3
3
|
import typing as ta
|
|
4
4
|
|
|
5
|
+
from omlish.lite.abstract import Abstract
|
|
6
|
+
|
|
5
7
|
from .utils.users import User
|
|
6
8
|
|
|
7
9
|
|
|
@@ -14,7 +16,7 @@ SupervisorUser = ta.NewType('SupervisorUser', User)
|
|
|
14
16
|
##
|
|
15
17
|
|
|
16
18
|
|
|
17
|
-
class DaemonizeListener(
|
|
19
|
+
class DaemonizeListener(Abstract):
|
|
18
20
|
def before_daemonize(self) -> None: # noqa
|
|
19
21
|
pass
|
|
20
22
|
|
|
@@ -28,7 +30,7 @@ DaemonizeListeners = ta.NewType('DaemonizeListeners', ta.Sequence[DaemonizeListe
|
|
|
28
30
|
##
|
|
29
31
|
|
|
30
32
|
|
|
31
|
-
class SupervisorSetup(
|
|
33
|
+
class SupervisorSetup(Abstract):
|
|
32
34
|
@abc.abstractmethod
|
|
33
35
|
def setup(self) -> None:
|
|
34
36
|
raise NotImplementedError
|
ominfra/supervisor/setupimpl.py
CHANGED
|
@@ -6,7 +6,7 @@ import typing as ta
|
|
|
6
6
|
import warnings
|
|
7
7
|
|
|
8
8
|
from omlish.lite.cached import cached_nullary
|
|
9
|
-
from omlish.
|
|
9
|
+
from omlish.logs.modules import get_module_logger
|
|
10
10
|
|
|
11
11
|
from .configs import ServerConfig
|
|
12
12
|
from .privileges import drop_privileges
|
|
@@ -19,6 +19,9 @@ from .utils.os import real_exit
|
|
|
19
19
|
from .utils.ostypes import Rc
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
log = get_module_logger(globals()) # noqa
|
|
23
|
+
|
|
24
|
+
|
|
22
25
|
##
|
|
23
26
|
|
|
24
27
|
|
ominfra/supervisor/signals.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# ruff: noqa: UP006 UP007 UP045
|
|
2
2
|
import signal
|
|
3
3
|
|
|
4
|
-
from omlish.
|
|
4
|
+
from omlish.logs.modules import get_module_logger
|
|
5
5
|
|
|
6
6
|
from .groups import ProcessGroupManager
|
|
7
7
|
from .states import SupervisorState
|
|
@@ -11,6 +11,12 @@ from .utils.signals import SignalReceiver
|
|
|
11
11
|
from .utils.signals import sig_name
|
|
12
12
|
|
|
13
13
|
|
|
14
|
+
log = get_module_logger(globals()) # noqa
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
##
|
|
18
|
+
|
|
19
|
+
|
|
14
20
|
class SignalHandler:
|
|
15
21
|
def __init__(
|
|
16
22
|
self,
|
ominfra/supervisor/spawning.py
CHANGED
ominfra/supervisor/supervisor.py
CHANGED
|
@@ -4,8 +4,8 @@ import typing as ta
|
|
|
4
4
|
|
|
5
5
|
from omlish.io.fdio.pollers import FdioPoller
|
|
6
6
|
from omlish.lite.check import check
|
|
7
|
-
from omlish.lite.logs import log
|
|
8
7
|
from omlish.lite.typing import Func1
|
|
8
|
+
from omlish.logs.modules import get_module_logger
|
|
9
9
|
|
|
10
10
|
from .configs import ProcessGroupConfig
|
|
11
11
|
from .configs import ServerConfig
|
|
@@ -27,6 +27,9 @@ from .utils.os import decode_wait_status
|
|
|
27
27
|
from .utils.os import waitpid
|
|
28
28
|
|
|
29
29
|
|
|
30
|
+
log = get_module_logger(globals()) # noqa
|
|
31
|
+
|
|
32
|
+
|
|
30
33
|
##
|
|
31
34
|
|
|
32
35
|
|
ominfra/supervisor/types.py
CHANGED
|
@@ -4,6 +4,7 @@ import functools
|
|
|
4
4
|
import typing as ta
|
|
5
5
|
|
|
6
6
|
from omlish.io.fdio.handlers import FdioHandler
|
|
7
|
+
from omlish.lite.abstract import Abstract
|
|
7
8
|
|
|
8
9
|
from .configs import ProcessConfig
|
|
9
10
|
from .configs import ProcessGroupConfig
|
|
@@ -33,7 +34,7 @@ ServerEpoch = ta.NewType('ServerEpoch', int)
|
|
|
33
34
|
|
|
34
35
|
|
|
35
36
|
@functools.total_ordering
|
|
36
|
-
class ConfigPriorityOrdered(
|
|
37
|
+
class ConfigPriorityOrdered(Abstract):
|
|
37
38
|
@property
|
|
38
39
|
@abc.abstractmethod
|
|
39
40
|
def config(self) -> ta.Any:
|
|
@@ -52,7 +53,7 @@ class ConfigPriorityOrdered(abc.ABC):
|
|
|
52
53
|
##
|
|
53
54
|
|
|
54
55
|
|
|
55
|
-
class SupervisorStateManager(
|
|
56
|
+
class SupervisorStateManager(Abstract):
|
|
56
57
|
@property
|
|
57
58
|
@abc.abstractmethod
|
|
58
59
|
def state(self) -> SupervisorState:
|
|
@@ -66,13 +67,13 @@ class SupervisorStateManager(abc.ABC):
|
|
|
66
67
|
##
|
|
67
68
|
|
|
68
69
|
|
|
69
|
-
class HasDispatchers(
|
|
70
|
+
class HasDispatchers(Abstract):
|
|
70
71
|
@abc.abstractmethod
|
|
71
72
|
def get_dispatchers(self) -> 'Dispatchers':
|
|
72
73
|
raise NotImplementedError
|
|
73
74
|
|
|
74
75
|
|
|
75
|
-
class ProcessDispatcher(FdioHandler,
|
|
76
|
+
class ProcessDispatcher(FdioHandler, Abstract):
|
|
76
77
|
@property
|
|
77
78
|
@abc.abstractmethod
|
|
78
79
|
def channel(self) -> ProcessOutputChannel:
|
|
@@ -84,7 +85,7 @@ class ProcessDispatcher(FdioHandler, abc.ABC):
|
|
|
84
85
|
raise NotImplementedError
|
|
85
86
|
|
|
86
87
|
|
|
87
|
-
class ProcessOutputDispatcher(ProcessDispatcher,
|
|
88
|
+
class ProcessOutputDispatcher(ProcessDispatcher, Abstract):
|
|
88
89
|
@abc.abstractmethod
|
|
89
90
|
def remove_logs(self) -> None:
|
|
90
91
|
raise NotImplementedError
|
|
@@ -94,7 +95,7 @@ class ProcessOutputDispatcher(ProcessDispatcher, abc.ABC):
|
|
|
94
95
|
raise NotImplementedError
|
|
95
96
|
|
|
96
97
|
|
|
97
|
-
class ProcessInputDispatcher(ProcessDispatcher,
|
|
98
|
+
class ProcessInputDispatcher(ProcessDispatcher, Abstract):
|
|
98
99
|
@abc.abstractmethod
|
|
99
100
|
def write(self, chars: ta.Union[bytes, str]) -> None:
|
|
100
101
|
raise NotImplementedError
|
|
@@ -110,7 +111,7 @@ class ProcessInputDispatcher(ProcessDispatcher, abc.ABC):
|
|
|
110
111
|
class Process(
|
|
111
112
|
ConfigPriorityOrdered,
|
|
112
113
|
HasDispatchers,
|
|
113
|
-
|
|
114
|
+
Abstract,
|
|
114
115
|
):
|
|
115
116
|
@property
|
|
116
117
|
@abc.abstractmethod
|
|
@@ -166,7 +167,7 @@ class Process(
|
|
|
166
167
|
class ProcessGroup(
|
|
167
168
|
ConfigPriorityOrdered,
|
|
168
169
|
KeyedCollectionAccessors[str, Process],
|
|
169
|
-
|
|
170
|
+
Abstract,
|
|
170
171
|
):
|
|
171
172
|
@property
|
|
172
173
|
@abc.abstractmethod
|
|
@@ -2,12 +2,17 @@
|
|
|
2
2
|
import abc
|
|
3
3
|
import typing as ta
|
|
4
4
|
|
|
5
|
+
from omlish.lite.abstract import Abstract
|
|
6
|
+
|
|
5
7
|
|
|
6
8
|
K = ta.TypeVar('K')
|
|
7
9
|
V = ta.TypeVar('V')
|
|
8
10
|
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
##
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class KeyedCollectionAccessors(Abstract, ta.Generic[K, V]):
|
|
11
16
|
@property
|
|
12
17
|
@abc.abstractmethod
|
|
13
18
|
def _by_key(self) -> ta.Mapping[K, V]:
|
|
@@ -32,7 +37,7 @@ class KeyedCollectionAccessors(abc.ABC, ta.Generic[K, V]):
|
|
|
32
37
|
return iter(self._by_key.items())
|
|
33
38
|
|
|
34
39
|
|
|
35
|
-
class KeyedCollection(KeyedCollectionAccessors[K, V]):
|
|
40
|
+
class KeyedCollection(KeyedCollectionAccessors[K, V], Abstract):
|
|
36
41
|
def __init__(self, items: ta.Iterable[V]) -> None:
|
|
37
42
|
super().__init__()
|
|
38
43
|
|
ominfra/supervisor/utils/diag.py
CHANGED
ominfra/supervisor/utils/fds.py
CHANGED
ominfra/supervisor/utils/fs.py
CHANGED
ominfra/supervisor/utils/os.py
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# ruff: noqa: UP006 UP007 UP045
|
|
2
2
|
import errno
|
|
3
|
-
import logging
|
|
4
3
|
import os
|
|
5
4
|
import typing as ta
|
|
6
5
|
|
|
6
|
+
from omlish.logs.protocols import LoggerLike
|
|
7
|
+
|
|
7
8
|
from .ostypes import Pid
|
|
8
9
|
from .ostypes import Rc
|
|
9
10
|
from .signals import sig_name
|
|
@@ -58,7 +59,7 @@ class WaitedPid(ta.NamedTuple):
|
|
|
58
59
|
|
|
59
60
|
def waitpid(
|
|
60
61
|
*,
|
|
61
|
-
log: ta.Optional[
|
|
62
|
+
log: ta.Optional[LoggerLike] = None,
|
|
62
63
|
) -> ta.Optional[WaitedPid]:
|
|
63
64
|
# Need pthread_sigmask here to avoid concurrent sigchld, but Python doesn't offer in Python < 3.4. There is
|
|
64
65
|
# still a race condition here; we can get a sigchld while we're sitting in the waitpid call. However, AFAICT, if
|
ominfra/threadworkers.py
CHANGED
|
@@ -16,18 +16,22 @@ import threading
|
|
|
16
16
|
import time
|
|
17
17
|
import typing as ta
|
|
18
18
|
|
|
19
|
+
from omlish.lite.abstract import Abstract
|
|
19
20
|
from omlish.lite.contextmanagers import ExitStacked
|
|
20
|
-
from omlish.
|
|
21
|
+
from omlish.logs.modules import get_module_logger
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
T = ta.TypeVar('T')
|
|
24
25
|
ThreadWorkerT = ta.TypeVar('ThreadWorkerT', bound='ThreadWorker')
|
|
25
26
|
|
|
26
27
|
|
|
28
|
+
log = get_module_logger(globals()) # noqa
|
|
29
|
+
|
|
30
|
+
|
|
27
31
|
##
|
|
28
32
|
|
|
29
33
|
|
|
30
|
-
class ThreadWorker(ExitStacked,
|
|
34
|
+
class ThreadWorker(ExitStacked, Abstract):
|
|
31
35
|
def __init__(
|
|
32
36
|
self,
|
|
33
37
|
*,
|
ominfra/tools/listresources.py
CHANGED
|
@@ -132,7 +132,7 @@ class GcpServer(Server):
|
|
|
132
132
|
|
|
133
133
|
def get_gcp_servers() -> list[GcpServer]:
|
|
134
134
|
cfg = _get_secrets()
|
|
135
|
-
creds = cfg.
|
|
135
|
+
creds = cfg.get('gcp_oauth2').reveal()
|
|
136
136
|
|
|
137
137
|
from google.oauth2 import service_account
|
|
138
138
|
credentials = service_account.Credentials.from_service_account_info(json.loads(creds))
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ominfra
|
|
3
|
+
Version: 0.0.0.dev501
|
|
4
|
+
Summary: ominfra
|
|
5
|
+
Author: wrmsr
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
Project-URL: source, https://github.com/wrmsr/omlish
|
|
8
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Operating System :: POSIX
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Requires-Python: >=3.13
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: omlish==0.0.0.dev501
|
|
18
|
+
Provides-Extra: all
|
|
19
|
+
Requires-Dist: omdev==0.0.0.dev501; extra == "all"
|
|
20
|
+
Requires-Dist: paramiko~=4.0; extra == "all"
|
|
21
|
+
Requires-Dist: asyncssh~=2.22; extra == "all"
|
|
22
|
+
Provides-Extra: omdev
|
|
23
|
+
Requires-Dist: omdev==0.0.0.dev501; extra == "omdev"
|
|
24
|
+
Provides-Extra: ssh
|
|
25
|
+
Requires-Dist: paramiko~=4.0; extra == "ssh"
|
|
26
|
+
Requires-Dist: asyncssh~=2.22; extra == "ssh"
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# Overview
|
|
30
|
+
|
|
31
|
+
Infrastructure and cloud code.
|
|
32
|
+
|
|
33
|
+
# Notable packages
|
|
34
|
+
|
|
35
|
+
- **[clouds.aws](https://github.com/wrmsr/omlish/blob/master/ominfra/clouds/aws)** - boto-less aws tools, including
|
|
36
|
+
authentication and generated service dataclasses.
|
|
37
|
+
|
|
38
|
+
- **[journald2aws](https://github.com/wrmsr/omlish/blob/master/ominfra/clouds/aws/journald2aws)**
|
|
39
|
+
([amalg](https://github.com/wrmsr/omlish/blob/master/ominfra/scripts/journald2aws.py)) - a self-contained little tool
|
|
40
|
+
that forwards journald to cloudwatch.
|
|
41
|
+
|
|
42
|
+
- **[pyremote](https://github.com/wrmsr/omlish/blob/master/ominfra/pyremote.py)** - does the
|
|
43
|
+
[mitogen trick](https://mitogen.networkgenomics.com/howitworks.html) to facilitate remote execution of python code.
|
|
44
|
+
due to amalgamation, import shenanigans aren't required to do useful work.
|
|
45
|
+
|
|
46
|
+
- **[manage](https://github.com/wrmsr/omlish/blob/master/ominfra/manage)**
|
|
47
|
+
([amalg](https://github.com/wrmsr/omlish/blob/master/ominfra/scripts/manage.py)) - a remote system management tool,
|
|
48
|
+
including a code deployment system. inspired by things like [mitogen](https://mitogen.networkgenomics.com/),
|
|
49
|
+
[pyinfra](https://github.com/pyinfra-dev/pyinfra), [piku](https://github.com/piku/piku). uses pyremote.
|
|
50
|
+
|
|
51
|
+
- **[supervisor](https://github.com/wrmsr/omlish/blob/master/ominfra/supervisor)**
|
|
52
|
+
([amalg](https://github.com/wrmsr/omlish/blob/master/ominfra/scripts/supervisor.py)) - an overhauled,
|
|
53
|
+
[amalgamated](https://github.com/wrmsr/omlish/blob/master/omdev#amalgamation) fork of
|
|
54
|
+
[supervisor](https://github.com/Supervisor/supervisor)
|