ominfra 0.0.0.dev132__tar.gz → 0.0.0.dev133__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {ominfra-0.0.0.dev132/ominfra.egg-info → ominfra-0.0.0.dev133}/PKG-INFO +3 -3
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/_executor.py +10 -10
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/poly/_main.py +6 -6
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/remote.py +1 -1
- ominfra-0.0.0.dev133/ominfra/pyremote.py +357 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/scripts/supervisor.py +1 -1
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/http.py +1 -1
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133/ominfra.egg-info}/PKG-INFO +3 -3
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra.egg-info/SOURCES.txt +28 -31
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra.egg-info/requires.txt +2 -2
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/pyproject.toml +3 -3
- ominfra-0.0.0.dev132/ominfra/pyremote/_runcommands.py +0 -1201
- ominfra-0.0.0.dev132/ominfra/pyremote/bootstrap.py +0 -149
- ominfra-0.0.0.dev132/ominfra/pyremote/runcommands.py +0 -56
- ominfra-0.0.0.dev132/ominfra/tools/__init__.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/LICENSE +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/MANIFEST.in +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/README.rst +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/.manifests.json +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/__about__.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/__init__.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/clouds/__init__.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/clouds/aws/__init__.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/clouds/aws/__main__.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/clouds/aws/auth.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/clouds/aws/cli.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/clouds/aws/dataclasses.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/clouds/aws/journald2aws/__init__.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/clouds/aws/journald2aws/__main__.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/clouds/aws/journald2aws/cursor.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/clouds/aws/journald2aws/driver.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/clouds/aws/journald2aws/main.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/clouds/aws/journald2aws/poster.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/clouds/aws/logs.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/clouds/aws/metadata.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/clouds/gcp/__init__.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/clouds/gcp/auth.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/cmds.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/configs.py +0 -0
- {ominfra-0.0.0.dev132/ominfra/deploy → ominfra-0.0.0.dev133/ominfra/journald}/__init__.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/journald/fields.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/journald/genmessages.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/journald/messages.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/journald/tailer.py +0 -0
- {ominfra-0.0.0.dev132/ominfra/deploy/executor/concerns → ominfra-0.0.0.dev133/ominfra/manage}/__init__.py +0 -0
- {ominfra-0.0.0.dev132/ominfra/journald → ominfra-0.0.0.dev133/ominfra/manage/deploy}/__init__.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/configs.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/executor/__init__.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/executor/base.py +0 -0
- {ominfra-0.0.0.dev132/ominfra/manage → ominfra-0.0.0.dev133/ominfra/manage/deploy/executor/concerns}/__init__.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/executor/concerns/dirs.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/executor/concerns/nginx.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/executor/concerns/repo.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/executor/concerns/supervisor.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/executor/concerns/systemd.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/executor/concerns/user.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/executor/concerns/venv.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/executor/main.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/poly/__init__.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/poly/base.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/poly/configs.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/poly/deploy.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/poly/main.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/poly/nginx.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/poly/repo.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/poly/runtime.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/poly/site.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/poly/supervisor.py +0 -0
- {ominfra-0.0.0.dev132/ominfra → ominfra-0.0.0.dev133/ominfra/manage}/deploy/poly/venv.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/manage/manage.py +0 -0
- {ominfra-0.0.0.dev132/ominfra/pyremote → ominfra-0.0.0.dev133/ominfra/scripts}/__init__.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/scripts/journald2aws.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/ssh.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/LICENSE.txt +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/__init__.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/__main__.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/configs.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/dispatchers.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/dispatchersimpl.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/events.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/exceptions.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/groups.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/groupsimpl.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/inject.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/io.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/main.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/pipes.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/privileges.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/process.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/processimpl.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/setup.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/setupimpl.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/signals.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/spawning.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/spawningimpl.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/states.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/supervisor.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/types.py +0 -0
- {ominfra-0.0.0.dev132/ominfra/scripts → ominfra-0.0.0.dev133/ominfra/supervisor/utils}/__init__.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/utils/collections.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/utils/diag.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/utils/fds.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/utils/fs.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/utils/os.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/utils/ostypes.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/utils/signals.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/utils/strings.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/supervisor/utils/users.py +0 -0
- {ominfra-0.0.0.dev132/ominfra/supervisor/utils → ominfra-0.0.0.dev133/ominfra/tailscale}/__init__.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/tailscale/api.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/tailscale/cli.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/threadworkers.py +0 -0
- {ominfra-0.0.0.dev132/ominfra/tailscale → ominfra-0.0.0.dev133/ominfra/tools}/__init__.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra/tools/listresources.py +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra.egg-info/dependency_links.txt +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra.egg-info/entry_points.txt +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/ominfra.egg-info/top_level.txt +0 -0
- {ominfra-0.0.0.dev132 → ominfra-0.0.0.dev133}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ominfra
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev133
|
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.dev133
|
16
|
+
Requires-Dist: omlish==0.0.0.dev133
|
17
17
|
Provides-Extra: all
|
18
18
|
Requires-Dist: paramiko~=3.5; extra == "all"
|
19
19
|
Requires-Dist: asyncssh~=2.18; extra == "all"
|
@@ -82,10 +82,10 @@ if sys.version_info < (3, 8):
|
|
82
82
|
########################################
|
83
83
|
|
84
84
|
|
85
|
-
#
|
85
|
+
# ../../../../omlish/lite/cached.py
|
86
86
|
T = ta.TypeVar('T')
|
87
87
|
|
88
|
-
#
|
88
|
+
# ../../../../omlish/lite/check.py
|
89
89
|
SizedT = ta.TypeVar('SizedT', bound=ta.Sized)
|
90
90
|
|
91
91
|
|
@@ -112,7 +112,7 @@ class HostConfig:
|
|
112
112
|
|
113
113
|
|
114
114
|
########################################
|
115
|
-
#
|
115
|
+
# ../../../../../omlish/lite/cached.py
|
116
116
|
|
117
117
|
|
118
118
|
class _cached_nullary: # noqa
|
@@ -137,7 +137,7 @@ def cached_nullary(fn): # ta.Callable[..., T]) -> ta.Callable[..., T]:
|
|
137
137
|
|
138
138
|
|
139
139
|
########################################
|
140
|
-
#
|
140
|
+
# ../../../../../omlish/lite/check.py
|
141
141
|
|
142
142
|
|
143
143
|
def check_isinstance(v: ta.Any, spec: ta.Union[ta.Type[T], tuple]) -> T:
|
@@ -234,7 +234,7 @@ def check_non_empty(v: SizedT) -> SizedT:
|
|
234
234
|
|
235
235
|
|
236
236
|
########################################
|
237
|
-
#
|
237
|
+
# ../../../../../omlish/lite/json.py
|
238
238
|
|
239
239
|
|
240
240
|
##
|
@@ -265,7 +265,7 @@ json_dumps_compact: ta.Callable[..., str] = functools.partial(json.dumps, **JSON
|
|
265
265
|
|
266
266
|
|
267
267
|
########################################
|
268
|
-
#
|
268
|
+
# ../../../../../omlish/lite/reflect.py
|
269
269
|
|
270
270
|
|
271
271
|
_GENERIC_ALIAS_TYPES = (
|
@@ -320,7 +320,7 @@ def deep_subclasses(cls: ta.Type[T]) -> ta.Iterator[ta.Type[T]]:
|
|
320
320
|
|
321
321
|
|
322
322
|
########################################
|
323
|
-
#
|
323
|
+
# ../../../../../omlish/lite/logs.py
|
324
324
|
"""
|
325
325
|
TODO:
|
326
326
|
- translate json keys
|
@@ -590,7 +590,7 @@ def configure_standard_logging(
|
|
590
590
|
|
591
591
|
|
592
592
|
########################################
|
593
|
-
#
|
593
|
+
# ../../../../../omlish/lite/marshal.py
|
594
594
|
"""
|
595
595
|
TODO:
|
596
596
|
- pickle stdlib objs? have to pin to 3.8 pickle protocol, will be cross-version
|
@@ -934,7 +934,7 @@ def unmarshal_obj(o: ta.Any, ty: ta.Union[ta.Type[T], ta.Any]) -> T:
|
|
934
934
|
|
935
935
|
|
936
936
|
########################################
|
937
|
-
#
|
937
|
+
# ../../../../../omlish/lite/runtime.py
|
938
938
|
|
939
939
|
|
940
940
|
@cached_nullary
|
@@ -951,7 +951,7 @@ def check_runtime_version() -> None:
|
|
951
951
|
|
952
952
|
|
953
953
|
########################################
|
954
|
-
#
|
954
|
+
# ../../../../../omlish/lite/subprocesses.py
|
955
955
|
|
956
956
|
|
957
957
|
##
|
@@ -33,7 +33,7 @@ if sys.version_info < (3, 8):
|
|
33
33
|
########################################
|
34
34
|
|
35
35
|
|
36
|
-
#
|
36
|
+
# ../../../../omlish/lite/cached.py
|
37
37
|
T = ta.TypeVar('T')
|
38
38
|
|
39
39
|
# base.py
|
@@ -84,7 +84,7 @@ class DeployConfig:
|
|
84
84
|
|
85
85
|
|
86
86
|
########################################
|
87
|
-
#
|
87
|
+
# ../../../../../omlish/lite/cached.py
|
88
88
|
|
89
89
|
|
90
90
|
class _cached_nullary: # noqa
|
@@ -109,7 +109,7 @@ def cached_nullary(fn): # ta.Callable[..., T]) -> ta.Callable[..., T]:
|
|
109
109
|
|
110
110
|
|
111
111
|
########################################
|
112
|
-
#
|
112
|
+
# ../../../../../omlish/lite/json.py
|
113
113
|
|
114
114
|
|
115
115
|
##
|
@@ -301,7 +301,7 @@ class Deploy(ConcernsContainer[DeployConcern, DeployConfig]):
|
|
301
301
|
|
302
302
|
|
303
303
|
########################################
|
304
|
-
#
|
304
|
+
# ../../../../../omlish/lite/logs.py
|
305
305
|
"""
|
306
306
|
TODO:
|
307
307
|
- translate json keys
|
@@ -571,7 +571,7 @@ def configure_standard_logging(
|
|
571
571
|
|
572
572
|
|
573
573
|
########################################
|
574
|
-
#
|
574
|
+
# ../../../../../omlish/lite/runtime.py
|
575
575
|
|
576
576
|
|
577
577
|
@cached_nullary
|
@@ -708,7 +708,7 @@ class SiteImpl(Site):
|
|
708
708
|
|
709
709
|
|
710
710
|
########################################
|
711
|
-
#
|
711
|
+
# ../../../../../omlish/lite/subprocesses.py
|
712
712
|
|
713
713
|
|
714
714
|
##
|
@@ -0,0 +1,357 @@
|
|
1
|
+
# ruff: noqa: UP006 UP007
|
2
|
+
# @omlish-lite
|
3
|
+
"""
|
4
|
+
Basically this: https://mitogen.networkgenomics.com/howitworks.html
|
5
|
+
"""
|
6
|
+
import base64
|
7
|
+
import dataclasses as dc
|
8
|
+
import inspect
|
9
|
+
import json
|
10
|
+
import os
|
11
|
+
import platform
|
12
|
+
import pwd
|
13
|
+
import site
|
14
|
+
import struct
|
15
|
+
import sys
|
16
|
+
import textwrap
|
17
|
+
import typing as ta
|
18
|
+
import zlib
|
19
|
+
|
20
|
+
from omlish.lite.check import check_isinstance
|
21
|
+
from omlish.lite.check import check_none
|
22
|
+
|
23
|
+
|
24
|
+
##
|
25
|
+
|
26
|
+
|
27
|
+
_PYREMOTE_BOOTSTRAP_COMM_FD = 100
|
28
|
+
_PYREMOTE_BOOTSTRAP_SRC_FD = 101
|
29
|
+
|
30
|
+
_PYREMOTE_BOOTSTRAP_CHILD_PID_VAR = '_OPYR_CPID'
|
31
|
+
_PYREMOTE_BOOTSTRAP_ARGV0_VAR = '_OPYR_ARGV0'
|
32
|
+
|
33
|
+
_PYREMOTE_BOOTSTRAP_ACK0 = b'OPYR000\n'
|
34
|
+
_PYREMOTE_BOOTSTRAP_ACK1 = b'OPYR001\n'
|
35
|
+
_PYREMOTE_BOOTSTRAP_ACK2 = b'OPYR001\n'
|
36
|
+
_PYREMOTE_BOOTSTRAP_ACK3 = b'OPYR001\n'
|
37
|
+
|
38
|
+
_PYREMOTE_BOOTSTRAP_PROC_TITLE_FMT = '(pyremote:%s)'
|
39
|
+
|
40
|
+
_PYREMOTE_BOOTSTRAP_IMPORTS = [
|
41
|
+
'base64',
|
42
|
+
'os',
|
43
|
+
'struct',
|
44
|
+
'sys',
|
45
|
+
'zlib',
|
46
|
+
]
|
47
|
+
|
48
|
+
|
49
|
+
def _pyremote_bootstrap_main(context_name: str) -> None:
|
50
|
+
# Get pid
|
51
|
+
pid = os.getpid()
|
52
|
+
|
53
|
+
# Two copies of main src to be sent to parent
|
54
|
+
r0, w0 = os.pipe()
|
55
|
+
r1, w1 = os.pipe()
|
56
|
+
|
57
|
+
if (cp := os.fork()):
|
58
|
+
# Parent process
|
59
|
+
|
60
|
+
# Dup original stdin to comm_fd for use as comm channel
|
61
|
+
os.dup2(0, _PYREMOTE_BOOTSTRAP_COMM_FD)
|
62
|
+
|
63
|
+
# Overwrite stdin (fed to python repl) with first copy of src
|
64
|
+
os.dup2(r0, 0)
|
65
|
+
|
66
|
+
# Dup second copy of src to src_fd to recover after launch
|
67
|
+
os.dup2(r1, _PYREMOTE_BOOTSTRAP_SRC_FD)
|
68
|
+
|
69
|
+
# Close remaining fd's
|
70
|
+
for f in [r0, w0, r1, w1]:
|
71
|
+
os.close(f)
|
72
|
+
|
73
|
+
# Save child pid to close after relaunch
|
74
|
+
os.environ[_PYREMOTE_BOOTSTRAP_CHILD_PID_VAR] = str(cp)
|
75
|
+
|
76
|
+
# Save original argv0
|
77
|
+
os.environ[_PYREMOTE_BOOTSTRAP_ARGV0_VAR] = sys.executable
|
78
|
+
|
79
|
+
# Start repl reading stdin from r0
|
80
|
+
os.execl(sys.executable, sys.executable + (_PYREMOTE_BOOTSTRAP_PROC_TITLE_FMT % (context_name,)))
|
81
|
+
|
82
|
+
else:
|
83
|
+
# Child process
|
84
|
+
|
85
|
+
# Write first ack
|
86
|
+
os.write(1, _PYREMOTE_BOOTSTRAP_ACK0)
|
87
|
+
|
88
|
+
# Write pid
|
89
|
+
os.write(1, struct.pack('<Q', pid))
|
90
|
+
|
91
|
+
# Read main src from stdin
|
92
|
+
main_z_len = struct.unpack('<I', os.read(0, 4))[0]
|
93
|
+
main_src = zlib.decompress(os.fdopen(0, 'rb').read(main_z_len))
|
94
|
+
|
95
|
+
# Write both copies of main src. Must write to w0 (parent stdin) before w1 (copy pipe) as pipe will likely fill
|
96
|
+
# and block and need to be drained by pyremote_bootstrap_finalize running in parent.
|
97
|
+
for w in [w0, w1]:
|
98
|
+
fp = os.fdopen(w, 'wb', 0)
|
99
|
+
fp.write(main_src)
|
100
|
+
fp.close()
|
101
|
+
|
102
|
+
# Write second ack
|
103
|
+
os.write(1, _PYREMOTE_BOOTSTRAP_ACK1)
|
104
|
+
|
105
|
+
# Exit child
|
106
|
+
sys.exit(0)
|
107
|
+
|
108
|
+
|
109
|
+
##
|
110
|
+
|
111
|
+
|
112
|
+
def pyremote_build_bootstrap_cmd(context_name: str) -> str:
|
113
|
+
bs_src = textwrap.dedent(inspect.getsource(_pyremote_bootstrap_main))
|
114
|
+
|
115
|
+
for gl in [
|
116
|
+
'_PYREMOTE_BOOTSTRAP_COMM_FD',
|
117
|
+
'_PYREMOTE_BOOTSTRAP_SRC_FD',
|
118
|
+
|
119
|
+
'_PYREMOTE_BOOTSTRAP_CHILD_PID_VAR',
|
120
|
+
'_PYREMOTE_BOOTSTRAP_ARGV0_VAR',
|
121
|
+
|
122
|
+
'_PYREMOTE_BOOTSTRAP_ACK0',
|
123
|
+
'_PYREMOTE_BOOTSTRAP_ACK1',
|
124
|
+
|
125
|
+
'_PYREMOTE_BOOTSTRAP_PROC_TITLE_FMT',
|
126
|
+
]:
|
127
|
+
bs_src = bs_src.replace(gl, repr(globals()[gl]))
|
128
|
+
|
129
|
+
bs_src = '\n'.join(
|
130
|
+
cl
|
131
|
+
for l in bs_src.splitlines()
|
132
|
+
if (cl := (l.split('#')[0]).rstrip())
|
133
|
+
if cl.strip()
|
134
|
+
)
|
135
|
+
|
136
|
+
bs_z = zlib.compress(bs_src.encode('utf-8'))
|
137
|
+
bs_z64 = base64.encodebytes(bs_z).replace(b'\n', b'')
|
138
|
+
|
139
|
+
stmts = [
|
140
|
+
f'import {", ".join(_PYREMOTE_BOOTSTRAP_IMPORTS)}',
|
141
|
+
f'exec(zlib.decompress(base64.decodebytes({bs_z64!r})))',
|
142
|
+
f'_pyremote_bootstrap_main({context_name!r})',
|
143
|
+
]
|
144
|
+
|
145
|
+
cmd = '; '.join(stmts)
|
146
|
+
return cmd
|
147
|
+
|
148
|
+
|
149
|
+
##
|
150
|
+
|
151
|
+
|
152
|
+
@dc.dataclass(frozen=True)
|
153
|
+
class PyremoteEnvInfo:
|
154
|
+
sys_base_prefix: str
|
155
|
+
sys_byteorder: str
|
156
|
+
sys_defaultencoding: str
|
157
|
+
sys_exec_prefix: str
|
158
|
+
sys_executable: str
|
159
|
+
sys_implementation_name: str
|
160
|
+
sys_path: ta.List[str]
|
161
|
+
sys_platform: str
|
162
|
+
sys_prefix: str
|
163
|
+
sys_version: str
|
164
|
+
sys_version_info: ta.List[ta.Union[int, str]]
|
165
|
+
|
166
|
+
platform_architecture: ta.List[str]
|
167
|
+
platform_machine: str
|
168
|
+
platform_platform: str
|
169
|
+
platform_processor: str
|
170
|
+
platform_system: str
|
171
|
+
platform_release: str
|
172
|
+
platform_version: str
|
173
|
+
|
174
|
+
site_userbase: str
|
175
|
+
|
176
|
+
os_cwd: str
|
177
|
+
os_gid: int
|
178
|
+
os_loadavg: ta.List[float]
|
179
|
+
os_login: ta.Optional[str]
|
180
|
+
os_pgrp: int
|
181
|
+
os_pid: int
|
182
|
+
os_ppid: int
|
183
|
+
os_uid: int
|
184
|
+
|
185
|
+
pw_name: str
|
186
|
+
pw_uid: int
|
187
|
+
pw_gid: int
|
188
|
+
pw_gecos: str
|
189
|
+
pw_dir: str
|
190
|
+
pw_shell: str
|
191
|
+
|
192
|
+
env_path: ta.Optional[str]
|
193
|
+
|
194
|
+
|
195
|
+
def _get_pyremote_env_info() -> PyremoteEnvInfo:
|
196
|
+
os_uid = os.getuid()
|
197
|
+
|
198
|
+
pw = pwd.getpwuid(os_uid)
|
199
|
+
|
200
|
+
os_login: ta.Optional[str]
|
201
|
+
try:
|
202
|
+
os_login = os.getlogin()
|
203
|
+
except OSError:
|
204
|
+
os_login = None
|
205
|
+
|
206
|
+
return PyremoteEnvInfo(
|
207
|
+
sys_base_prefix=sys.base_prefix,
|
208
|
+
sys_byteorder=sys.byteorder,
|
209
|
+
sys_defaultencoding=sys.getdefaultencoding(),
|
210
|
+
sys_exec_prefix=sys.exec_prefix,
|
211
|
+
sys_executable=sys.executable,
|
212
|
+
sys_implementation_name=sys.implementation.name,
|
213
|
+
sys_path=sys.path,
|
214
|
+
sys_platform=sys.platform,
|
215
|
+
sys_prefix=sys.prefix,
|
216
|
+
sys_version=sys.version,
|
217
|
+
sys_version_info=list(sys.version_info),
|
218
|
+
|
219
|
+
platform_architecture=list(platform.architecture()),
|
220
|
+
platform_machine=platform.machine(),
|
221
|
+
platform_platform=platform.platform(),
|
222
|
+
platform_processor=platform.processor(),
|
223
|
+
platform_system=platform.system(),
|
224
|
+
platform_release=platform.release(),
|
225
|
+
platform_version=platform.version(),
|
226
|
+
|
227
|
+
site_userbase=site.getuserbase(),
|
228
|
+
|
229
|
+
os_cwd=os.getcwd(),
|
230
|
+
os_gid=os.getgid(),
|
231
|
+
os_loadavg=list(os.getloadavg()),
|
232
|
+
os_login=os_login,
|
233
|
+
os_pgrp=os.getpgrp(),
|
234
|
+
os_pid=os.getpid(),
|
235
|
+
os_ppid=os.getppid(),
|
236
|
+
os_uid=os_uid,
|
237
|
+
|
238
|
+
pw_name=pw.pw_name,
|
239
|
+
pw_uid=pw.pw_uid,
|
240
|
+
pw_gid=pw.pw_gid,
|
241
|
+
pw_gecos=pw.pw_gecos,
|
242
|
+
pw_dir=pw.pw_dir,
|
243
|
+
pw_shell=pw.pw_shell,
|
244
|
+
|
245
|
+
env_path=os.environ.get('PATH'),
|
246
|
+
)
|
247
|
+
|
248
|
+
|
249
|
+
##
|
250
|
+
|
251
|
+
|
252
|
+
class PyremoteBootstrapDriver:
|
253
|
+
def __init__(self, main_src: str) -> None:
|
254
|
+
super().__init__()
|
255
|
+
|
256
|
+
self._main_src = main_src
|
257
|
+
self._main_z = zlib.compress(main_src.encode('utf-8'))
|
258
|
+
|
259
|
+
@dc.dataclass(frozen=True)
|
260
|
+
class Read:
|
261
|
+
sz: int
|
262
|
+
|
263
|
+
@dc.dataclass(frozen=True)
|
264
|
+
class Write:
|
265
|
+
d: bytes
|
266
|
+
|
267
|
+
class ProtocolError(Exception):
|
268
|
+
pass
|
269
|
+
|
270
|
+
@dc.dataclass(frozen=True)
|
271
|
+
class Result:
|
272
|
+
pid: int
|
273
|
+
env_info: PyremoteEnvInfo
|
274
|
+
|
275
|
+
def __call__(self) -> ta.Generator[ta.Union[Read, Write], ta.Optional[bytes], Result]:
|
276
|
+
# Read first ack
|
277
|
+
yield from self._expect(_PYREMOTE_BOOTSTRAP_ACK0)
|
278
|
+
|
279
|
+
# Read pid
|
280
|
+
d = yield from self._read(8)
|
281
|
+
pid = struct.unpack('<Q', d)[0]
|
282
|
+
|
283
|
+
# Write main src
|
284
|
+
check_none((yield self.Write(struct.pack('<I', len(self._main_z)))))
|
285
|
+
check_none((yield self.Write(self._main_z)))
|
286
|
+
|
287
|
+
# Read second and third ack
|
288
|
+
yield from self._expect(_PYREMOTE_BOOTSTRAP_ACK1)
|
289
|
+
yield from self._expect(_PYREMOTE_BOOTSTRAP_ACK2)
|
290
|
+
|
291
|
+
# Read env info
|
292
|
+
d = yield from self._read(4)
|
293
|
+
env_info_json_len = struct.unpack('<I', d)[0]
|
294
|
+
d = yield from self._read(env_info_json_len)
|
295
|
+
env_info_json = d.decode('utf-8')
|
296
|
+
env_info = PyremoteEnvInfo(**json.loads(env_info_json))
|
297
|
+
|
298
|
+
# Read fourth ack
|
299
|
+
yield from self._expect(_PYREMOTE_BOOTSTRAP_ACK3)
|
300
|
+
|
301
|
+
# Return
|
302
|
+
return self.Result(
|
303
|
+
pid=pid,
|
304
|
+
env_info=env_info,
|
305
|
+
)
|
306
|
+
|
307
|
+
def _read(self, sz: int) -> ta.Generator[Read, bytes, bytes]:
|
308
|
+
d = check_isinstance((yield self.Read(sz)), bytes)
|
309
|
+
if len(d) != sz:
|
310
|
+
raise self.ProtocolError(f'Read {len(d)} bytes, expected {sz}')
|
311
|
+
return d
|
312
|
+
|
313
|
+
def _expect(self, e: bytes) -> ta.Generator[Read, bytes, None]:
|
314
|
+
d = yield from self._read(len(e))
|
315
|
+
if d != e:
|
316
|
+
raise self.ProtocolError(f'Read {d!r}, expected {e!r}')
|
317
|
+
|
318
|
+
|
319
|
+
##
|
320
|
+
|
321
|
+
|
322
|
+
@dc.dataclass(frozen=True)
|
323
|
+
class PyremoteBootstrapPayloadRuntime:
|
324
|
+
input: ta.BinaryIO
|
325
|
+
main_src: str
|
326
|
+
|
327
|
+
|
328
|
+
def pyremote_bootstrap_finalize() -> PyremoteBootstrapPayloadRuntime:
|
329
|
+
# Restore original argv0
|
330
|
+
sys.executable = os.environ.pop(_PYREMOTE_BOOTSTRAP_ARGV0_VAR)
|
331
|
+
|
332
|
+
# Read second copy of main src
|
333
|
+
r1 = os.fdopen(_PYREMOTE_BOOTSTRAP_SRC_FD, 'rb', 0)
|
334
|
+
main_src = r1.read().decode('utf-8')
|
335
|
+
r1.close()
|
336
|
+
|
337
|
+
# Reap boostrap child. Must be done after reading second copy of source because source may be too big to fit in a
|
338
|
+
# pipe at once.
|
339
|
+
os.waitpid(int(os.environ.pop(_PYREMOTE_BOOTSTRAP_CHILD_PID_VAR)), 0)
|
340
|
+
|
341
|
+
# Write third ack
|
342
|
+
os.write(1, _PYREMOTE_BOOTSTRAP_ACK2)
|
343
|
+
|
344
|
+
# Write env info
|
345
|
+
env_info = _get_pyremote_env_info()
|
346
|
+
env_info_json = json.dumps(dc.asdict(env_info), indent=None, separators=(',', ':')) # noqa
|
347
|
+
os.write(1, struct.pack('<I', len(env_info_json)))
|
348
|
+
os.write(1, env_info_json.encode('utf-8'))
|
349
|
+
|
350
|
+
# Write fourth ack
|
351
|
+
os.write(1, _PYREMOTE_BOOTSTRAP_ACK3)
|
352
|
+
|
353
|
+
# Return
|
354
|
+
return PyremoteBootstrapPayloadRuntime(
|
355
|
+
input=os.fdopen(_PYREMOTE_BOOTSTRAP_COMM_FD, 'rb', 0),
|
356
|
+
main_src=main_src,
|
357
|
+
)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# @omlish-lite
|
4
4
|
# @omlish-script
|
5
5
|
# @omlish-amalg-output ../supervisor/main.py
|
6
|
-
# ruff: noqa: N802
|
6
|
+
# ruff: noqa: N802 UP006 UP007 UP012 UP036
|
7
7
|
# Supervisor is licensed under the following license:
|
8
8
|
#
|
9
9
|
# A copyright notice accompanies this license document that identifies the copyright holders.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ominfra
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev133
|
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.dev133
|
16
|
+
Requires-Dist: omlish==0.0.0.dev133
|
17
17
|
Provides-Extra: all
|
18
18
|
Requires-Dist: paramiko~=3.5; extra == "all"
|
19
19
|
Requires-Dist: asyncssh~=2.18; extra == "all"
|
@@ -7,6 +7,7 @@ ominfra/__about__.py
|
|
7
7
|
ominfra/__init__.py
|
8
8
|
ominfra/cmds.py
|
9
9
|
ominfra/configs.py
|
10
|
+
ominfra/pyremote.py
|
10
11
|
ominfra/ssh.py
|
11
12
|
ominfra/threadworkers.py
|
12
13
|
ominfra.egg-info/PKG-INFO
|
@@ -31,33 +32,6 @@ ominfra/clouds/aws/journald2aws/main.py
|
|
31
32
|
ominfra/clouds/aws/journald2aws/poster.py
|
32
33
|
ominfra/clouds/gcp/__init__.py
|
33
34
|
ominfra/clouds/gcp/auth.py
|
34
|
-
ominfra/deploy/__init__.py
|
35
|
-
ominfra/deploy/_executor.py
|
36
|
-
ominfra/deploy/configs.py
|
37
|
-
ominfra/deploy/remote.py
|
38
|
-
ominfra/deploy/executor/__init__.py
|
39
|
-
ominfra/deploy/executor/base.py
|
40
|
-
ominfra/deploy/executor/main.py
|
41
|
-
ominfra/deploy/executor/concerns/__init__.py
|
42
|
-
ominfra/deploy/executor/concerns/dirs.py
|
43
|
-
ominfra/deploy/executor/concerns/nginx.py
|
44
|
-
ominfra/deploy/executor/concerns/repo.py
|
45
|
-
ominfra/deploy/executor/concerns/supervisor.py
|
46
|
-
ominfra/deploy/executor/concerns/systemd.py
|
47
|
-
ominfra/deploy/executor/concerns/user.py
|
48
|
-
ominfra/deploy/executor/concerns/venv.py
|
49
|
-
ominfra/deploy/poly/__init__.py
|
50
|
-
ominfra/deploy/poly/_main.py
|
51
|
-
ominfra/deploy/poly/base.py
|
52
|
-
ominfra/deploy/poly/configs.py
|
53
|
-
ominfra/deploy/poly/deploy.py
|
54
|
-
ominfra/deploy/poly/main.py
|
55
|
-
ominfra/deploy/poly/nginx.py
|
56
|
-
ominfra/deploy/poly/repo.py
|
57
|
-
ominfra/deploy/poly/runtime.py
|
58
|
-
ominfra/deploy/poly/site.py
|
59
|
-
ominfra/deploy/poly/supervisor.py
|
60
|
-
ominfra/deploy/poly/venv.py
|
61
35
|
ominfra/journald/__init__.py
|
62
36
|
ominfra/journald/fields.py
|
63
37
|
ominfra/journald/genmessages.py
|
@@ -65,10 +39,33 @@ ominfra/journald/messages.py
|
|
65
39
|
ominfra/journald/tailer.py
|
66
40
|
ominfra/manage/__init__.py
|
67
41
|
ominfra/manage/manage.py
|
68
|
-
ominfra/
|
69
|
-
ominfra/
|
70
|
-
ominfra/
|
71
|
-
ominfra/
|
42
|
+
ominfra/manage/deploy/__init__.py
|
43
|
+
ominfra/manage/deploy/_executor.py
|
44
|
+
ominfra/manage/deploy/configs.py
|
45
|
+
ominfra/manage/deploy/remote.py
|
46
|
+
ominfra/manage/deploy/executor/__init__.py
|
47
|
+
ominfra/manage/deploy/executor/base.py
|
48
|
+
ominfra/manage/deploy/executor/main.py
|
49
|
+
ominfra/manage/deploy/executor/concerns/__init__.py
|
50
|
+
ominfra/manage/deploy/executor/concerns/dirs.py
|
51
|
+
ominfra/manage/deploy/executor/concerns/nginx.py
|
52
|
+
ominfra/manage/deploy/executor/concerns/repo.py
|
53
|
+
ominfra/manage/deploy/executor/concerns/supervisor.py
|
54
|
+
ominfra/manage/deploy/executor/concerns/systemd.py
|
55
|
+
ominfra/manage/deploy/executor/concerns/user.py
|
56
|
+
ominfra/manage/deploy/executor/concerns/venv.py
|
57
|
+
ominfra/manage/deploy/poly/__init__.py
|
58
|
+
ominfra/manage/deploy/poly/_main.py
|
59
|
+
ominfra/manage/deploy/poly/base.py
|
60
|
+
ominfra/manage/deploy/poly/configs.py
|
61
|
+
ominfra/manage/deploy/poly/deploy.py
|
62
|
+
ominfra/manage/deploy/poly/main.py
|
63
|
+
ominfra/manage/deploy/poly/nginx.py
|
64
|
+
ominfra/manage/deploy/poly/repo.py
|
65
|
+
ominfra/manage/deploy/poly/runtime.py
|
66
|
+
ominfra/manage/deploy/poly/site.py
|
67
|
+
ominfra/manage/deploy/poly/supervisor.py
|
68
|
+
ominfra/manage/deploy/poly/venv.py
|
72
69
|
ominfra/scripts/__init__.py
|
73
70
|
ominfra/scripts/journald2aws.py
|
74
71
|
ominfra/scripts/supervisor.py
|
@@ -12,7 +12,7 @@ authors = [
|
|
12
12
|
urls = {source = 'https://github.com/wrmsr/omlish'}
|
13
13
|
license = {text = 'BSD-3-Clause'}
|
14
14
|
requires-python = '>=3.12'
|
15
|
-
version = '0.0.0.
|
15
|
+
version = '0.0.0.dev133'
|
16
16
|
classifiers = [
|
17
17
|
'License :: OSI Approved :: BSD License',
|
18
18
|
'Development Status :: 2 - Pre-Alpha',
|
@@ -22,8 +22,8 @@ classifiers = [
|
|
22
22
|
]
|
23
23
|
description = 'ominfra'
|
24
24
|
dependencies = [
|
25
|
-
'omdev == 0.0.0.
|
26
|
-
'omlish == 0.0.0.
|
25
|
+
'omdev == 0.0.0.dev133',
|
26
|
+
'omlish == 0.0.0.dev133',
|
27
27
|
]
|
28
28
|
|
29
29
|
[project.optional-dependencies]
|