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.

Files changed (82) hide show
  1. ominfra/{.manifests.json → .omlish-manifests.json} +6 -6
  2. ominfra/README.md +26 -0
  3. ominfra/__about__.py +6 -3
  4. ominfra/clouds/aws/auth.py +1 -0
  5. ominfra/clouds/aws/instancetypes/cache.json.gz +0 -0
  6. ominfra/clouds/aws/instancetypes/cli.py +1 -1
  7. ominfra/clouds/aws/journald2aws/cursor.py +5 -1
  8. ominfra/clouds/aws/journald2aws/driver.py +4 -1
  9. ominfra/clouds/aws/journald2aws/main.py +1 -1
  10. ominfra/clouds/aws/journald2aws/poster.py +5 -1
  11. ominfra/clouds/aws/models/{base.py → base/__init__.py} +7 -2
  12. ominfra/clouds/aws/models/base/_dataclasses.py +721 -0
  13. ominfra/clouds/aws/models/gen/cli.py +2 -1
  14. ominfra/clouds/aws/models/gen/gen.py +16 -7
  15. ominfra/clouds/aws/models/services/{ec2.py → ec2/__init__.py} +227 -1
  16. ominfra/clouds/aws/models/services/ec2/_dataclasses.py +30654 -0
  17. ominfra/clouds/aws/models/services/{lambda_.py → lambda_/__init__.py} +139 -1
  18. ominfra/clouds/aws/models/services/lambda_/_dataclasses.py +4182 -0
  19. ominfra/clouds/aws/models/services/{rds.py → rds/__init__.py} +254 -78
  20. ominfra/clouds/aws/models/services/rds/_dataclasses.py +8231 -0
  21. ominfra/clouds/aws/models/services/{s3.py → s3/__init__.py} +9 -1
  22. ominfra/clouds/aws/models/services/s3/_dataclasses.py +5014 -0
  23. ominfra/commands/runners.py +2 -0
  24. ominfra/commands/ssh.py +3 -0
  25. ominfra/journald/messages.py +4 -1
  26. ominfra/journald/tailer.py +13 -10
  27. ominfra/manage/bootstrap_.py +1 -1
  28. ominfra/manage/commands/base.py +7 -6
  29. ominfra/manage/deploy/commands.py +4 -1
  30. ominfra/manage/deploy/conf/specs.py +2 -2
  31. ominfra/manage/deploy/paths/owners.py +3 -2
  32. ominfra/manage/deploy/paths/paths.py +4 -3
  33. ominfra/manage/deploy/tags.py +8 -8
  34. ominfra/manage/inject.py +2 -1
  35. ominfra/manage/main.py +5 -3
  36. ominfra/manage/remote/_main.py +5 -1
  37. ominfra/manage/remote/channel.py +2 -1
  38. ominfra/manage/remote/execution.py +10 -6
  39. ominfra/manage/remote/spawning.py +2 -1
  40. ominfra/manage/system/commands.py +4 -1
  41. ominfra/manage/system/packages.py +2 -1
  42. ominfra/manage/system/platforms.py +7 -4
  43. ominfra/manage/targets/bestpython.sh +1 -1
  44. ominfra/manage/targets/connection.py +2 -1
  45. ominfra/manage/targets/targets.py +5 -5
  46. ominfra/scripts/journald2aws.py +5386 -2425
  47. ominfra/scripts/manage.py +10604 -7389
  48. ominfra/scripts/supervisor.py +7168 -4002
  49. ominfra/supervisor/configs.py +6 -6
  50. ominfra/supervisor/dispatchers.py +3 -0
  51. ominfra/supervisor/dispatchersimpl.py +9 -3
  52. ominfra/supervisor/events.py +13 -6
  53. ominfra/supervisor/groups.py +3 -0
  54. ominfra/supervisor/groupsimpl.py +3 -0
  55. ominfra/supervisor/http.py +1 -1
  56. ominfra/supervisor/inject.py +3 -0
  57. ominfra/supervisor/io.py +4 -1
  58. ominfra/supervisor/main.py +4 -4
  59. ominfra/supervisor/pipes.py +3 -0
  60. ominfra/supervisor/privileges.py +3 -0
  61. ominfra/supervisor/processimpl.py +4 -1
  62. ominfra/supervisor/setup.py +4 -2
  63. ominfra/supervisor/setupimpl.py +4 -1
  64. ominfra/supervisor/signals.py +7 -1
  65. ominfra/supervisor/spawning.py +3 -0
  66. ominfra/supervisor/supervisor.py +4 -1
  67. ominfra/supervisor/types.py +9 -8
  68. ominfra/supervisor/utils/collections.py +7 -2
  69. ominfra/supervisor/utils/diag.py +3 -0
  70. ominfra/supervisor/utils/fds.py +3 -0
  71. ominfra/supervisor/utils/fs.py +3 -0
  72. ominfra/supervisor/utils/os.py +3 -2
  73. ominfra/supervisor/utils/strings.py +1 -0
  74. ominfra/threadworkers.py +6 -2
  75. ominfra/tools/listresources.py +1 -1
  76. ominfra-0.0.0.dev501.dist-info/METADATA +54 -0
  77. {ominfra-0.0.0.dev368.dist-info → ominfra-0.0.0.dev501.dist-info}/RECORD +81 -75
  78. ominfra-0.0.0.dev368.dist-info/METADATA +0 -23
  79. {ominfra-0.0.0.dev368.dist-info → ominfra-0.0.0.dev501.dist-info}/WHEEL +0 -0
  80. {ominfra-0.0.0.dev368.dist-info → ominfra-0.0.0.dev501.dist-info}/entry_points.txt +0 -0
  81. {ominfra-0.0.0.dev368.dist-info → ominfra-0.0.0.dev501.dist-info}/licenses/LICENSE +0 -0
  82. {ominfra-0.0.0.dev368.dist-info → ominfra-0.0.0.dev501.dist-info}/top_level.txt +0 -0
@@ -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 supervisord except for the ones overridden here.
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. start
92
- # all”/”stop all). Higher priorities indicate programs that start last and shut down first.
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 expected exit code (see exitcodes), the start will still be considered a
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 expected exit codes for this program used with autorestart. If the autorestart parameter is set to
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 KB”, MB”, and GB can be used in the value). Set this value to 0 to indicate an unlimited log size.
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
@@ -6,6 +6,9 @@ from .utils.collections import KeyedCollection
6
6
  from .utils.ostypes import Fd
7
7
 
8
8
 
9
+ ##
10
+
11
+
9
12
  class Dispatchers(KeyedCollection[Fd, FdioHandler]):
10
13
  def _key(self, v: FdioHandler) -> Fd:
11
14
  return Fd(v.fd())
@@ -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.logs import log
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
- class BaseProcessDispatcherImpl(ProcessDispatcher, abc.ABC):
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,
@@ -1,12 +1,12 @@
1
1
  # ruff: noqa: UP006 UP007 UP045
2
- import abc
3
2
  import typing as ta
4
3
 
5
- from .states import ProcessState
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(abc.ABC): # noqa
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, abc.ABC):
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, abc.ABC):
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
 
@@ -12,6 +12,9 @@ from .types import ProcessGroup
12
12
  from .utils.collections import KeyedCollectionAccessors
13
13
 
14
14
 
15
+ ##
16
+
17
+
15
18
  class ProcessGroupManager(
16
19
  KeyedCollectionAccessors[str, ProcessGroup],
17
20
  HasDispatchers,
@@ -11,6 +11,9 @@ from .types import Process
11
11
  from .types import ProcessGroup
12
12
 
13
13
 
14
+ ##
15
+
16
+
14
17
  class ProcessFactory(Func2[ProcessConfig, ProcessGroup, Process]):
15
18
  pass
16
19
 
@@ -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
@@ -45,6 +45,9 @@ from .utils.signals import SignalReceiver
45
45
  from .utils.users import get_user
46
46
 
47
47
 
48
+ ##
49
+
50
+
48
51
  @dc.dataclass(frozen=True)
49
52
  class _FdioPollerDaemonizeListener(DaemonizeListener):
50
53
  _poller: FdioPoller
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.lite.logs import log
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
 
@@ -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 journald_log_handler_factory
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=journald_log_handler_factory if not (args.no_journald or is_debugger_attached()) else None,
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
  #
@@ -9,6 +9,9 @@ from .utils.fds import make_pipe
9
9
  from .utils.ostypes import Fd
10
10
 
11
11
 
12
+ ##
13
+
14
+
12
15
  @dc.dataclass(frozen=True)
13
16
  class ProcessPipes:
14
17
  child_stdin: ta.Optional[Fd] = None
@@ -5,6 +5,9 @@ import pwd
5
5
  import typing as ta
6
6
 
7
7
 
8
+ ##
9
+
10
+
8
11
  def drop_privileges(user: ta.Union[int, str, None]) -> ta.Optional[str]:
9
12
  """
10
13
  Drop privileges to become the specified user, which may be a username or uid. Called for supervisord startup and
@@ -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
 
@@ -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(abc.ABC): # noqa
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(abc.ABC):
33
+ class SupervisorSetup(Abstract):
32
34
  @abc.abstractmethod
33
35
  def setup(self) -> None:
34
36
  raise NotImplementedError
@@ -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.lite.logs import log
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
 
@@ -1,7 +1,7 @@
1
1
  # ruff: noqa: UP006 UP007 UP045
2
2
  import signal
3
3
 
4
- from omlish.lite.logs import log
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,
@@ -8,6 +8,9 @@ from .types import Process
8
8
  from .utils.ostypes import Pid
9
9
 
10
10
 
11
+ ##
12
+
13
+
11
14
  @dc.dataclass(frozen=True)
12
15
  class SpawnedProcess:
13
16
  pid: Pid
@@ -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
 
@@ -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(abc.ABC):
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(abc.ABC):
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(abc.ABC):
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, abc.ABC):
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, abc.ABC):
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, abc.ABC):
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
- abc.ABC,
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
- abc.ABC,
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
- class KeyedCollectionAccessors(abc.ABC, ta.Generic[K, V]):
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
 
@@ -4,6 +4,9 @@ import types
4
4
  import typing as ta
5
5
 
6
6
 
7
+ ##
8
+
9
+
7
10
  def compact_traceback() -> ta.Tuple[
8
11
  ta.Tuple[str, str, int],
9
12
  ta.Type[BaseException],
@@ -6,6 +6,9 @@ import typing as ta
6
6
  from .ostypes import Fd
7
7
 
8
8
 
9
+ ##
10
+
11
+
9
12
  class PipeFds(ta.NamedTuple):
10
13
  r: Fd
11
14
  w: Fd
@@ -4,6 +4,9 @@ import tempfile
4
4
  import typing as ta
5
5
 
6
6
 
7
+ ##
8
+
9
+
7
10
  def try_unlink(path: str) -> bool:
8
11
  try:
9
12
  os.unlink(path)
@@ -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[logging.Logger] = None,
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
@@ -66,6 +66,7 @@ class SuffixMultiplier:
66
66
  # case insensitive. Return values are in the fundamental unit.
67
67
  def __init__(self, d, default=1):
68
68
  super().__init__()
69
+
69
70
  self._d = d
70
71
  self._default = default
71
72
  # all keys must be the same size
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.lite.logs import log
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, abc.ABC):
34
+ class ThreadWorker(ExitStacked, Abstract):
31
35
  def __init__(
32
36
  self,
33
37
  *,
@@ -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.try_get('gcp_oauth2').reveal()
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)