ominfra 0.0.0.dev141__py3-none-any.whl → 0.0.0.dev143__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- ominfra/manage/__init__.py +10 -0
- ominfra/manage/__main__.py +4 -0
- ominfra/manage/bootstrap.py +11 -0
- ominfra/manage/bootstrap_.py +18 -0
- ominfra/manage/commands/base.py +133 -1
- ominfra/manage/commands/execution.py +23 -0
- ominfra/manage/commands/inject.py +122 -0
- ominfra/manage/commands/marshal.py +26 -0
- ominfra/manage/commands/subprocess.py +18 -17
- ominfra/manage/config.py +10 -0
- ominfra/manage/inject.py +55 -0
- ominfra/manage/main.py +54 -132
- ominfra/manage/marshal.py +12 -0
- ominfra/manage/remote/__init__.py +0 -0
- ominfra/manage/remote/channel.py +52 -0
- ominfra/manage/remote/config.py +12 -0
- ominfra/manage/remote/execution.py +193 -0
- ominfra/manage/remote/inject.py +29 -0
- ominfra/manage/{payload.py → remote/payload.py} +7 -1
- ominfra/manage/{spawning.py → remote/spawning.py} +31 -35
- ominfra/pyremote.py +53 -14
- ominfra/scripts/journald2aws.py +216 -131
- ominfra/scripts/manage.py +2180 -452
- ominfra/scripts/supervisor.py +203 -130
- ominfra/supervisor/inject.py +2 -1
- {ominfra-0.0.0.dev141.dist-info → ominfra-0.0.0.dev143.dist-info}/METADATA +3 -3
- {ominfra-0.0.0.dev141.dist-info → ominfra-0.0.0.dev143.dist-info}/RECORD +31 -17
- {ominfra-0.0.0.dev141.dist-info → ominfra-0.0.0.dev143.dist-info}/LICENSE +0 -0
- {ominfra-0.0.0.dev141.dist-info → ominfra-0.0.0.dev143.dist-info}/WHEEL +0 -0
- {ominfra-0.0.0.dev141.dist-info → ominfra-0.0.0.dev143.dist-info}/entry_points.txt +0 -0
- {ominfra-0.0.0.dev141.dist-info → ominfra-0.0.0.dev143.dist-info}/top_level.txt +0 -0
ominfra/scripts/supervisor.py
CHANGED
@@ -4735,21 +4735,26 @@ TODO:
|
|
4735
4735
|
##
|
4736
4736
|
|
4737
4737
|
|
4738
|
+
@dc.dataclass(frozen=True)
|
4739
|
+
class ObjMarshalOptions:
|
4740
|
+
raw_bytes: bool = False
|
4741
|
+
|
4742
|
+
|
4738
4743
|
class ObjMarshaler(abc.ABC):
|
4739
4744
|
@abc.abstractmethod
|
4740
|
-
def marshal(self, o: ta.Any) -> ta.Any:
|
4745
|
+
def marshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4741
4746
|
raise NotImplementedError
|
4742
4747
|
|
4743
4748
|
@abc.abstractmethod
|
4744
|
-
def unmarshal(self, o: ta.Any) -> ta.Any:
|
4749
|
+
def unmarshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4745
4750
|
raise NotImplementedError
|
4746
4751
|
|
4747
4752
|
|
4748
4753
|
class NopObjMarshaler(ObjMarshaler):
|
4749
|
-
def marshal(self, o: ta.Any) -> ta.Any:
|
4754
|
+
def marshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4750
4755
|
return o
|
4751
4756
|
|
4752
|
-
def unmarshal(self, o: ta.Any) -> ta.Any:
|
4757
|
+
def unmarshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4753
4758
|
return o
|
4754
4759
|
|
4755
4760
|
|
@@ -4757,29 +4762,29 @@ class NopObjMarshaler(ObjMarshaler):
|
|
4757
4762
|
class ProxyObjMarshaler(ObjMarshaler):
|
4758
4763
|
m: ta.Optional[ObjMarshaler] = None
|
4759
4764
|
|
4760
|
-
def marshal(self, o: ta.Any) -> ta.Any:
|
4761
|
-
return check_not_none(self.m).marshal(o)
|
4765
|
+
def marshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4766
|
+
return check_not_none(self.m).marshal(o, opts)
|
4762
4767
|
|
4763
|
-
def unmarshal(self, o: ta.Any) -> ta.Any:
|
4764
|
-
return check_not_none(self.m).unmarshal(o)
|
4768
|
+
def unmarshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4769
|
+
return check_not_none(self.m).unmarshal(o, opts)
|
4765
4770
|
|
4766
4771
|
|
4767
4772
|
@dc.dataclass(frozen=True)
|
4768
4773
|
class CastObjMarshaler(ObjMarshaler):
|
4769
4774
|
ty: type
|
4770
4775
|
|
4771
|
-
def marshal(self, o: ta.Any) -> ta.Any:
|
4776
|
+
def marshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4772
4777
|
return o
|
4773
4778
|
|
4774
|
-
def unmarshal(self, o: ta.Any) -> ta.Any:
|
4779
|
+
def unmarshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4775
4780
|
return self.ty(o)
|
4776
4781
|
|
4777
4782
|
|
4778
4783
|
class DynamicObjMarshaler(ObjMarshaler):
|
4779
|
-
def marshal(self, o: ta.Any) -> ta.Any:
|
4784
|
+
def marshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4780
4785
|
return marshal_obj(o)
|
4781
4786
|
|
4782
|
-
def unmarshal(self, o: ta.Any) -> ta.Any:
|
4787
|
+
def unmarshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4783
4788
|
return o
|
4784
4789
|
|
4785
4790
|
|
@@ -4787,21 +4792,36 @@ class DynamicObjMarshaler(ObjMarshaler):
|
|
4787
4792
|
class Base64ObjMarshaler(ObjMarshaler):
|
4788
4793
|
ty: type
|
4789
4794
|
|
4790
|
-
def marshal(self, o: ta.Any) -> ta.Any:
|
4795
|
+
def marshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4791
4796
|
return base64.b64encode(o).decode('ascii')
|
4792
4797
|
|
4793
|
-
def unmarshal(self, o: ta.Any) -> ta.Any:
|
4798
|
+
def unmarshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4794
4799
|
return self.ty(base64.b64decode(o))
|
4795
4800
|
|
4796
4801
|
|
4802
|
+
@dc.dataclass(frozen=True)
|
4803
|
+
class BytesSwitchedObjMarshaler(ObjMarshaler):
|
4804
|
+
m: ObjMarshaler
|
4805
|
+
|
4806
|
+
def marshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4807
|
+
if opts.raw_bytes:
|
4808
|
+
return o
|
4809
|
+
return self.m.marshal(o, opts)
|
4810
|
+
|
4811
|
+
def unmarshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4812
|
+
if opts.raw_bytes:
|
4813
|
+
return o
|
4814
|
+
return self.m.unmarshal(o, opts)
|
4815
|
+
|
4816
|
+
|
4797
4817
|
@dc.dataclass(frozen=True)
|
4798
4818
|
class EnumObjMarshaler(ObjMarshaler):
|
4799
4819
|
ty: type
|
4800
4820
|
|
4801
|
-
def marshal(self, o: ta.Any) -> ta.Any:
|
4821
|
+
def marshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4802
4822
|
return o.name
|
4803
4823
|
|
4804
|
-
def unmarshal(self, o: ta.Any) -> ta.Any:
|
4824
|
+
def unmarshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4805
4825
|
return self.ty.__members__[o] # type: ignore
|
4806
4826
|
|
4807
4827
|
|
@@ -4809,15 +4829,15 @@ class EnumObjMarshaler(ObjMarshaler):
|
|
4809
4829
|
class OptionalObjMarshaler(ObjMarshaler):
|
4810
4830
|
item: ObjMarshaler
|
4811
4831
|
|
4812
|
-
def marshal(self, o: ta.Any) -> ta.Any:
|
4832
|
+
def marshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4813
4833
|
if o is None:
|
4814
4834
|
return None
|
4815
|
-
return self.item.marshal(o)
|
4835
|
+
return self.item.marshal(o, opts)
|
4816
4836
|
|
4817
|
-
def unmarshal(self, o: ta.Any) -> ta.Any:
|
4837
|
+
def unmarshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4818
4838
|
if o is None:
|
4819
4839
|
return None
|
4820
|
-
return self.item.unmarshal(o)
|
4840
|
+
return self.item.unmarshal(o, opts)
|
4821
4841
|
|
4822
4842
|
|
4823
4843
|
@dc.dataclass(frozen=True)
|
@@ -4826,11 +4846,11 @@ class MappingObjMarshaler(ObjMarshaler):
|
|
4826
4846
|
km: ObjMarshaler
|
4827
4847
|
vm: ObjMarshaler
|
4828
4848
|
|
4829
|
-
def marshal(self, o: ta.Any) -> ta.Any:
|
4830
|
-
return {self.km.marshal(k): self.vm.marshal(v) for k, v in o.items()}
|
4849
|
+
def marshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4850
|
+
return {self.km.marshal(k, opts): self.vm.marshal(v, opts) for k, v in o.items()}
|
4831
4851
|
|
4832
|
-
def unmarshal(self, o: ta.Any) -> ta.Any:
|
4833
|
-
return self.ty((self.km.unmarshal(k), self.vm.unmarshal(v)) for k, v in o.items())
|
4852
|
+
def unmarshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4853
|
+
return self.ty((self.km.unmarshal(k, opts), self.vm.unmarshal(v, opts)) for k, v in o.items())
|
4834
4854
|
|
4835
4855
|
|
4836
4856
|
@dc.dataclass(frozen=True)
|
@@ -4838,11 +4858,11 @@ class IterableObjMarshaler(ObjMarshaler):
|
|
4838
4858
|
ty: type
|
4839
4859
|
item: ObjMarshaler
|
4840
4860
|
|
4841
|
-
def marshal(self, o: ta.Any) -> ta.Any:
|
4842
|
-
return [self.item.marshal(e) for e in o]
|
4861
|
+
def marshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4862
|
+
return [self.item.marshal(e, opts) for e in o]
|
4843
4863
|
|
4844
|
-
def unmarshal(self, o: ta.Any) -> ta.Any:
|
4845
|
-
return self.ty(self.item.unmarshal(e) for e in o)
|
4864
|
+
def unmarshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4865
|
+
return self.ty(self.item.unmarshal(e, opts) for e in o)
|
4846
4866
|
|
4847
4867
|
|
4848
4868
|
@dc.dataclass(frozen=True)
|
@@ -4851,11 +4871,11 @@ class DataclassObjMarshaler(ObjMarshaler):
|
|
4851
4871
|
fs: ta.Mapping[str, ObjMarshaler]
|
4852
4872
|
nonstrict: bool = False
|
4853
4873
|
|
4854
|
-
def marshal(self, o: ta.Any) -> ta.Any:
|
4855
|
-
return {k: m.marshal(getattr(o, k)) for k, m in self.fs.items()}
|
4874
|
+
def marshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4875
|
+
return {k: m.marshal(getattr(o, k), opts) for k, m in self.fs.items()}
|
4856
4876
|
|
4857
|
-
def unmarshal(self, o: ta.Any) -> ta.Any:
|
4858
|
-
return self.ty(**{k: self.fs[k].unmarshal(v) for k, v in o.items() if not self.nonstrict or k in self.fs})
|
4877
|
+
def unmarshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4878
|
+
return self.ty(**{k: self.fs[k].unmarshal(v, opts) for k, v in o.items() if not self.nonstrict or k in self.fs})
|
4859
4879
|
|
4860
4880
|
|
4861
4881
|
@dc.dataclass(frozen=True)
|
@@ -4875,50 +4895,50 @@ class PolymorphicObjMarshaler(ObjMarshaler):
|
|
4875
4895
|
{i.tag: i for i in impls},
|
4876
4896
|
)
|
4877
4897
|
|
4878
|
-
def marshal(self, o: ta.Any) -> ta.Any:
|
4898
|
+
def marshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4879
4899
|
impl = self.impls_by_ty[type(o)]
|
4880
|
-
return {impl.tag: impl.m.marshal(o)}
|
4900
|
+
return {impl.tag: impl.m.marshal(o, opts)}
|
4881
4901
|
|
4882
|
-
def unmarshal(self, o: ta.Any) -> ta.Any:
|
4902
|
+
def unmarshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4883
4903
|
[(t, v)] = o.items()
|
4884
4904
|
impl = self.impls_by_tag[t]
|
4885
|
-
return impl.m.unmarshal(v)
|
4905
|
+
return impl.m.unmarshal(v, opts)
|
4886
4906
|
|
4887
4907
|
|
4888
4908
|
@dc.dataclass(frozen=True)
|
4889
4909
|
class DatetimeObjMarshaler(ObjMarshaler):
|
4890
4910
|
ty: type
|
4891
4911
|
|
4892
|
-
def marshal(self, o: ta.Any) -> ta.Any:
|
4912
|
+
def marshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4893
4913
|
return o.isoformat()
|
4894
4914
|
|
4895
|
-
def unmarshal(self, o: ta.Any) -> ta.Any:
|
4915
|
+
def unmarshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4896
4916
|
return self.ty.fromisoformat(o) # type: ignore
|
4897
4917
|
|
4898
4918
|
|
4899
4919
|
class DecimalObjMarshaler(ObjMarshaler):
|
4900
|
-
def marshal(self, o: ta.Any) -> ta.Any:
|
4920
|
+
def marshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4901
4921
|
return str(check_isinstance(o, decimal.Decimal))
|
4902
4922
|
|
4903
|
-
def unmarshal(self, v: ta.Any) -> ta.Any:
|
4923
|
+
def unmarshal(self, v: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4904
4924
|
return decimal.Decimal(check_isinstance(v, str))
|
4905
4925
|
|
4906
4926
|
|
4907
4927
|
class FractionObjMarshaler(ObjMarshaler):
|
4908
|
-
def marshal(self, o: ta.Any) -> ta.Any:
|
4928
|
+
def marshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4909
4929
|
fr = check_isinstance(o, fractions.Fraction)
|
4910
4930
|
return [fr.numerator, fr.denominator]
|
4911
4931
|
|
4912
|
-
def unmarshal(self, v: ta.Any) -> ta.Any:
|
4932
|
+
def unmarshal(self, v: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4913
4933
|
num, denom = check_isinstance(v, list)
|
4914
4934
|
return fractions.Fraction(num, denom)
|
4915
4935
|
|
4916
4936
|
|
4917
4937
|
class UuidObjMarshaler(ObjMarshaler):
|
4918
|
-
def marshal(self, o: ta.Any) -> ta.Any:
|
4938
|
+
def marshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4919
4939
|
return str(o)
|
4920
4940
|
|
4921
|
-
def unmarshal(self, o: ta.Any) -> ta.Any:
|
4941
|
+
def unmarshal(self, o: ta.Any, opts: ObjMarshalOptions) -> ta.Any:
|
4922
4942
|
return uuid.UUID(o)
|
4923
4943
|
|
4924
4944
|
|
@@ -4928,7 +4948,7 @@ class UuidObjMarshaler(ObjMarshaler):
|
|
4928
4948
|
_DEFAULT_OBJ_MARSHALERS: ta.Dict[ta.Any, ObjMarshaler] = {
|
4929
4949
|
**{t: NopObjMarshaler() for t in (type(None),)},
|
4930
4950
|
**{t: CastObjMarshaler(t) for t in (int, float, str, bool)},
|
4931
|
-
**{t: Base64ObjMarshaler(t) for t in (bytes, bytearray)},
|
4951
|
+
**{t: BytesSwitchedObjMarshaler(Base64ObjMarshaler(t)) for t in (bytes, bytearray)},
|
4932
4952
|
**{t: IterableObjMarshaler(t, DynamicObjMarshaler()) for t in (list, tuple, set, frozenset)},
|
4933
4953
|
**{t: MappingObjMarshaler(t, DynamicObjMarshaler(), DynamicObjMarshaler()) for t in (dict,)},
|
4934
4954
|
|
@@ -4954,120 +4974,172 @@ _OBJ_MARSHALER_GENERIC_ITERABLE_TYPES: ta.Dict[ta.Any, type] = {
|
|
4954
4974
|
}
|
4955
4975
|
|
4956
4976
|
|
4957
|
-
|
4958
|
-
ty: ta.Any,
|
4959
|
-
rec: ta.Callable[[ta.Any], ObjMarshaler],
|
4960
|
-
*,
|
4961
|
-
nonstrict_dataclasses: bool = False,
|
4962
|
-
) -> ObjMarshaler:
|
4963
|
-
if isinstance(ty, type):
|
4964
|
-
if abc.ABC in ty.__bases__:
|
4965
|
-
return PolymorphicObjMarshaler.of([ # type: ignore
|
4966
|
-
PolymorphicObjMarshaler.Impl(
|
4967
|
-
ity,
|
4968
|
-
ity.__qualname__,
|
4969
|
-
rec(ity),
|
4970
|
-
)
|
4971
|
-
for ity in deep_subclasses(ty)
|
4972
|
-
if abc.ABC not in ity.__bases__
|
4973
|
-
])
|
4977
|
+
##
|
4974
4978
|
|
4975
|
-
if issubclass(ty, enum.Enum):
|
4976
|
-
return EnumObjMarshaler(ty)
|
4977
4979
|
|
4978
|
-
|
4979
|
-
|
4980
|
-
|
4981
|
-
|
4982
|
-
|
4983
|
-
)
|
4980
|
+
class ObjMarshalerManager:
|
4981
|
+
def __init__(
|
4982
|
+
self,
|
4983
|
+
*,
|
4984
|
+
default_options: ObjMarshalOptions = ObjMarshalOptions(),
|
4984
4985
|
|
4985
|
-
|
4986
|
-
|
4987
|
-
|
4988
|
-
|
4989
|
-
|
4990
|
-
else:
|
4991
|
-
k, v = ta.get_args(ty)
|
4992
|
-
return MappingObjMarshaler(mt, rec(k), rec(v))
|
4986
|
+
default_obj_marshalers: ta.Dict[ta.Any, ObjMarshaler] = _DEFAULT_OBJ_MARSHALERS, # noqa
|
4987
|
+
generic_mapping_types: ta.Dict[ta.Any, type] = _OBJ_MARSHALER_GENERIC_MAPPING_TYPES, # noqa
|
4988
|
+
generic_iterable_types: ta.Dict[ta.Any, type] = _OBJ_MARSHALER_GENERIC_ITERABLE_TYPES, # noqa
|
4989
|
+
) -> None:
|
4990
|
+
super().__init__()
|
4993
4991
|
|
4994
|
-
|
4995
|
-
st = _OBJ_MARSHALER_GENERIC_ITERABLE_TYPES[ta.get_origin(ty)]
|
4996
|
-
except KeyError:
|
4997
|
-
pass
|
4998
|
-
else:
|
4999
|
-
[e] = ta.get_args(ty)
|
5000
|
-
return IterableObjMarshaler(st, rec(e))
|
4992
|
+
self._default_options = default_options
|
5001
4993
|
|
5002
|
-
|
5003
|
-
|
4994
|
+
self._obj_marshalers = dict(default_obj_marshalers)
|
4995
|
+
self._generic_mapping_types = generic_mapping_types
|
4996
|
+
self._generic_iterable_types = generic_iterable_types
|
5004
4997
|
|
5005
|
-
|
4998
|
+
self._lock = threading.RLock()
|
4999
|
+
self._marshalers: ta.Dict[ta.Any, ObjMarshaler] = dict(_DEFAULT_OBJ_MARSHALERS)
|
5000
|
+
self._proxies: ta.Dict[ta.Any, ProxyObjMarshaler] = {}
|
5006
5001
|
|
5002
|
+
#
|
5007
5003
|
|
5008
|
-
|
5004
|
+
def make_obj_marshaler(
|
5005
|
+
self,
|
5006
|
+
ty: ta.Any,
|
5007
|
+
rec: ta.Callable[[ta.Any], ObjMarshaler],
|
5008
|
+
*,
|
5009
|
+
nonstrict_dataclasses: bool = False,
|
5010
|
+
) -> ObjMarshaler:
|
5011
|
+
if isinstance(ty, type):
|
5012
|
+
if abc.ABC in ty.__bases__:
|
5013
|
+
return PolymorphicObjMarshaler.of([ # type: ignore
|
5014
|
+
PolymorphicObjMarshaler.Impl(
|
5015
|
+
ity,
|
5016
|
+
ity.__qualname__,
|
5017
|
+
rec(ity),
|
5018
|
+
)
|
5019
|
+
for ity in deep_subclasses(ty)
|
5020
|
+
if abc.ABC not in ity.__bases__
|
5021
|
+
])
|
5022
|
+
|
5023
|
+
if issubclass(ty, enum.Enum):
|
5024
|
+
return EnumObjMarshaler(ty)
|
5025
|
+
|
5026
|
+
if dc.is_dataclass(ty):
|
5027
|
+
return DataclassObjMarshaler(
|
5028
|
+
ty,
|
5029
|
+
{f.name: rec(f.type) for f in dc.fields(ty)},
|
5030
|
+
nonstrict=nonstrict_dataclasses,
|
5031
|
+
)
|
5009
5032
|
|
5033
|
+
if is_generic_alias(ty):
|
5034
|
+
try:
|
5035
|
+
mt = self._generic_mapping_types[ta.get_origin(ty)]
|
5036
|
+
except KeyError:
|
5037
|
+
pass
|
5038
|
+
else:
|
5039
|
+
k, v = ta.get_args(ty)
|
5040
|
+
return MappingObjMarshaler(mt, rec(k), rec(v))
|
5010
5041
|
|
5011
|
-
|
5042
|
+
try:
|
5043
|
+
st = self._generic_iterable_types[ta.get_origin(ty)]
|
5044
|
+
except KeyError:
|
5045
|
+
pass
|
5046
|
+
else:
|
5047
|
+
[e] = ta.get_args(ty)
|
5048
|
+
return IterableObjMarshaler(st, rec(e))
|
5012
5049
|
|
5013
|
-
|
5050
|
+
if is_union_alias(ty):
|
5051
|
+
return OptionalObjMarshaler(rec(get_optional_alias_arg(ty)))
|
5014
5052
|
|
5015
|
-
|
5053
|
+
raise TypeError(ty)
|
5016
5054
|
|
5055
|
+
#
|
5017
5056
|
|
5018
|
-
def register_opj_marshaler(ty: ta.Any, m: ObjMarshaler) -> None:
|
5019
|
-
|
5020
|
-
|
5021
|
-
|
5022
|
-
|
5057
|
+
def register_opj_marshaler(self, ty: ta.Any, m: ObjMarshaler) -> None:
|
5058
|
+
with self._lock:
|
5059
|
+
if ty in self._obj_marshalers:
|
5060
|
+
raise KeyError(ty)
|
5061
|
+
self._obj_marshalers[ty] = m
|
5023
5062
|
|
5063
|
+
def get_obj_marshaler(
|
5064
|
+
self,
|
5065
|
+
ty: ta.Any,
|
5066
|
+
*,
|
5067
|
+
no_cache: bool = False,
|
5068
|
+
**kwargs: ta.Any,
|
5069
|
+
) -> ObjMarshaler:
|
5070
|
+
with self._lock:
|
5071
|
+
if not no_cache:
|
5072
|
+
try:
|
5073
|
+
return self._obj_marshalers[ty]
|
5074
|
+
except KeyError:
|
5075
|
+
pass
|
5024
5076
|
|
5025
|
-
def get_obj_marshaler(
|
5026
|
-
ty: ta.Any,
|
5027
|
-
*,
|
5028
|
-
no_cache: bool = False,
|
5029
|
-
**kwargs: ta.Any,
|
5030
|
-
) -> ObjMarshaler:
|
5031
|
-
with _OBJ_MARSHALERS_LOCK:
|
5032
|
-
if not no_cache:
|
5033
5077
|
try:
|
5034
|
-
return
|
5078
|
+
return self._proxies[ty]
|
5035
5079
|
except KeyError:
|
5036
5080
|
pass
|
5037
5081
|
|
5038
|
-
|
5039
|
-
|
5040
|
-
|
5041
|
-
|
5082
|
+
rec = functools.partial(
|
5083
|
+
self.get_obj_marshaler,
|
5084
|
+
no_cache=no_cache,
|
5085
|
+
**kwargs,
|
5086
|
+
)
|
5042
5087
|
|
5043
|
-
|
5044
|
-
|
5045
|
-
|
5046
|
-
|
5047
|
-
|
5088
|
+
p = ProxyObjMarshaler()
|
5089
|
+
self._proxies[ty] = p
|
5090
|
+
try:
|
5091
|
+
m = self.make_obj_marshaler(ty, rec, **kwargs)
|
5092
|
+
finally:
|
5093
|
+
del self._proxies[ty]
|
5094
|
+
p.m = m
|
5048
5095
|
|
5049
|
-
|
5050
|
-
|
5051
|
-
|
5052
|
-
|
5053
|
-
|
5054
|
-
del _OBJ_MARSHALER_PROXIES[ty]
|
5055
|
-
p.m = m
|
5096
|
+
if not no_cache:
|
5097
|
+
self._obj_marshalers[ty] = m
|
5098
|
+
return m
|
5099
|
+
|
5100
|
+
#
|
5056
5101
|
|
5057
|
-
|
5058
|
-
|
5059
|
-
|
5102
|
+
def marshal_obj(
|
5103
|
+
self,
|
5104
|
+
o: ta.Any,
|
5105
|
+
ty: ta.Any = None,
|
5106
|
+
opts: ta.Optional[ObjMarshalOptions] = None,
|
5107
|
+
) -> ta.Any:
|
5108
|
+
m = self.get_obj_marshaler(ty if ty is not None else type(o))
|
5109
|
+
return m.marshal(o, opts or self._default_options)
|
5110
|
+
|
5111
|
+
def unmarshal_obj(
|
5112
|
+
self,
|
5113
|
+
o: ta.Any,
|
5114
|
+
ty: ta.Union[ta.Type[T], ta.Any],
|
5115
|
+
opts: ta.Optional[ObjMarshalOptions] = None,
|
5116
|
+
) -> T:
|
5117
|
+
m = self.get_obj_marshaler(ty)
|
5118
|
+
return m.unmarshal(o, opts or self._default_options)
|
5119
|
+
|
5120
|
+
def roundtrip_obj(
|
5121
|
+
self,
|
5122
|
+
o: ta.Any,
|
5123
|
+
ty: ta.Any = None,
|
5124
|
+
opts: ta.Optional[ObjMarshalOptions] = None,
|
5125
|
+
) -> ta.Any:
|
5126
|
+
if ty is None:
|
5127
|
+
ty = type(o)
|
5128
|
+
m: ta.Any = self.marshal_obj(o, ty, opts)
|
5129
|
+
u: ta.Any = self.unmarshal_obj(m, ty, opts)
|
5130
|
+
return u
|
5060
5131
|
|
5061
5132
|
|
5062
5133
|
##
|
5063
5134
|
|
5064
5135
|
|
5065
|
-
|
5066
|
-
return get_obj_marshaler(ty if ty is not None else type(o)).marshal(o)
|
5136
|
+
OBJ_MARSHALER_MANAGER = ObjMarshalerManager()
|
5067
5137
|
|
5138
|
+
register_opj_marshaler = OBJ_MARSHALER_MANAGER.register_opj_marshaler
|
5139
|
+
get_obj_marshaler = OBJ_MARSHALER_MANAGER.get_obj_marshaler
|
5068
5140
|
|
5069
|
-
|
5070
|
-
|
5141
|
+
marshal_obj = OBJ_MARSHALER_MANAGER.marshal_obj
|
5142
|
+
unmarshal_obj = OBJ_MARSHALER_MANAGER.unmarshal_obj
|
5071
5143
|
|
5072
5144
|
|
5073
5145
|
########################################
|
@@ -8543,7 +8615,8 @@ def bind_server(
|
|
8543
8615
|
]))
|
8544
8616
|
lst.extend([
|
8545
8617
|
inj.bind(poller_impl, key=FdIoPoller, singleton=True),
|
8546
|
-
inj.bind(_FdIoPollerDaemonizeListener,
|
8618
|
+
inj.bind(_FdIoPollerDaemonizeListener, singleton=True),
|
8619
|
+
inj.bind(DaemonizeListener, array=True, to_key=_FdIoPollerDaemonizeListener),
|
8547
8620
|
])
|
8548
8621
|
|
8549
8622
|
#
|
ominfra/supervisor/inject.py
CHANGED
@@ -125,7 +125,8 @@ def bind_server(
|
|
125
125
|
]))
|
126
126
|
lst.extend([
|
127
127
|
inj.bind(poller_impl, key=FdIoPoller, singleton=True),
|
128
|
-
inj.bind(_FdIoPollerDaemonizeListener,
|
128
|
+
inj.bind(_FdIoPollerDaemonizeListener, singleton=True),
|
129
|
+
inj.bind(DaemonizeListener, array=True, to_key=_FdIoPollerDaemonizeListener),
|
129
130
|
])
|
130
131
|
|
131
132
|
#
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ominfra
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev143
|
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.dev143
|
16
|
+
Requires-Dist: omlish==0.0.0.dev143
|
17
17
|
Provides-Extra: all
|
18
18
|
Requires-Dist: paramiko~=3.5; extra == "all"
|
19
19
|
Requires-Dist: asyncssh~=2.18; extra == "all"
|
@@ -3,7 +3,7 @@ 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/configs.py,sha256=8aU1Qmbr-qjaE2iP3gAbA2SWJYMPZ-uGK007L01PoOI,1727
|
6
|
-
ominfra/pyremote.py,sha256=
|
6
|
+
ominfra/pyremote.py,sha256=PEKQP8CtJVyKWgDJ-FYcGxpxOPy2AYOZCOQRBFktg4E,14248
|
7
7
|
ominfra/ssh.py,sha256=jQpc4WvkMckIfk4vILda8zFaeharRqc_6wxW50b0OjQ,5431
|
8
8
|
ominfra/threadworkers.py,sha256=oX4ubZn7h932saXpRIJu2MNhBExgGGMuGhdXarZxLJw,4948
|
9
9
|
ominfra/clouds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -27,17 +27,31 @@ ominfra/journald/fields.py,sha256=NjjVn7GW4jkcGdyiiizVjEfQqSFnolXYk3kDcSQcMmc,12
|
|
27
27
|
ominfra/journald/genmessages.py,sha256=rLTS-K2v7otNOtTz4RoOEVYCm0fQuuBzf47e0T61tA8,1857
|
28
28
|
ominfra/journald/messages.py,sha256=Wr7TjWMOySc0WnKwp_-idR8RfeKlbyJQ_KkELr0VB70,2192
|
29
29
|
ominfra/journald/tailer.py,sha256=5abcFMfgi7fnY9ZEQe2ZVobaJxjQkeu6d9Kagw33a1w,33525
|
30
|
-
ominfra/manage/__init__.py,sha256=
|
31
|
-
ominfra/manage/
|
32
|
-
ominfra/manage/
|
33
|
-
ominfra/manage/
|
30
|
+
ominfra/manage/__init__.py,sha256=aykrEASTHEtJ-o97jUHRIv8oea41tO7RDHB56cQfmis,265
|
31
|
+
ominfra/manage/__main__.py,sha256=5IeIERm-371fSI5ZvPv8eldAJBwgKwpR0R49pTsILNM,76
|
32
|
+
ominfra/manage/bootstrap.py,sha256=puGpmK6b6ZCAX5E_HI9ucUuWlXB4U_4Xwc2x8GAKSVo,240
|
33
|
+
ominfra/manage/bootstrap_.py,sha256=WVry3P5ViPpdEC_-EFBouZTECMxs4CwRbek4Oz_iRbc,517
|
34
|
+
ominfra/manage/config.py,sha256=1y2N_8nXHBZc6YbW6BaRZoDDCTBmiHuWtTOQ7zdr5VE,184
|
35
|
+
ominfra/manage/inject.py,sha256=VuSnejEwEPWgVDEmyAqyNfJl-akWoBZUah066up3sqQ,1332
|
36
|
+
ominfra/manage/main.py,sha256=HzBXHdtN69UKk3_qxlu-OrPpa3PddL4eavUemxP36PY,2399
|
37
|
+
ominfra/manage/marshal.py,sha256=WKj7IU9bo4fBMSSzT6ZMm_WFalXIJZ-V7j8oi92fNhk,305
|
34
38
|
ominfra/manage/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
|
-
ominfra/manage/commands/base.py,sha256=
|
36
|
-
ominfra/manage/commands/
|
39
|
+
ominfra/manage/commands/base.py,sha256=yhOAh893iJrk0SvgkRZQMLw8cvStEI2IaHKP9Ifg7N0,3966
|
40
|
+
ominfra/manage/commands/execution.py,sha256=FBkc9tA_QeKfeajijhsgIiIbqwE9LVwI63QoVs--mf0,609
|
41
|
+
ominfra/manage/commands/inject.py,sha256=00QL4Xui5oHXbUG6F8QvJXeIdh2YKThKzqsusZUmfN4,3439
|
42
|
+
ominfra/manage/commands/marshal.py,sha256=4DSCMPzRiRhufIB_9DPL6LrZkRZOle5ruOWU4MVlcXM,694
|
43
|
+
ominfra/manage/commands/subprocess.py,sha256=3JaOt56uPqW3jYRtpBpHk5zm3ZzOXzCK-feyDBkq8P4,2198
|
44
|
+
ominfra/manage/remote/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
45
|
+
ominfra/manage/remote/channel.py,sha256=l3bsuE6JZ3VD5abxsWys7m-4kFjOr_B-27bEMgz4K4Q,1325
|
46
|
+
ominfra/manage/remote/config.py,sha256=yMJsz8zB5i3ytiS-YaCb6-qXumMKXh18SjmtzPVO44c,280
|
47
|
+
ominfra/manage/remote/execution.py,sha256=ro0qBqbPTb3T6R4aL0sKeDodwCpS_DCuGEwEm7J5qyM,4820
|
48
|
+
ominfra/manage/remote/inject.py,sha256=0TEODiCirwlApejbAR7-0ZGkNXA99IHZdmAFKliyJYw,783
|
49
|
+
ominfra/manage/remote/payload.py,sha256=Rn-Yo26POpHEOOfUHX3jWkqcQVEAvkJ_5Bu13jwoob4,944
|
50
|
+
ominfra/manage/remote/spawning.py,sha256=6JLs_IsMjNQr6i8vROUjHsqmNFno1Ykh3oBXOOHBFYY,2614
|
37
51
|
ominfra/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
38
|
-
ominfra/scripts/journald2aws.py,sha256=
|
39
|
-
ominfra/scripts/manage.py,sha256=
|
40
|
-
ominfra/scripts/supervisor.py,sha256=
|
52
|
+
ominfra/scripts/journald2aws.py,sha256=s_ratu1H5K76uM0sx0gMX1Y8pSDO29YqW6x5UrV8jTI,135495
|
53
|
+
ominfra/scripts/manage.py,sha256=MBbHy36U41eF0MXaPQhk4xAu7ErhB29XqHUd3TiCujo,91910
|
54
|
+
ominfra/scripts/supervisor.py,sha256=OTBihWooI6yRzY-kw20vMBqZmrKMKfZkVUcwd_xZ7ZM,249541
|
41
55
|
ominfra/supervisor/LICENSE.txt,sha256=yvqaMNsDhWxziHa9ien6qCW1SkZv-DQlAg96XjfSee8,1746
|
42
56
|
ominfra/supervisor/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
|
43
57
|
ominfra/supervisor/__main__.py,sha256=I0yFw-C08OOiZ3BF6lF1Oiv789EQXu-_j6whDhQUTEA,66
|
@@ -49,7 +63,7 @@ ominfra/supervisor/exceptions.py,sha256=Qbu211H3CLlSmi9LsSikOwrcL5HgJP9ugvcKWlGT
|
|
49
63
|
ominfra/supervisor/groups.py,sha256=MBbsbt8Zh_WEYkGOr1KXa82gnPVw9wPB2lAnqhugXSc,2457
|
50
64
|
ominfra/supervisor/groupsimpl.py,sha256=nIrW4SmB0W6c2jOR_HhkfVcH4eHyLZnG1FJ0MCzc6mQ,2292
|
51
65
|
ominfra/supervisor/http.py,sha256=VqE3Q-5nJavMEZJ_MrDsmZmlmJ2mu_rlnyj9gN4hRVI,3473
|
52
|
-
ominfra/supervisor/inject.py,sha256=
|
66
|
+
ominfra/supervisor/inject.py,sha256=NtxlJvRANXFRt0pQZ9RS34dyNxY1Xkx7MTL_9N3YXL4,4701
|
53
67
|
ominfra/supervisor/io.py,sha256=_G66luJDF-i1JPM-qJiREMdmHk2ul7n-kjr7ex1sF6s,3200
|
54
68
|
ominfra/supervisor/main.py,sha256=oqaWOcnHJgaxNhjyphPgjaNjHPjDcx7kzYMjtZpwSxE,4253
|
55
69
|
ominfra/supervisor/pipes.py,sha256=2ZihNTnRNjnIPOtPbm3_pyqO15f7BNs7WnNtO5V8ahM,2231
|
@@ -79,9 +93,9 @@ ominfra/tailscale/api.py,sha256=C5-t_b6jZXUWcy5k8bXm7CFnk73pSdrlMOgGDeGVrpw,1370
|
|
79
93
|
ominfra/tailscale/cli.py,sha256=DSGp4hn5xwOW-l_u_InKlSF6kIobxtUtVssf_73STs0,3567
|
80
94
|
ominfra/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
81
95
|
ominfra/tools/listresources.py,sha256=4qVg5txsb10EHhvqXXeM6gJ2jx9LbroEnPydDv1uXs0,6176
|
82
|
-
ominfra-0.0.0.
|
83
|
-
ominfra-0.0.0.
|
84
|
-
ominfra-0.0.0.
|
85
|
-
ominfra-0.0.0.
|
86
|
-
ominfra-0.0.0.
|
87
|
-
ominfra-0.0.0.
|
96
|
+
ominfra-0.0.0.dev143.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
97
|
+
ominfra-0.0.0.dev143.dist-info/METADATA,sha256=vVDKCPEuzI6_WxcN4JdrbYNDZNNwxJqKReQWW8Z868A,731
|
98
|
+
ominfra-0.0.0.dev143.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
99
|
+
ominfra-0.0.0.dev143.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
|
100
|
+
ominfra-0.0.0.dev143.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
|
101
|
+
ominfra-0.0.0.dev143.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|