ominfra 0.0.0.dev156__py3-none-any.whl → 0.0.0.dev158__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.
- ominfra/clouds/aws/journald2aws/main.py +1 -1
- ominfra/journald/tailer.py +2 -2
- ominfra/manage/bootstrap_.py +1 -1
- ominfra/manage/commands/subprocess.py +4 -4
- ominfra/manage/deploy/apps.py +14 -15
- ominfra/manage/deploy/config.py +3 -0
- ominfra/manage/deploy/git.py +11 -27
- ominfra/manage/deploy/paths.py +48 -48
- ominfra/manage/deploy/specs.py +32 -0
- ominfra/manage/deploy/venvs.py +10 -5
- ominfra/manage/main.py +33 -4
- ominfra/manage/remote/spawning.py +4 -9
- ominfra/manage/system/packages.py +1 -1
- ominfra/pyremote.py +26 -26
- ominfra/scripts/journald2aws.py +469 -357
- ominfra/scripts/manage.py +2488 -1463
- ominfra/scripts/supervisor.py +385 -351
- ominfra/supervisor/configs.py +2 -0
- ominfra/supervisor/http.py +1 -1
- ominfra/supervisor/main.py +2 -2
- ominfra/supervisor/supervisor.py +2 -33
- ominfra/supervisor/utils/os.py +41 -0
- {ominfra-0.0.0.dev156.dist-info → ominfra-0.0.0.dev158.dist-info}/METADATA +3 -3
- {ominfra-0.0.0.dev156.dist-info → ominfra-0.0.0.dev158.dist-info}/RECORD +28 -27
- {ominfra-0.0.0.dev156.dist-info → ominfra-0.0.0.dev158.dist-info}/LICENSE +0 -0
- {ominfra-0.0.0.dev156.dist-info → ominfra-0.0.0.dev158.dist-info}/WHEEL +0 -0
- {ominfra-0.0.0.dev156.dist-info → ominfra-0.0.0.dev158.dist-info}/entry_points.txt +0 -0
- {ominfra-0.0.0.dev156.dist-info → ominfra-0.0.0.dev158.dist-info}/top_level.txt +0 -0
ominfra/pyremote.py
CHANGED
@@ -162,7 +162,7 @@ def _pyremote_bootstrap_main(context_name: str) -> None:
|
|
162
162
|
# Get pid
|
163
163
|
pid = os.getpid()
|
164
164
|
|
165
|
-
# Two copies of
|
165
|
+
# Two copies of payload src to be sent to parent
|
166
166
|
r0, w0 = os.pipe()
|
167
167
|
r1, w1 = os.pipe()
|
168
168
|
|
@@ -201,17 +201,17 @@ def _pyremote_bootstrap_main(context_name: str) -> None:
|
|
201
201
|
# Write pid
|
202
202
|
os.write(1, struct.pack('<Q', pid))
|
203
203
|
|
204
|
-
# Read
|
205
|
-
|
206
|
-
if len(
|
204
|
+
# Read payload src from stdin
|
205
|
+
payload_z_len = struct.unpack('<I', os.read(0, 4))[0]
|
206
|
+
if len(payload_z := os.fdopen(0, 'rb').read(payload_z_len)) != payload_z_len:
|
207
207
|
raise EOFError
|
208
|
-
|
208
|
+
payload_src = zlib.decompress(payload_z)
|
209
209
|
|
210
|
-
# Write both copies of
|
211
|
-
# and block and need to be drained by pyremote_bootstrap_finalize running in parent.
|
210
|
+
# Write both copies of payload src. Must write to w0 (parent stdin) before w1 (copy pipe) as pipe will likely
|
211
|
+
# fill and block and need to be drained by pyremote_bootstrap_finalize running in parent.
|
212
212
|
for w in [w0, w1]:
|
213
213
|
fp = os.fdopen(w, 'wb', 0)
|
214
|
-
fp.write(
|
214
|
+
fp.write(payload_src)
|
215
215
|
fp.close()
|
216
216
|
|
217
217
|
# Write second ack
|
@@ -275,7 +275,7 @@ class PyremotePayloadRuntime:
|
|
275
275
|
input: ta.BinaryIO
|
276
276
|
output: ta.BinaryIO
|
277
277
|
context_name: str
|
278
|
-
|
278
|
+
payload_src: str
|
279
279
|
options: PyremoteBootstrapOptions
|
280
280
|
env_info: PyremoteEnvInfo
|
281
281
|
|
@@ -283,9 +283,9 @@ class PyremotePayloadRuntime:
|
|
283
283
|
def pyremote_bootstrap_finalize() -> PyremotePayloadRuntime:
|
284
284
|
# If src file var is not present we need to do initial finalization
|
285
285
|
if _PYREMOTE_BOOTSTRAP_SRC_FILE_VAR not in os.environ:
|
286
|
-
# Read second copy of
|
286
|
+
# Read second copy of payload src
|
287
287
|
r1 = os.fdopen(_PYREMOTE_BOOTSTRAP_SRC_FD, 'rb', 0)
|
288
|
-
|
288
|
+
payload_src = r1.read().decode('utf-8')
|
289
289
|
r1.close()
|
290
290
|
|
291
291
|
# Reap boostrap child. Must be done after reading second copy of source because source may be too big to fit in
|
@@ -303,7 +303,7 @@ def pyremote_bootstrap_finalize() -> PyremotePayloadRuntime:
|
|
303
303
|
# Write temp source file
|
304
304
|
import tempfile
|
305
305
|
tfd, tfn = tempfile.mkstemp('-pyremote.py')
|
306
|
-
os.write(tfd,
|
306
|
+
os.write(tfd, payload_src.encode('utf-8'))
|
307
307
|
os.close(tfd)
|
308
308
|
|
309
309
|
# Set vars
|
@@ -322,7 +322,7 @@ def pyremote_bootstrap_finalize() -> PyremotePayloadRuntime:
|
|
322
322
|
|
323
323
|
# Read temp source file
|
324
324
|
with open(os.environ.pop(_PYREMOTE_BOOTSTRAP_SRC_FILE_VAR)) as sf:
|
325
|
-
|
325
|
+
payload_src = sf.read()
|
326
326
|
|
327
327
|
# Restore vars
|
328
328
|
sys.executable = os.environ.pop(_PYREMOTE_BOOTSTRAP_ARGV0_VAR)
|
@@ -355,7 +355,7 @@ def pyremote_bootstrap_finalize() -> PyremotePayloadRuntime:
|
|
355
355
|
input=input,
|
356
356
|
output=output,
|
357
357
|
context_name=context_name,
|
358
|
-
|
358
|
+
payload_src=payload_src,
|
359
359
|
options=options,
|
360
360
|
env_info=env_info,
|
361
361
|
)
|
@@ -367,31 +367,31 @@ def pyremote_bootstrap_finalize() -> PyremotePayloadRuntime:
|
|
367
367
|
class PyremoteBootstrapDriver:
|
368
368
|
def __init__(
|
369
369
|
self,
|
370
|
-
|
370
|
+
payload_src: ta.Union[str, ta.Sequence[str]],
|
371
371
|
options: PyremoteBootstrapOptions = PyremoteBootstrapOptions(),
|
372
372
|
) -> None:
|
373
373
|
super().__init__()
|
374
374
|
|
375
|
-
self.
|
375
|
+
self._payload_src = payload_src
|
376
376
|
self._options = options
|
377
377
|
|
378
|
-
self.
|
379
|
-
self.
|
378
|
+
self._prepared_payload_src = self._prepare_payload_src(payload_src, options)
|
379
|
+
self._payload_z = zlib.compress(self._prepared_payload_src.encode('utf-8'))
|
380
380
|
|
381
381
|
self._options_json = json.dumps(dc.asdict(options), indent=None, separators=(',', ':')).encode('utf-8') # noqa
|
382
382
|
#
|
383
383
|
|
384
384
|
@classmethod
|
385
|
-
def
|
385
|
+
def _prepare_payload_src(
|
386
386
|
cls,
|
387
|
-
|
387
|
+
payload_src: ta.Union[str, ta.Sequence[str]],
|
388
388
|
options: PyremoteBootstrapOptions,
|
389
389
|
) -> str:
|
390
390
|
parts: ta.List[str]
|
391
|
-
if isinstance(
|
392
|
-
parts = [
|
391
|
+
if isinstance(payload_src, str):
|
392
|
+
parts = [payload_src]
|
393
393
|
else:
|
394
|
-
parts = list(
|
394
|
+
parts = list(payload_src)
|
395
395
|
|
396
396
|
if (mn := options.main_name_override) is not None:
|
397
397
|
parts.insert(0, f'__name__ = {mn!r}')
|
@@ -427,9 +427,9 @@ class PyremoteBootstrapDriver:
|
|
427
427
|
d = yield from self._read(8)
|
428
428
|
pid = struct.unpack('<Q', d)[0]
|
429
429
|
|
430
|
-
# Write
|
431
|
-
yield from self._write(struct.pack('<I', len(self.
|
432
|
-
yield from self._write(self.
|
430
|
+
# Write payload src
|
431
|
+
yield from self._write(struct.pack('<I', len(self._payload_z)))
|
432
|
+
yield from self._write(self._payload_z)
|
433
433
|
|
434
434
|
# Read second ack (after writing src copies)
|
435
435
|
yield from self._expect(_PYREMOTE_BOOTSTRAP_ACK1)
|