wizata-dsapi 1.3.31__py3-none-any.whl → 1.3.33__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.
wizata_dsapi/__init__.py CHANGED
@@ -3,7 +3,7 @@ from .version import __version__
3
3
  from .api_dto import ApiDto, VarType
4
4
  from .paged_query_result import PagedQueryResult
5
5
  from .plot import Plot
6
- from .mlmodel import ModelInfo, ModelList, MLModelConfig, ModelFile
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
9
  from .experiment import Experiment
wizata_dsapi/mlmodel.py CHANGED
@@ -11,6 +11,27 @@ def get_bool(obj, name: str):
11
11
  return bool(obj[name])
12
12
 
13
13
 
14
+ class ModelIdentifierInfo:
15
+ """
16
+ define metadata associated to an identifier (regardless of its alias)
17
+ """
18
+
19
+ def __init__(self,
20
+ identifier: str = None,
21
+ active_alias: str = None):
22
+ self.identifier = identifier
23
+ self.active_alias = active_alias
24
+
25
+ def to_json(self):
26
+ obj = {}
27
+ if self.active_alias is not None:
28
+ obj["active_alias"] = self.active_alias
29
+ return obj
30
+
31
+ def from_json(self, json_dict):
32
+ if "active_alias" in json_dict:
33
+ self.active_alias = json_dict["active_alias"]
34
+
14
35
  class ModelFile:
15
36
  """
16
37
  define a model file.
@@ -95,6 +116,7 @@ class ModelInfo:
95
116
  self.source = source
96
117
  self.model_type = model_type
97
118
  self.files = []
119
+ self.is_active = False
98
120
 
99
121
  # files attached to model when loaded
100
122
  self.trained_model = None
@@ -166,7 +188,7 @@ class ModelInfo:
166
188
  self.file_format = file.extension
167
189
  self.files.append(file)
168
190
 
169
- def to_json(self):
191
+ def to_json(self) -> dict:
170
192
  """
171
193
  convert this entity in a dict that can be json serializable
172
194
  :return: dict
@@ -190,8 +212,12 @@ class ModelInfo:
190
212
  obj["source"] = self.source
191
213
  if self.property_name is not None:
192
214
  obj["property_name"] = self.property_name
215
+ if self.is_active is not None:
216
+ obj["is_active"] = self.is_active
193
217
  if self.identifier is not None:
194
218
  obj["identifier"] = self.identifier(include_alias=True)
219
+ if len(self.files) > 0:
220
+ obj["files"] = [file.to_json() for file in self.files]
195
221
  return obj
196
222
 
197
223
  def from_json(self, obj):
@@ -214,6 +240,8 @@ class ModelInfo:
214
240
  self.source = obj["source"]
215
241
  if "property_name" in obj.keys():
216
242
  self.property_name = obj["property_name"]
243
+ if "is_active" in obj.keys():
244
+ self.is_active = get_bool(obj, name="is_active")
217
245
 
218
246
 
219
247
  class ModelList:
@@ -223,6 +251,7 @@ class ModelList:
223
251
 
224
252
  def __init__(self):
225
253
  self.models: List[ModelInfo] = []
254
+ self.identifiers_info = {}
226
255
 
227
256
  def __iter__(self) -> Iterator[ModelInfo]:
228
257
  return iter(self.models)
@@ -260,6 +289,19 @@ class ModelList:
260
289
  def append(self, model: ModelInfo):
261
290
  self.models.append(model)
262
291
 
292
+ def _process_info(self):
293
+ """
294
+ apply all info within the model list (setting model active, ...) to keep data coherence
295
+ :return:
296
+ """
297
+ for identifier in self.identifiers_info:
298
+ if self.identifiers_info[identifier].active_alias is not None:
299
+ for model in self.models:
300
+ if model.identifier(include_alias=False) == identifier and model.alias == self.identifiers_info[identifier].active_alias:
301
+ model.is_active = True
302
+ elif model.identifier(include_alias=False) == identifier:
303
+ model.is_active = False
304
+
263
305
 
264
306
  class MLModelConfig(ApiDto):
265
307
  """
wizata_dsapi/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.3.31"
1
+ __version__ = "1.3.33"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wizata_dsapi
3
- Version: 1.3.31
3
+ Version: 1.3.33
4
4
  Summary: Wizata Data Science Toolkit
5
5
  Author: Wizata S.A.
6
6
  Author-email: info@wizata.com
@@ -1,4 +1,4 @@
1
- wizata_dsapi/__init__.py,sha256=ve3fgTqcr4gb6n0HyZ-IcZ5XCIYBmoSyU26uUMglxnY,2051
1
+ wizata_dsapi/__init__.py,sha256=aVeizk2zzmAX0TLNG9o7vcmG8KB73XiXw1_qozrJN2w,2072
2
2
  wizata_dsapi/api_config.py,sha256=6Pnnv62X_QrTUXaa1MtFZeQaqMUJC-9Y5BW7B4gef10,5139
3
3
  wizata_dsapi/api_dto.py,sha256=-NdaTRvw5jW5xFGpIhY8U0-SdvzW2t6QD26y0UPApU0,2238
4
4
  wizata_dsapi/api_interface.py,sha256=DURk-0ey16T8sV5e2Y2G_YybPEusJvZuY0oD5L7AnXo,10903
@@ -16,7 +16,7 @@ wizata_dsapi/experiment.py,sha256=QYQ1CJ-MTWsXq08xYbm5sAp95dRxbPOmGDgaAOoBMDQ,46
16
16
  wizata_dsapi/group_system.py,sha256=6rUKe0_J3YWACysyBlzuw_TEpKNXgLOMxhpWsNxOzwY,1708
17
17
  wizata_dsapi/ilogger.py,sha256=iYnID-Z-qrYhie26C43404aIuU4_tHSKXbDeQIdo82Q,807
18
18
  wizata_dsapi/insight.py,sha256=ABFZ04DqYxxzqAEfU1tzlTZqqrigM-zN-8Lbetko3g0,6468
19
- wizata_dsapi/mlmodel.py,sha256=Sw-XFAylm_-yaFVd-9O3t-fp5yrv88zQ7iwOCTdWOKo,19911
19
+ wizata_dsapi/mlmodel.py,sha256=iIAqLVvzZS5lHrZ2UH68NvZZbOYX_zdqORAukOc4pVI,21510
20
20
  wizata_dsapi/model_toolkit.py,sha256=UNyw5CFSgZeXydQFsiDIRTjoMeqIsdyIIuiwumLW5bA,1574
21
21
  wizata_dsapi/paged_query_result.py,sha256=0Iyt2Kd4tvrfthhT-tk9EmSERsbJTaPNON2euHcBn6k,1150
22
22
  wizata_dsapi/pipeline.py,sha256=WDJeOxPZJiYW1qwTNZUm3jom2epIxqrSoiUwcrTF9EE,31300
@@ -31,7 +31,7 @@ wizata_dsapi/template.py,sha256=wtCRKKk3PchH4RrNgNYlEF_9C6bzZwKIeLyEvgv6Fdo,1370
31
31
  wizata_dsapi/trigger.py,sha256=w3BZYP-L3SUwvaT0oCTanh_Ewn57peZvlt7vxzHv9J8,5129
32
32
  wizata_dsapi/twin.py,sha256=S0DUzQf1smZXZTdXpXZPtkZYCfKIhw53EecCnsl9i4Q,11017
33
33
  wizata_dsapi/twinregistration.py,sha256=Mi6-YuwroiEXc0c1hgrOaphh4hNVoHupxOnXedVtJtE,13377
34
- wizata_dsapi/version.py,sha256=03CTYGRsPAEz4rNlV1y3u7w7Yn_JkEBWznFFhvFaPrM,23
34
+ wizata_dsapi/version.py,sha256=mlgNKimyRDi_WrDBCrvzFuEZsuPR-NBnjRrGSYC_1v4,23
35
35
  wizata_dsapi/wizard_function.py,sha256=RbM7W7Gf-6Rhp_1dU9DBYkHaciknGAGvuAndhAS_vyo,942
36
36
  wizata_dsapi/wizard_request.py,sha256=v6BaqKLKvTWmUSo0_gda9FabAQz5x_-GOH1Av50GzFo,3762
37
37
  wizata_dsapi/wizata_dsapi_client.py,sha256=h8iSz7IGbP-Zq9rbqMdq-hTrt16laD1JeaRWPzaLaoo,77695
@@ -42,8 +42,8 @@ wizata_dsapi/plots/__init__.py,sha256=qgnSFqrjOPur-807M8uh5awIfjM1ZHXUXcAqHc-r2l
42
42
  wizata_dsapi/plots/common.py,sha256=jdPsJqLHBwSKc6dX83BSGPqSRxzIVNHSYO5yI_8sjGk,6568
43
43
  wizata_dsapi/scripts/__init__.py,sha256=hAxiETSQf0qOHde1si1tEAJU48seqEgHrchCzS2-LvQ,80
44
44
  wizata_dsapi/scripts/common.py,sha256=efwq-Rd0lvYljIs3gSFz9izogBD7asOU2cTK-IvHTkM,4244
45
- wizata_dsapi-1.3.31.dist-info/licenses/LICENSE.txt,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
46
- wizata_dsapi-1.3.31.dist-info/METADATA,sha256=ZPm_XrVGcmf21WFgcp6QUKuvcV8XXM1sYyr51sXvAbk,5844
47
- wizata_dsapi-1.3.31.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
48
- wizata_dsapi-1.3.31.dist-info/top_level.txt,sha256=-OeTJbEnh5DuWyTOHtvw0Dw3LRg3G27TNS6W4ZtfwPs,13
49
- wizata_dsapi-1.3.31.dist-info/RECORD,,
45
+ wizata_dsapi-1.3.33.dist-info/licenses/LICENSE.txt,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
46
+ wizata_dsapi-1.3.33.dist-info/METADATA,sha256=hSJF7gKKsGXz6hG7bcJWnreMtjjuYmBdcYA7X8nOyFY,5844
47
+ wizata_dsapi-1.3.33.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
48
+ wizata_dsapi-1.3.33.dist-info/top_level.txt,sha256=-OeTJbEnh5DuWyTOHtvw0Dw3LRg3G27TNS6W4ZtfwPs,13
49
+ wizata_dsapi-1.3.33.dist-info/RECORD,,