wizata-dsapi 1.3.55__tar.gz → 1.4.0.dev5__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.
- {wizata_dsapi-1.3.55/wizata_dsapi.egg-info → wizata_dsapi-1.4.0.dev5}/PKG-INFO +1 -1
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/__init__.py +2 -1
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/api_dto.py +15 -0
- wizata_dsapi-1.4.0.dev5/wizata_dsapi/execution_log.py +422 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/mlmodel.py +7 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/pipeline.py +4 -5
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/plot.py +4 -2
- wizata_dsapi-1.4.0.dev5/wizata_dsapi/version.py +1 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/wizata_dsapi_client.py +2 -1
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5/wizata_dsapi.egg-info}/PKG-INFO +1 -1
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi.egg-info/SOURCES.txt +1 -0
- wizata_dsapi-1.3.55/wizata_dsapi/version.py +0 -1
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/LICENSE.txt +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/README.rst +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/setup.cfg +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/setup.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/api_config.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/api_interface.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/bucket.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/business_label.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/context.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/dataframe_toolkit.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/datapoint.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/datastore.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/ds_dataframe.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/dsapi_json_encoder.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/evaluation.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/execution.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/experiment.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/group_system.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/ilogger.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/insight.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/model_toolkit.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/models/__init__.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/models/common.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/paged_query_result.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/pipeline_image.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/plots/__init__.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/plots/common.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/request.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/script.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/scripts/__init__.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/scripts/common.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/solution_component.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/streamlit_utils.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/template.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/trigger.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/twin.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/twinregistration.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/wizard_function.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/wizard_request.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi/words.py +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi.egg-info/dependency_links.txt +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi.egg-info/requires.txt +0 -0
- {wizata_dsapi-1.3.55 → wizata_dsapi-1.4.0.dev5}/wizata_dsapi.egg-info/top_level.txt +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# Api Entities (Dto)
|
|
2
2
|
from .version import __version__
|
|
3
|
-
from .api_dto import ApiDto, VarType, HAS_TORCH
|
|
3
|
+
from .api_dto import ApiDto, VarType, HAS_TORCH, Dto
|
|
4
4
|
from .paged_query_result import PagedQueryResult
|
|
5
5
|
from .plot import Plot
|
|
6
6
|
from .mlmodel import ModelInfo, ModelList, MLModelConfig, ModelFile, ModelIdentifierInfo
|
|
7
7
|
from .request import Request, filter_map, RequestGroup, RequestGroupMap, DynamicSelector
|
|
8
8
|
from .execution import Execution, ExecutionStatus, ExecutionStepLog, AbortedException
|
|
9
|
+
from .execution_log import ExecutionLog
|
|
9
10
|
from .experiment import Experiment
|
|
10
11
|
from .ds_dataframe import DSDataFrame
|
|
11
12
|
from .script import Script, ScriptConfig
|
|
@@ -36,7 +36,22 @@ class VarType(Enum):
|
|
|
36
36
|
JSON = "json"
|
|
37
37
|
|
|
38
38
|
|
|
39
|
+
class Dto:
|
|
40
|
+
"""
|
|
41
|
+
common definition of an entity.
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
@classmethod
|
|
45
|
+
def from_dict(cls, data: dict) -> "Dto":
|
|
46
|
+
pass
|
|
47
|
+
|
|
48
|
+
def to_dict(self) -> dict:
|
|
49
|
+
pass
|
|
50
|
+
|
|
39
51
|
class ApiDto:
|
|
52
|
+
"""
|
|
53
|
+
common definition of an entity used by backend.
|
|
54
|
+
"""
|
|
40
55
|
|
|
41
56
|
def api_id(self) -> str:
|
|
42
57
|
"""
|
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
from .api_dto import Dto
|
|
2
|
+
from .experiment import Experiment
|
|
3
|
+
from .pipeline import Pipeline
|
|
4
|
+
from .twin import Twin
|
|
5
|
+
from .template import Template
|
|
6
|
+
from .twinregistration import TwinRegistration
|
|
7
|
+
from .execution import ExecutionStatus
|
|
8
|
+
import uuid
|
|
9
|
+
import sys
|
|
10
|
+
import json
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ExecutionLog(Dto):
|
|
14
|
+
"""
|
|
15
|
+
execution log contains all information about a current execution.
|
|
16
|
+
- execution log replaces execution in version 11.4+
|
|
17
|
+
- as based on loki storage, some data are values and others are indexes/labels
|
|
18
|
+
- other properties are used only during execution time and are non-persistent
|
|
19
|
+
|
|
20
|
+
# labels
|
|
21
|
+
:ivar str experiment: short string key identifier of the experiment
|
|
22
|
+
:ivar str pipeline: short string key identifier of the pipeline
|
|
23
|
+
:ivar str template: short string key identifier of the template
|
|
24
|
+
:ivar str twin: short string key identifier of the twin
|
|
25
|
+
:ivar str edge_device_id: short string id of the IoT Edge Device
|
|
26
|
+
:ivar wizata_dsapi.ExecutionStatus status: execution status
|
|
27
|
+
|
|
28
|
+
# values
|
|
29
|
+
:ivar uuid.UUID id: technical id of execution
|
|
30
|
+
:ivar str pipeline_image_id: pipeline image identifier
|
|
31
|
+
:ivar int queued_date: timestamp on which execution is queued, if none use createdDate
|
|
32
|
+
:ivar int started_date: timestamp on which execution is started
|
|
33
|
+
:ivar int waiting_time: duration of the waiting time in the queue
|
|
34
|
+
:ivar int execution_time: duration of the execution from started
|
|
35
|
+
:ivar uuid.UUID trigger_id: technical id of trigger
|
|
36
|
+
:ivar version str: python version (major.minor) to use as target on runners, by default use current auto-detected version.
|
|
37
|
+
|
|
38
|
+
# non-persistent values
|
|
39
|
+
:ivar dict properties: properties containing key/value pairs used to parametrize the pipeline execution
|
|
40
|
+
:ivar list warnings: list of error and/or warning messages
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
@classmethod
|
|
44
|
+
def from_dict(cls, data: dict) -> "ExecutionLog":
|
|
45
|
+
|
|
46
|
+
# un-pack properties if they are jsonify
|
|
47
|
+
properties = data.get("properties")
|
|
48
|
+
if isinstance(properties, str):
|
|
49
|
+
properties = json.loads(properties)
|
|
50
|
+
|
|
51
|
+
return cls(
|
|
52
|
+
execution_id=uuid.UUID(data["id"]) if "id" in data else None,
|
|
53
|
+
experiment=data.get("experiment"),
|
|
54
|
+
pipeline=data.get("pipeline") if "pipeline" in data else uuid.UUID(data.get("pipelineId")) if "pipelineId" in data else None,
|
|
55
|
+
template=data.get("template") if "template" in data else uuid.UUID(data.get("templateId")) if "templateId" in data else None,
|
|
56
|
+
twin=data.get("twin") if "twin" in data else uuid.UUID(data.get("twinId")) if "twinId" in data else None,
|
|
57
|
+
edge_device_id=data.get("edgeDeviceId"),
|
|
58
|
+
status=ExecutionStatus(str(data["status"])) if "status" in data else None,
|
|
59
|
+
pipeline_image_id=data.get("pipelineImageId"),
|
|
60
|
+
queued_date=int(data.get("queuedDate")) if "queuedDate" in data and data["queuedDate"] is not None else None,
|
|
61
|
+
started_date=int(data.get("startedDate")) if "startedDate" in data and data["startedDate"] is not None else None,
|
|
62
|
+
waiting_time=int(data.get("waitingTime")) if "waitingTime" in data and data["waitingTime"] is not None else None,
|
|
63
|
+
execution_time=int(data.get("executionTime")) if "executionTime" in data and data["executionTime"] is not None else None,
|
|
64
|
+
trigger_id=uuid.UUID(data["executionTriggerId"]) if "executionTriggerId" in data and data["executionTriggerId"] is not None else None,
|
|
65
|
+
version=data.get("version"),
|
|
66
|
+
properties=properties
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
def __init__(self,
|
|
70
|
+
execution_id: uuid.UUID = None,
|
|
71
|
+
experiment: str|uuid.UUID|Experiment = None,
|
|
72
|
+
pipeline: str|uuid.UUID|Pipeline = None,
|
|
73
|
+
twin: str|uuid.UUID|Twin = None,
|
|
74
|
+
template: str|uuid.UUID|Template = None,
|
|
75
|
+
registration: uuid.UUID|TwinRegistration = None,
|
|
76
|
+
edge_device_id: str = None,
|
|
77
|
+
status: ExecutionStatus = None,
|
|
78
|
+
pipeline_image_id: str = None,
|
|
79
|
+
queued_date: int = None,
|
|
80
|
+
started_date: int = None,
|
|
81
|
+
waiting_time: int = None,
|
|
82
|
+
execution_time: int = None,
|
|
83
|
+
trigger_id: uuid.UUID = None,
|
|
84
|
+
version: str = None,
|
|
85
|
+
properties: dict = None):
|
|
86
|
+
|
|
87
|
+
# labels
|
|
88
|
+
self._experiment = None
|
|
89
|
+
self._experiment_id = None
|
|
90
|
+
self._experiment_key = None
|
|
91
|
+
self.experiment = experiment
|
|
92
|
+
|
|
93
|
+
self._pipeline = None
|
|
94
|
+
self._pipeline_id = None
|
|
95
|
+
self._pipeline_key = None
|
|
96
|
+
self.pipeline = pipeline
|
|
97
|
+
|
|
98
|
+
self._twin = None
|
|
99
|
+
self._twin_id = None
|
|
100
|
+
self._twin_key = None
|
|
101
|
+
self.twin = twin
|
|
102
|
+
|
|
103
|
+
self._template = None
|
|
104
|
+
self._template_id = None
|
|
105
|
+
self._template_key = None
|
|
106
|
+
self.template = template
|
|
107
|
+
|
|
108
|
+
self._registration = None
|
|
109
|
+
self._registration_id = None
|
|
110
|
+
self.registration = registration
|
|
111
|
+
|
|
112
|
+
self.edge_device_id = edge_device_id
|
|
113
|
+
self.status = status
|
|
114
|
+
|
|
115
|
+
# values
|
|
116
|
+
if execution_id is None:
|
|
117
|
+
execution_id = uuid.uuid4()
|
|
118
|
+
self.execution_id = execution_id
|
|
119
|
+
self.pipeline_image_id = pipeline_image_id
|
|
120
|
+
self.queued_date = queued_date
|
|
121
|
+
self.started_date = started_date
|
|
122
|
+
self.waiting_time = waiting_time
|
|
123
|
+
self.execution_time = execution_time
|
|
124
|
+
self.trigger_id = trigger_id
|
|
125
|
+
self.version = version
|
|
126
|
+
if version is None:
|
|
127
|
+
self.version = f'{sys.version_info.major}.{sys.version_info.minor}'
|
|
128
|
+
|
|
129
|
+
# non-persistent data
|
|
130
|
+
if properties is None:
|
|
131
|
+
properties = {}
|
|
132
|
+
self.properties = properties
|
|
133
|
+
self.models = []
|
|
134
|
+
self.plots = []
|
|
135
|
+
self.dataframes = []
|
|
136
|
+
self.messages = []
|
|
137
|
+
|
|
138
|
+
@property
|
|
139
|
+
def experiment(self):
|
|
140
|
+
"""
|
|
141
|
+
get experiment
|
|
142
|
+
:return: object or key or id
|
|
143
|
+
"""
|
|
144
|
+
if self._experiment is not None:
|
|
145
|
+
return self._experiment
|
|
146
|
+
if self._experiment_key is not None:
|
|
147
|
+
return self._experiment_key
|
|
148
|
+
return self._experiment_id
|
|
149
|
+
|
|
150
|
+
@experiment.setter
|
|
151
|
+
def experiment(self, value: str | uuid.UUID | Experiment | None):
|
|
152
|
+
"""
|
|
153
|
+
set experiment - accept key/uuid or a Experiment
|
|
154
|
+
"""
|
|
155
|
+
if value is None:
|
|
156
|
+
self._experiment = None
|
|
157
|
+
self._experiment_id = None
|
|
158
|
+
self._experiment_key = None
|
|
159
|
+
return
|
|
160
|
+
|
|
161
|
+
if isinstance(value, Experiment):
|
|
162
|
+
self._experiment = value
|
|
163
|
+
self._experiment_key = value.key
|
|
164
|
+
self._experiment_id = value.experiment_id
|
|
165
|
+
return
|
|
166
|
+
|
|
167
|
+
if isinstance(value, uuid.UUID):
|
|
168
|
+
self._experiment = None
|
|
169
|
+
self._experiment_id = value
|
|
170
|
+
return
|
|
171
|
+
|
|
172
|
+
if isinstance(value, str):
|
|
173
|
+
self._experiment = None
|
|
174
|
+
self._experiment_key = value
|
|
175
|
+
return
|
|
176
|
+
|
|
177
|
+
raise TypeError(f"Unsupported pipeline type: {type(value)}")
|
|
178
|
+
|
|
179
|
+
def get_experiment_id(self):
|
|
180
|
+
if self._experiment is not None:
|
|
181
|
+
return self._experiment.experiment_id
|
|
182
|
+
else:
|
|
183
|
+
return self._experiment_id
|
|
184
|
+
|
|
185
|
+
def get_experiment_key(self):
|
|
186
|
+
if self._experiment is not None:
|
|
187
|
+
return self._experiment.key
|
|
188
|
+
else:
|
|
189
|
+
return self._experiment_key
|
|
190
|
+
|
|
191
|
+
@property
|
|
192
|
+
def pipeline(self):
|
|
193
|
+
"""
|
|
194
|
+
get pipeline
|
|
195
|
+
:return: object or key or id
|
|
196
|
+
"""
|
|
197
|
+
if self._pipeline is not None:
|
|
198
|
+
return self._pipeline
|
|
199
|
+
if self._pipeline_key is not None:
|
|
200
|
+
return self._pipeline_key
|
|
201
|
+
return self._pipeline_id
|
|
202
|
+
|
|
203
|
+
@pipeline.setter
|
|
204
|
+
def pipeline(self, value: str | uuid.UUID | Pipeline | None):
|
|
205
|
+
"""
|
|
206
|
+
set pipeline - accept key/uuid or a Pipeline
|
|
207
|
+
"""
|
|
208
|
+
if value is None:
|
|
209
|
+
self._pipeline = None
|
|
210
|
+
self._pipeline_id = None
|
|
211
|
+
self._pipeline_key = None
|
|
212
|
+
return
|
|
213
|
+
|
|
214
|
+
if isinstance(value, Pipeline):
|
|
215
|
+
self._pipeline = value
|
|
216
|
+
self._pipeline_key = value.key
|
|
217
|
+
self._pipeline_id = value.pipeline_id
|
|
218
|
+
return
|
|
219
|
+
|
|
220
|
+
if isinstance(value, uuid.UUID):
|
|
221
|
+
self._pipeline = None
|
|
222
|
+
self._pipeline_id = value
|
|
223
|
+
return
|
|
224
|
+
|
|
225
|
+
if isinstance(value, str):
|
|
226
|
+
self._pipeline = None
|
|
227
|
+
self._pipeline_key = value
|
|
228
|
+
return
|
|
229
|
+
|
|
230
|
+
raise TypeError(f"Unsupported pipeline type: {type(value)}")
|
|
231
|
+
|
|
232
|
+
def get_pipeline_id(self):
|
|
233
|
+
if self._pipeline is not None:
|
|
234
|
+
return self._pipeline.pipeline_id
|
|
235
|
+
else:
|
|
236
|
+
return self._pipeline_id
|
|
237
|
+
|
|
238
|
+
def get_pipeline_key(self):
|
|
239
|
+
if self._pipeline is not None:
|
|
240
|
+
return self._pipeline.key
|
|
241
|
+
else:
|
|
242
|
+
return self._pipeline_key
|
|
243
|
+
|
|
244
|
+
@property
|
|
245
|
+
def twin(self):
|
|
246
|
+
"""
|
|
247
|
+
get twin
|
|
248
|
+
:return: object or key or id
|
|
249
|
+
"""
|
|
250
|
+
if self._twin is not None:
|
|
251
|
+
return self._twin
|
|
252
|
+
if self._twin_key is not None:
|
|
253
|
+
return self._twin_key
|
|
254
|
+
return self._twin_id
|
|
255
|
+
|
|
256
|
+
@twin.setter
|
|
257
|
+
def twin(self, value: str | uuid.UUID | Twin | None):
|
|
258
|
+
"""
|
|
259
|
+
set twin - accept key/uuid or a Twin
|
|
260
|
+
"""
|
|
261
|
+
if value is None:
|
|
262
|
+
self._twin = None
|
|
263
|
+
self._twin_id = None
|
|
264
|
+
self._twin_key = None
|
|
265
|
+
return
|
|
266
|
+
|
|
267
|
+
if isinstance(value, Twin):
|
|
268
|
+
self._twin = value
|
|
269
|
+
self._twin_key = value.hardware_id
|
|
270
|
+
self._twin_id = value.twin_id
|
|
271
|
+
return
|
|
272
|
+
|
|
273
|
+
if isinstance(value, uuid.UUID):
|
|
274
|
+
self._twin = None
|
|
275
|
+
self._twin_id = value
|
|
276
|
+
return
|
|
277
|
+
|
|
278
|
+
if isinstance(value, str):
|
|
279
|
+
self._twin = None
|
|
280
|
+
self._twin_key = value
|
|
281
|
+
return
|
|
282
|
+
|
|
283
|
+
raise TypeError(f"Unsupported twin type: {type(value)}")
|
|
284
|
+
|
|
285
|
+
def get_twin_id(self):
|
|
286
|
+
if self._twin is not None:
|
|
287
|
+
return self._twin.twin_id
|
|
288
|
+
else:
|
|
289
|
+
return self._twin_id
|
|
290
|
+
|
|
291
|
+
def get_twin_key(self):
|
|
292
|
+
if self._twin is not None:
|
|
293
|
+
return self._twin.hardware_id
|
|
294
|
+
else:
|
|
295
|
+
return self._twin_key
|
|
296
|
+
|
|
297
|
+
@property
|
|
298
|
+
def template(self):
|
|
299
|
+
"""
|
|
300
|
+
get template
|
|
301
|
+
:return: object or key or id
|
|
302
|
+
"""
|
|
303
|
+
if self._template is not None:
|
|
304
|
+
return self._template
|
|
305
|
+
if self._template_key is not None:
|
|
306
|
+
return self._template_key
|
|
307
|
+
return self._template_id
|
|
308
|
+
|
|
309
|
+
@template.setter
|
|
310
|
+
def template(self, value: str | uuid.UUID | Template | None):
|
|
311
|
+
"""
|
|
312
|
+
set template - accept key/uuid or a Template
|
|
313
|
+
"""
|
|
314
|
+
if value is None:
|
|
315
|
+
self._template = None
|
|
316
|
+
self._template_id = None
|
|
317
|
+
self._template_key = None
|
|
318
|
+
return
|
|
319
|
+
|
|
320
|
+
if isinstance(value, Template):
|
|
321
|
+
self._template = value
|
|
322
|
+
self._template_key = value.key
|
|
323
|
+
self._template_id = value.template_id
|
|
324
|
+
return
|
|
325
|
+
|
|
326
|
+
if isinstance(value, uuid.UUID):
|
|
327
|
+
self._template = None
|
|
328
|
+
self._template_id = value
|
|
329
|
+
return
|
|
330
|
+
|
|
331
|
+
if isinstance(value, str):
|
|
332
|
+
self._template = None
|
|
333
|
+
self._template_key = value
|
|
334
|
+
return
|
|
335
|
+
|
|
336
|
+
raise TypeError(f"unsupported template type: {type(value)}")
|
|
337
|
+
|
|
338
|
+
def get_template_id(self):
|
|
339
|
+
if self._template is not None:
|
|
340
|
+
return self._template.template_id
|
|
341
|
+
else:
|
|
342
|
+
return self._template_id
|
|
343
|
+
|
|
344
|
+
def get_template_key(self):
|
|
345
|
+
if self._template is not None:
|
|
346
|
+
return self._template.key
|
|
347
|
+
else:
|
|
348
|
+
return self._template_key
|
|
349
|
+
|
|
350
|
+
@property
|
|
351
|
+
def registration(self):
|
|
352
|
+
"""
|
|
353
|
+
get registration
|
|
354
|
+
:return: object or id
|
|
355
|
+
"""
|
|
356
|
+
if self._registration is not None:
|
|
357
|
+
return self._registration
|
|
358
|
+
return self._registration_id
|
|
359
|
+
|
|
360
|
+
@registration.setter
|
|
361
|
+
def registration(self, value: uuid.UUID | TwinRegistration | None):
|
|
362
|
+
"""
|
|
363
|
+
set template - accept uuid or a TwinRegistration
|
|
364
|
+
"""
|
|
365
|
+
if value is None:
|
|
366
|
+
self._registration = None
|
|
367
|
+
self._registration_id = None
|
|
368
|
+
return
|
|
369
|
+
|
|
370
|
+
if isinstance(value, TwinRegistration):
|
|
371
|
+
self._registration = value
|
|
372
|
+
self._registration_id = value.twin_registration_id
|
|
373
|
+
return
|
|
374
|
+
|
|
375
|
+
if isinstance(value, uuid.UUID):
|
|
376
|
+
self._registration = None
|
|
377
|
+
self._registration_id = value
|
|
378
|
+
return
|
|
379
|
+
|
|
380
|
+
raise TypeError(f"Unsupported registration type: {type(value)}")
|
|
381
|
+
|
|
382
|
+
def get_registration_id(self):
|
|
383
|
+
if self._registration is not None:
|
|
384
|
+
return self._registration.twin_registration_id
|
|
385
|
+
else:
|
|
386
|
+
return self._registration
|
|
387
|
+
|
|
388
|
+
def get_labels(self) -> dict:
|
|
389
|
+
labels = {
|
|
390
|
+
"experiment": self.get_experiment_key(),
|
|
391
|
+
"pipeline": self.get_pipeline_key(),
|
|
392
|
+
"template": self.get_template_key(),
|
|
393
|
+
"twin": self.get_twin_key(),
|
|
394
|
+
"edgeDeviceId": self.edge_device_id,
|
|
395
|
+
"status": self.status.value if self.status else None
|
|
396
|
+
}
|
|
397
|
+
return {k: v for k, v in labels.items() if v is not None}
|
|
398
|
+
|
|
399
|
+
def get_values(self) -> dict:
|
|
400
|
+
data = {
|
|
401
|
+
"id": str(self.execution_id) if self.execution_id else None,
|
|
402
|
+
"pipelineImageId": self.pipeline_image_id,
|
|
403
|
+
"queuedDate": self.queued_date,
|
|
404
|
+
"startedDate": self.started_date,
|
|
405
|
+
"waitingTime": self.waiting_time,
|
|
406
|
+
"executionTime": self.execution_time,
|
|
407
|
+
"executionTriggerId": str(self.trigger_id) if self.trigger_id else None,
|
|
408
|
+
"version": self.version,
|
|
409
|
+
"messages": self.messages or None
|
|
410
|
+
}
|
|
411
|
+
return {k: v for k, v in data.items() if v is not None}
|
|
412
|
+
|
|
413
|
+
def to_dict(self) -> dict:
|
|
414
|
+
"""
|
|
415
|
+
convert the log to a dictionary
|
|
416
|
+
- don't forget to drop properties if needed
|
|
417
|
+
:return: dict of the execution log
|
|
418
|
+
"""
|
|
419
|
+
non_values = {
|
|
420
|
+
"properties": self.properties or {}
|
|
421
|
+
}
|
|
422
|
+
return self.get_labels() | self.get_values() | non_values
|
|
@@ -456,6 +456,7 @@ class MLModelConfig(ApiDto):
|
|
|
456
456
|
output_columns_names: list = None,
|
|
457
457
|
output_prefix: str = None,
|
|
458
458
|
features: list = None,
|
|
459
|
+
features_from_file: str = None,
|
|
459
460
|
model_key: str = None,
|
|
460
461
|
model_type: str = None,
|
|
461
462
|
model_alias: str = None,
|
|
@@ -476,6 +477,7 @@ class MLModelConfig(ApiDto):
|
|
|
476
477
|
# features management
|
|
477
478
|
self.target_feat = target_feat
|
|
478
479
|
self.features = features
|
|
480
|
+
self.features_from_file = features_from_file
|
|
479
481
|
self.output_columns_names = output_columns_names
|
|
480
482
|
self.output_append = output_append
|
|
481
483
|
self.output_prefix = output_prefix
|
|
@@ -551,6 +553,9 @@ class MLModelConfig(ApiDto):
|
|
|
551
553
|
if "features" in obj.keys() and obj["features"] is not None:
|
|
552
554
|
self.features = obj["features"]
|
|
553
555
|
|
|
556
|
+
if "features_from_file" in obj.keys() and obj["features_from_file"] is not None:
|
|
557
|
+
self.features_from_file = obj["features_from_file"]
|
|
558
|
+
|
|
554
559
|
# output management
|
|
555
560
|
if "output_append" in obj.keys():
|
|
556
561
|
self.output_append = get_bool(obj, name="output_append")
|
|
@@ -610,6 +615,8 @@ class MLModelConfig(ApiDto):
|
|
|
610
615
|
obj["train_test_split_type"] = str(self.train_test_split_type)
|
|
611
616
|
if self.features is not None:
|
|
612
617
|
obj["features"] = self.features
|
|
618
|
+
if self.features_from_file is not None:
|
|
619
|
+
obj["features_from_file"] = self.features_from_file
|
|
613
620
|
if self.properties_mapping is not None and isinstance(self.properties_mapping, dict):
|
|
614
621
|
obj["properties_mapping"] = self.properties_mapping
|
|
615
622
|
|
|
@@ -840,17 +840,16 @@ class Pipeline(ApiDto):
|
|
|
840
840
|
if "twins" in obj and len(obj["twins"]) == 1:
|
|
841
841
|
twin_data = obj["twins"][0]
|
|
842
842
|
twin_objects = {}
|
|
843
|
-
|
|
843
|
+
twin_key = None
|
|
844
844
|
if "twin" in twin_data and twin_data["twin"] is not None:
|
|
845
845
|
twin_objects["twin"] = Twin()
|
|
846
846
|
twin_objects["twin"].from_json(twin_data["twin"])
|
|
847
|
-
|
|
847
|
+
twin_key = twin_objects["twin"].hardware_id
|
|
848
848
|
if "twinRegistration" in twin_data and twin_data["twinRegistration"] is not None:
|
|
849
849
|
twin_objects["registration"] = TwinRegistration()
|
|
850
850
|
twin_objects["registration"].from_json(twin_data["twinRegistration"])
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
self.twins[str(twin_id)] = twin_objects
|
|
851
|
+
if twin_key is not None:
|
|
852
|
+
self.twins[twin_key] = twin_objects
|
|
854
853
|
if "template" in obj:
|
|
855
854
|
self.template = Template()
|
|
856
855
|
self.template.from_json(obj["template"])
|
|
@@ -57,7 +57,7 @@ class Plot(ApiDto):
|
|
|
57
57
|
if "figure" in obj.keys():
|
|
58
58
|
self.figure = obj["figure"]
|
|
59
59
|
if "generatedById" in obj.keys():
|
|
60
|
-
self.generatedById =
|
|
60
|
+
self.generatedById = uuid.UUID(obj["generatedById"])
|
|
61
61
|
|
|
62
62
|
def to_json(self, target: str = None):
|
|
63
63
|
"""
|
|
@@ -73,5 +73,7 @@ class Plot(ApiDto):
|
|
|
73
73
|
if self.figure is not None:
|
|
74
74
|
obj["figure"] = self.figure
|
|
75
75
|
if self.generatedById is not None:
|
|
76
|
-
|
|
76
|
+
#TODO: add generateById as UUID or find another way to store plots
|
|
77
|
+
#obj["generatedById"] = str(self.generatedById)
|
|
78
|
+
pass
|
|
77
79
|
return obj
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.4.0.dev5"
|
|
@@ -897,9 +897,10 @@ class WizataDSAPIClient(ApiInterface, ApiDtoInterface):
|
|
|
897
897
|
|
|
898
898
|
# Execute
|
|
899
899
|
if isinstance(execution, Execution):
|
|
900
|
+
dict_tmp = execution.to_json()
|
|
900
901
|
response = requests.post(f"{self.__url()}execute/?mode={mode}",
|
|
901
902
|
headers=self.__header(),
|
|
902
|
-
data=json.dumps(
|
|
903
|
+
data=json.dumps(dict_tmp, cls=DSAPIEncoder))
|
|
903
904
|
|
|
904
905
|
# Parse
|
|
905
906
|
if response.status_code == 200:
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.3.55"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|