malevich-coretools 0.3.33__tar.gz → 0.3.34__tar.gz
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 malevich-coretools might be problematic. Click here for more details.
- {malevich_coretools-0.3.33/malevich_coretools.egg-info → malevich_coretools-0.3.34}/PKG-INFO +1 -1
- malevich_coretools-0.3.34/VERSION +1 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/abstract/__init__.py +1 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/abstract/abstract.py +1 -0
- malevich_coretools-0.3.34/malevich_coretools/abstract/operations.py +110 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/abstract/pipeline.py +49 -3
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/funcs/funcs.py +2 -2
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/utils.py +2 -2
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34/malevich_coretools.egg-info}/PKG-INFO +1 -1
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools.egg-info/SOURCES.txt +1 -0
- malevich_coretools-0.3.33/VERSION +0 -1
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/LICENSE +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/MANIFEST.in +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/README.md +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/__init__.py +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/abstract/statuses.py +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/admin/__init__.py +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/admin/utils.py +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/batch/__init__.py +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/batch/utils.py +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/funcs/__init__.py +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/funcs/checks.py +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/funcs/helpers.py +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/secondary/__init__.py +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/secondary/config.py +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/secondary/const.py +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/secondary/helpers.py +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/secondary/kafka_utils.py +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/tools/__init__.py +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/tools/abstract.py +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/tools/vast.py +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools.egg-info/dependency_links.txt +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools.egg-info/requires.txt +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools.egg-info/top_level.txt +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/pyproject.toml +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/requirements.txt +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/setup.cfg +0 -0
- {malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.3.34
|
{malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/abstract/abstract.py
RENAMED
|
@@ -456,6 +456,7 @@ class AppFunctionsInfo(BaseModel):
|
|
|
456
456
|
schemes: Dict[Alias.Id, str] = dict()
|
|
457
457
|
inits: Dict[Alias.Id, InitInfo] = dict()
|
|
458
458
|
logs: Optional[str] = None
|
|
459
|
+
version: Optional[str] = None
|
|
459
460
|
instanceInfo: Optional[str] = None # json with info about instance
|
|
460
461
|
|
|
461
462
|
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import Optional, Union
|
|
3
|
+
|
|
4
|
+
from pydantic import BaseModel
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class InternalBoolOp(ABC, BaseModel):
|
|
8
|
+
pass
|
|
9
|
+
|
|
10
|
+
@abstractmethod
|
|
11
|
+
def simplify(self) -> 'BoolOp':
|
|
12
|
+
pass
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class BoolOp(ABC, BaseModel):
|
|
16
|
+
pass
|
|
17
|
+
|
|
18
|
+
@abstractmethod
|
|
19
|
+
def internal(self) -> InternalBoolOp:
|
|
20
|
+
pass
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class Value(BaseModel):
|
|
24
|
+
bindId: str
|
|
25
|
+
result: bool
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class BoolOpOrValue(BaseModel):
|
|
29
|
+
# set only one of them
|
|
30
|
+
op: Optional[Union['InternalNot', 'InternalAnd', 'InternalOr']] = None
|
|
31
|
+
value: Optional[Value] = None
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class InternalNot(InternalBoolOp):
|
|
35
|
+
notOp: BoolOpOrValue
|
|
36
|
+
|
|
37
|
+
def simplify(self) -> 'BoolOp':
|
|
38
|
+
return Not(op=value if (value := self.notOp.value) is not None else self.notOp.op.simplify())
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class Not(BoolOp):
|
|
42
|
+
op: Union[BoolOp, Value]
|
|
43
|
+
|
|
44
|
+
def internal(self) -> InternalBoolOp:
|
|
45
|
+
if isinstance(self.op, BoolOp):
|
|
46
|
+
internal_op = BoolOpOrValue(op=self.op.internal())
|
|
47
|
+
else:
|
|
48
|
+
internal_op = BoolOpOrValue(value=self.op)
|
|
49
|
+
return InternalNot(notOp=internal_op)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class InternalAnd(InternalBoolOp):
|
|
53
|
+
andOp: BoolOpOrValue
|
|
54
|
+
andOp2: BoolOpOrValue
|
|
55
|
+
|
|
56
|
+
def simplify(self) -> 'BoolOp':
|
|
57
|
+
return And(
|
|
58
|
+
op=value if (value := self.andOp.value) is not None else self.andOp.op.simplify(),
|
|
59
|
+
op2=value if (value := self.andOp2.value) is not None else self.andOp2.op.simplify()
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class And(BoolOp):
|
|
64
|
+
op: Union[BoolOp, Value]
|
|
65
|
+
op2: Union[BoolOp, Value]
|
|
66
|
+
|
|
67
|
+
def internal(self) -> InternalBoolOp:
|
|
68
|
+
if isinstance(self.op, BoolOp):
|
|
69
|
+
internal_op = BoolOpOrValue(op=self.op.internal())
|
|
70
|
+
else:
|
|
71
|
+
internal_op = BoolOpOrValue(value=self.op)
|
|
72
|
+
|
|
73
|
+
if isinstance(self.op2, BoolOp):
|
|
74
|
+
internal_op2 = BoolOpOrValue(op=self.op2.internal())
|
|
75
|
+
else:
|
|
76
|
+
internal_op2 = BoolOpOrValue(value=self.op2)
|
|
77
|
+
return InternalAnd(andOp=internal_op, andOp2=internal_op2)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class InternalOr(InternalBoolOp):
|
|
81
|
+
orOp: BoolOpOrValue
|
|
82
|
+
orOp2: BoolOpOrValue
|
|
83
|
+
|
|
84
|
+
def simplify(self) -> 'BoolOp':
|
|
85
|
+
return Or(
|
|
86
|
+
op=value if (value := self.orOp.value) is not None else self.orOp.op.simplify(),
|
|
87
|
+
op2=value if (value := self.orOp2.value) is not None else self.orOp2.op.simplify()
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class Or(BoolOp):
|
|
92
|
+
op: Union[BoolOp, Value]
|
|
93
|
+
op2: Union[BoolOp, Value]
|
|
94
|
+
|
|
95
|
+
def internal(self) -> InternalBoolOp:
|
|
96
|
+
if isinstance(self.op, BoolOp):
|
|
97
|
+
internal_op = BoolOpOrValue(op=self.op.internal())
|
|
98
|
+
else:
|
|
99
|
+
internal_op = BoolOpOrValue(value=self.op)
|
|
100
|
+
|
|
101
|
+
if isinstance(self.op2, BoolOp):
|
|
102
|
+
internal_op2 = BoolOpOrValue(op=self.op2.internal())
|
|
103
|
+
else:
|
|
104
|
+
internal_op2 = BoolOpOrValue(value=self.op2)
|
|
105
|
+
return InternalOr(orOp=internal_op, orOp2=internal_op2)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def operations_test() -> None:
|
|
109
|
+
op = And(op=Or(op=Not(op=Value(bindId="cond", result=True)), op2=Value(bindId="cond2", result=False)), op2=Value(bindId="proc"))
|
|
110
|
+
assert op == op.internal().simplify(), "fail: operations"
|
{malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/abstract/pipeline.py
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from enum import IntEnum
|
|
2
|
-
from typing import Dict, List, Optional
|
|
2
|
+
from typing import Dict, List, Optional, Union
|
|
3
3
|
|
|
4
4
|
from pydantic import BaseModel
|
|
5
5
|
|
|
@@ -13,6 +13,17 @@ from malevich_coretools.abstract.abstract import ( # noqa: F401
|
|
|
13
13
|
TaskComponent,
|
|
14
14
|
TaskPolicy,
|
|
15
15
|
)
|
|
16
|
+
from malevich_coretools.abstract.operations import (
|
|
17
|
+
And,
|
|
18
|
+
BoolOp,
|
|
19
|
+
InternalAnd,
|
|
20
|
+
InternalBoolOp,
|
|
21
|
+
InternalNot,
|
|
22
|
+
InternalOr,
|
|
23
|
+
Not,
|
|
24
|
+
Or,
|
|
25
|
+
Value,
|
|
26
|
+
)
|
|
16
27
|
|
|
17
28
|
|
|
18
29
|
class PullCollectionPolicy(IntEnum):
|
|
@@ -71,15 +82,36 @@ class AlternativeArgument(BaseArgument):
|
|
|
71
82
|
class AppEntity(BaseModel):
|
|
72
83
|
cfg: Optional[str] = None # local cfg for processor/condition
|
|
73
84
|
arguments: Dict[str, AlternativeArgument] = {} # TODO or List[Argument]?
|
|
74
|
-
conditions: Optional[Dict[str, bool]] = None
|
|
85
|
+
conditions: Optional[Union[Dict[str, bool], List[Dict[str, bool]]]] = None # condition bindId to it result (list - any variant of them)
|
|
86
|
+
conditionsStructure: Optional[Union[Not, And, Or, InternalNot, InternalAnd, InternalOr, Value]] = None # set BoolOp, it transform to internal before send
|
|
75
87
|
|
|
76
88
|
loopArguments: Optional[Dict[str, AlternativeArgument]] = None # other calls, TODO or List[Argument]?, problems
|
|
77
|
-
loopConditions: Optional[Dict[str, bool]] = None
|
|
89
|
+
loopConditions: Optional[Union[Dict[str, bool], List[Dict[str, bool]]]] = None # condition bindId to it result for loop (list - any variant of them)
|
|
90
|
+
loopConditionsStructure: Optional[Union[Not, And, Or, InternalNot, InternalAnd, InternalOr, Value]] = None # set BoolOp, it transform to internal before send
|
|
78
91
|
|
|
79
92
|
image: JsonImage
|
|
80
93
|
platform: str = "base"
|
|
81
94
|
platformSettings: Optional[str] = None
|
|
82
95
|
|
|
96
|
+
def internal(self) -> None:
|
|
97
|
+
assert self.conditions is None or self.conditionsStructure is None, "should be set not more, than one of (conditions, conditionsStructure)"
|
|
98
|
+
assert self.loopConditions is None or self.loopConditionsStructure is None, "should be set not more, than one of (loopConditions, loopConditionsStructure)"
|
|
99
|
+
|
|
100
|
+
if isinstance(self.conditions, Dict):
|
|
101
|
+
self.conditions = [self.conditions]
|
|
102
|
+
if isinstance(self.conditionsStructure, BoolOp):
|
|
103
|
+
self.conditionsStructure = self.conditionsStructure.internal()
|
|
104
|
+
if isinstance(self.loopConditions, Dict):
|
|
105
|
+
self.loopConditions = [self.loopConditions]
|
|
106
|
+
if isinstance(self.loopConditionsStructure, BoolOp):
|
|
107
|
+
self.loopConditionsStructure = self.loopConditionsStructure.internal()
|
|
108
|
+
|
|
109
|
+
def simplify(self) -> None:
|
|
110
|
+
if isinstance(self.conditionsStructure, InternalBoolOp):
|
|
111
|
+
self.conditionsStructure = self.conditionsStructure.simplify()
|
|
112
|
+
if isinstance(self.loopConditionsStructure, InternalBoolOp):
|
|
113
|
+
self.loopConditionsStructure = self.loopConditionsStructure.simplify()
|
|
114
|
+
|
|
83
115
|
|
|
84
116
|
class Processor(AppEntity):
|
|
85
117
|
processorId: str
|
|
@@ -102,6 +134,20 @@ class Pipeline(BaseModel):
|
|
|
102
134
|
results: Dict[str, List[Result]] = {} # bindProcessorId to results
|
|
103
135
|
pullCollectionPolicy: PullCollectionPolicy = PullCollectionPolicy.IF_NOT_EXIST
|
|
104
136
|
|
|
137
|
+
def internal(self) -> 'Pipeline':
|
|
138
|
+
for proc in self.processors.values():
|
|
139
|
+
proc.internal()
|
|
140
|
+
for cond in self.conditions.values():
|
|
141
|
+
cond.internal()
|
|
142
|
+
return self
|
|
143
|
+
|
|
144
|
+
def simplify(self) -> 'Pipeline':
|
|
145
|
+
for proc in self.processors.values():
|
|
146
|
+
proc.simplify()
|
|
147
|
+
for cond in self.conditions.values():
|
|
148
|
+
cond.simplify()
|
|
149
|
+
return self
|
|
150
|
+
|
|
105
151
|
|
|
106
152
|
class MainPipelineCfg(BaseModel):
|
|
107
153
|
operationId: Alias.Id
|
|
@@ -483,11 +483,11 @@ def get_userPipelines_mapId(id: str, *args, **kwargs) -> Alias.Id:
|
|
|
483
483
|
|
|
484
484
|
|
|
485
485
|
def get_userPipelines_id(id: str, *args, **kwargs) -> Pipeline:
|
|
486
|
-
return model_from_json(send_to_core_get(USER_PIPELINES_ID(id, None), *args, **kwargs), Pipeline)
|
|
486
|
+
return model_from_json(send_to_core_get(USER_PIPELINES_ID(id, None), *args, **kwargs), Pipeline).simplify()
|
|
487
487
|
|
|
488
488
|
|
|
489
489
|
def get_userPipelines_realId(id: str, *args, **kwargs) -> Pipeline:
|
|
490
|
-
return model_from_json(send_to_core_get(USER_PIPELINES_REAL_ID(id), *args, **kwargs), Pipeline)
|
|
490
|
+
return model_from_json(send_to_core_get(USER_PIPELINES_REAL_ID(id), *args, **kwargs), Pipeline).simplify()
|
|
491
491
|
|
|
492
492
|
|
|
493
493
|
def post_userPipelines(data: UserTask, wait: bool, *args, **kwargs) -> Alias.Id:
|
|
@@ -2057,7 +2057,7 @@ def create_pipeline(
|
|
|
2057
2057
|
conditions=conditions,
|
|
2058
2058
|
results=results,
|
|
2059
2059
|
pullCollectionPolicy=pull_collection_policy,
|
|
2060
|
-
)
|
|
2060
|
+
).internal()
|
|
2061
2061
|
if batcher is not None:
|
|
2062
2062
|
return batcher.add("postPipeline", data=data)
|
|
2063
2063
|
return f.post_userPipelines(data, wait=wait, auth=auth, conn_url=conn_url)
|
|
@@ -2091,7 +2091,7 @@ def update_pipeline(
|
|
|
2091
2091
|
conditions=conditions,
|
|
2092
2092
|
results=results,
|
|
2093
2093
|
pullCollectionPolicy=pull_collection_policy,
|
|
2094
|
-
)
|
|
2094
|
+
).internal()
|
|
2095
2095
|
if batcher is not None:
|
|
2096
2096
|
return batcher.add("postPipelineById", data=data, vars={"id": id})
|
|
2097
2097
|
return f.post_userPipelines_id(id, data, wait=wait, auth=auth, conn_url=conn_url)
|
{malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools.egg-info/SOURCES.txt
RENAMED
|
@@ -14,6 +14,7 @@ malevich_coretools.egg-info/requires.txt
|
|
|
14
14
|
malevich_coretools.egg-info/top_level.txt
|
|
15
15
|
malevich_coretools/abstract/__init__.py
|
|
16
16
|
malevich_coretools/abstract/abstract.py
|
|
17
|
+
malevich_coretools/abstract/operations.py
|
|
17
18
|
malevich_coretools/abstract/pipeline.py
|
|
18
19
|
malevich_coretools/abstract/statuses.py
|
|
19
20
|
malevich_coretools/admin/__init__.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.3.33
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/abstract/statuses.py
RENAMED
|
File without changes
|
{malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/admin/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/batch/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/funcs/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/secondary/__init__.py
RENAMED
|
File without changes
|
{malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/secondary/config.py
RENAMED
|
File without changes
|
{malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/secondary/const.py
RENAMED
|
File without changes
|
{malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/secondary/helpers.py
RENAMED
|
File without changes
|
{malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/secondary/kafka_utils.py
RENAMED
|
File without changes
|
{malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/tools/__init__.py
RENAMED
|
File without changes
|
{malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools/tools/abstract.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools.egg-info/requires.txt
RENAMED
|
File without changes
|
{malevich_coretools-0.3.33 → malevich_coretools-0.3.34}/malevich_coretools.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|