wizata-dsapi 1.3.34__tar.gz → 1.3.36__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.34 → wizata_dsapi-1.3.36}/PKG-INFO +1 -1
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/mlmodel.py +26 -11
- wizata_dsapi-1.3.36/wizata_dsapi/version.py +1 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/wizata_dsapi_client.py +41 -49
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi.egg-info/PKG-INFO +1 -1
- wizata_dsapi-1.3.34/wizata_dsapi/version.py +0 -1
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/LICENSE.txt +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/README.rst +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/setup.cfg +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/setup.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/__init__.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/api_config.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/api_dto.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/api_interface.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/bucket.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/business_label.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/context.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/dataframe_toolkit.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/datapoint.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/datastore.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/ds_dataframe.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/dsapi_json_encoder.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/evaluation.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/execution.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/experiment.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/group_system.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/ilogger.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/insight.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/model_toolkit.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/models/__init__.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/models/common.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/paged_query_result.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/pipeline.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/pipeline_image.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/plot.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/plots/__init__.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/plots/common.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/request.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/script.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/scripts/__init__.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/scripts/common.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/solution_component.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/streamlit_utils.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/template.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/trigger.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/twin.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/twinregistration.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/wizard_function.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/wizard_request.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi/words.py +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi.egg-info/SOURCES.txt +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi.egg-info/dependency_links.txt +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi.egg-info/requires.txt +0 -0
- {wizata_dsapi-1.3.34 → wizata_dsapi-1.3.36}/wizata_dsapi.egg-info/top_level.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import List, Iterator, Union
|
|
1
|
+
from typing import List, Iterator, Union, Optional
|
|
2
2
|
import os
|
|
3
3
|
from .api_dto import ApiDto
|
|
4
4
|
from datetime import datetime, timezone
|
|
@@ -49,13 +49,32 @@ class ModelFile:
|
|
|
49
49
|
size: int = None,
|
|
50
50
|
content = None):
|
|
51
51
|
self.full_path = full_path
|
|
52
|
-
self.path = path
|
|
53
52
|
self.name = name
|
|
54
53
|
self.extension = extension
|
|
54
|
+
self.path = path
|
|
55
55
|
self.last_modified = last_modified
|
|
56
56
|
self.size = size
|
|
57
57
|
self.content = content
|
|
58
58
|
|
|
59
|
+
|
|
60
|
+
@property
|
|
61
|
+
def path(self) -> Optional[str]:
|
|
62
|
+
if self.name and self.extension:
|
|
63
|
+
return f"{self.name}.{self.extension}"
|
|
64
|
+
return self.name or None
|
|
65
|
+
|
|
66
|
+
@path.setter
|
|
67
|
+
def path(self, value: Optional[str]):
|
|
68
|
+
if not value:
|
|
69
|
+
self.name = None
|
|
70
|
+
self.extension = None
|
|
71
|
+
return
|
|
72
|
+
|
|
73
|
+
base = os.path.basename(value.strip())
|
|
74
|
+
name_part, ext = os.path.splitext(base)
|
|
75
|
+
self.name = name_part or None
|
|
76
|
+
self.extension = ext.lstrip(".").lower() if ext else None
|
|
77
|
+
|
|
59
78
|
def to_json(self):
|
|
60
79
|
"""
|
|
61
80
|
convert this entity in a dict that can be json serializable
|
|
@@ -64,12 +83,12 @@ class ModelFile:
|
|
|
64
83
|
obj = {}
|
|
65
84
|
if self.full_path is not None:
|
|
66
85
|
obj["full_path"] = str(self.full_path)
|
|
67
|
-
if self.path is not None:
|
|
68
|
-
obj["path"] = self.path
|
|
69
86
|
if self.name is not None:
|
|
70
87
|
obj["name"] = self.name
|
|
71
88
|
if self.extension is not None:
|
|
72
89
|
obj["extension"] = self.extension
|
|
90
|
+
if self.path is not None:
|
|
91
|
+
obj["path"] = self.path
|
|
73
92
|
if self.last_modified is not None:
|
|
74
93
|
obj["last_modified"] = self.last_modified.timestamp() * 1000.0
|
|
75
94
|
if self.size is not None:
|
|
@@ -82,12 +101,12 @@ class ModelFile:
|
|
|
82
101
|
"""
|
|
83
102
|
if "full_path" in obj.keys():
|
|
84
103
|
self.full_path = obj["full_path"]
|
|
85
|
-
if "path" in obj.keys():
|
|
86
|
-
self.path = obj["path"]
|
|
87
104
|
if "name" in obj.keys():
|
|
88
105
|
self.name = obj["name"]
|
|
89
106
|
if "extension" in obj.keys():
|
|
90
107
|
self.extension = obj["extension"]
|
|
108
|
+
if not self.name and not self.extension and "path" in obj:
|
|
109
|
+
self.path = obj["path"]
|
|
91
110
|
if "last_modified" in obj.keys():
|
|
92
111
|
self.last_modified = datetime.fromtimestamp(obj["last_modified"] / 1000, tz=timezone.utc)
|
|
93
112
|
if "size" in obj.keys():
|
|
@@ -222,10 +241,6 @@ class ModelInfo:
|
|
|
222
241
|
obj["alias"] = self.alias
|
|
223
242
|
if self.model_type is not None:
|
|
224
243
|
obj["model_type"] = self.model_type
|
|
225
|
-
if self.file_format is not None:
|
|
226
|
-
obj["file_format"] = self.file_format
|
|
227
|
-
if self.source is not None:
|
|
228
|
-
obj["source"] = self.source
|
|
229
244
|
if self.property_name is not None:
|
|
230
245
|
obj["property_name"] = self.property_name
|
|
231
246
|
if self.is_active is not None:
|
|
@@ -251,7 +266,7 @@ class ModelInfo:
|
|
|
251
266
|
if "model_type" in obj.keys():
|
|
252
267
|
self.model_type = obj["model_type"]
|
|
253
268
|
if "file_format" in obj.keys():
|
|
254
|
-
self.
|
|
269
|
+
self.file_format = obj["file_format"]
|
|
255
270
|
if "source" in obj.keys():
|
|
256
271
|
self.source = obj["source"]
|
|
257
272
|
if "property_name" in obj.keys():
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.3.36"
|
|
@@ -1078,55 +1078,47 @@ class WizataDSAPIClient(ApiInterface):
|
|
|
1078
1078
|
else:
|
|
1079
1079
|
raise self.__raise_error(response)
|
|
1080
1080
|
|
|
1081
|
-
def
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
ml_model.status = "valid"
|
|
1123
|
-
#TODO: proper method to upload and download from registry to modify this one
|
|
1124
|
-
## self.upsert(ml_model)
|
|
1125
|
-
return ml_model, result_df
|
|
1126
|
-
else:
|
|
1127
|
-
raise RuntimeError('no dataframe was generated by your model while testing predict capabilities')
|
|
1128
|
-
except Exception as e:
|
|
1129
|
-
raise RuntimeError('not able to validated the model : ' + str(e))
|
|
1081
|
+
def upload_model(self,
|
|
1082
|
+
model_info: ModelInfo):
|
|
1083
|
+
"""
|
|
1084
|
+
upload a model within the model repository.
|
|
1085
|
+
:param model_info: model info, with at least key (+twin, +property, +alias) and trained_model.
|
|
1086
|
+
"""
|
|
1087
|
+
if model_info.trained_model is None:
|
|
1088
|
+
raise ValueError("model_info must have a trained model as bytes content pkl or pt")
|
|
1089
|
+
files = {
|
|
1090
|
+
"trained_model": (
|
|
1091
|
+
"trained_model." + model_info.file_format ,
|
|
1092
|
+
model_info.trained_model,
|
|
1093
|
+
"application/octet-stream",
|
|
1094
|
+
)
|
|
1095
|
+
}
|
|
1096
|
+
headers = self.__header()
|
|
1097
|
+
headers.pop("Content-Type", None)
|
|
1098
|
+
response = requests.post(self.__url() + f"models",
|
|
1099
|
+
headers=headers,
|
|
1100
|
+
data={
|
|
1101
|
+
"payload": json.dumps(model_info.to_json())
|
|
1102
|
+
},
|
|
1103
|
+
files=files)
|
|
1104
|
+
if response.status_code == 200:
|
|
1105
|
+
response_json = response.json()
|
|
1106
|
+
if "identifier" in response_json:
|
|
1107
|
+
key , twin, property_value, alias = ModelInfo.split_identifier(response_json["identifier"])
|
|
1108
|
+
if alias is not None:
|
|
1109
|
+
model_info.alias = alias
|
|
1110
|
+
for file in model_info.files:
|
|
1111
|
+
file: wizata_dsapi.ModelFile
|
|
1112
|
+
if file.name != "trained_model":
|
|
1113
|
+
headers["Content-Type"] = "application/octet-stream"
|
|
1114
|
+
response = requests.post(self.__url() + f"models/{model_info.identifier(include_alias=True)}/files/{file.name}",
|
|
1115
|
+
data=file.content,
|
|
1116
|
+
timeout=60)
|
|
1117
|
+
if response.status_code != 200 and response.status_code != 201:
|
|
1118
|
+
raise self.__raise_error(response)
|
|
1119
|
+
return model_info
|
|
1120
|
+
else:
|
|
1121
|
+
raise self.__raise_error(response)
|
|
1130
1122
|
|
|
1131
1123
|
def upsert_experiment(self, key: str, name: str, pipeline=None, twin=None):
|
|
1132
1124
|
"""
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.3.34"
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|