wizata-dsapi 1.3.41__py3-none-any.whl → 1.3.43__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/mlmodel.py +1 -1
- wizata_dsapi/version.py +1 -1
- wizata_dsapi/wizata_dsapi_client.py +100 -4
- {wizata_dsapi-1.3.41.dist-info → wizata_dsapi-1.3.43.dist-info}/METADATA +1 -1
- {wizata_dsapi-1.3.41.dist-info → wizata_dsapi-1.3.43.dist-info}/RECORD +8 -8
- {wizata_dsapi-1.3.41.dist-info → wizata_dsapi-1.3.43.dist-info}/WHEEL +0 -0
- {wizata_dsapi-1.3.41.dist-info → wizata_dsapi-1.3.43.dist-info}/licenses/LICENSE.txt +0 -0
- {wizata_dsapi-1.3.41.dist-info → wizata_dsapi-1.3.43.dist-info}/top_level.txt +0 -0
wizata_dsapi/mlmodel.py
CHANGED
wizata_dsapi/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.3.
|
|
1
|
+
__version__ = "1.3.43"
|
|
@@ -13,6 +13,7 @@ import plotly
|
|
|
13
13
|
import msal
|
|
14
14
|
import os
|
|
15
15
|
import types
|
|
16
|
+
|
|
16
17
|
import wizata_dsapi
|
|
17
18
|
import urllib.parse
|
|
18
19
|
import base64
|
|
@@ -26,7 +27,7 @@ from .api_dto import ApiDto, VarType, ApiDtoInterface
|
|
|
26
27
|
from .business_label import BusinessLabel
|
|
27
28
|
from .plot import Plot
|
|
28
29
|
from .request import Request
|
|
29
|
-
from .mlmodel import ModelInfo, ModelList
|
|
30
|
+
from .mlmodel import ModelInfo, ModelList, ModelFile
|
|
30
31
|
from .experiment import Experiment
|
|
31
32
|
from .script import Script
|
|
32
33
|
from .execution import Execution, ExecutionStatus
|
|
@@ -605,11 +606,12 @@ class WizataDSAPIClient(ApiInterface, ApiDtoInterface):
|
|
|
605
606
|
function=obj
|
|
606
607
|
)
|
|
607
608
|
if isinstance(obj, Script):
|
|
608
|
-
|
|
609
|
+
function = dill.dumps(obj.function)
|
|
610
|
+
response = requests.post(self.__url() + f"scripts/{obj.name}",
|
|
609
611
|
headers=self.__header(),
|
|
610
|
-
data=
|
|
612
|
+
data=function)
|
|
611
613
|
if response.status_code == 200:
|
|
612
|
-
obj.script_id = uuid.UUID(response.json()[
|
|
614
|
+
obj.script_id = uuid.UUID(response.json()["id"])
|
|
613
615
|
return obj.script_id
|
|
614
616
|
else:
|
|
615
617
|
raise self.__raise_error(response)
|
|
@@ -1935,6 +1937,100 @@ class WizataDSAPIClient(ApiInterface, ApiDtoInterface):
|
|
|
1935
1937
|
image = PipelineImage.loads(pipeline_image_id=pipeline_image_id, g_bytes=response_bytes)
|
|
1936
1938
|
return image
|
|
1937
1939
|
|
|
1940
|
+
def download_model(self, identifier: str) -> ModelInfo:
|
|
1941
|
+
"""
|
|
1942
|
+
download a model image directly from the repository, auto-select alias if necessary.
|
|
1943
|
+
:param identifier: exact identifier including alias of the model or no alias to auto-select active version.
|
|
1944
|
+
:return: ModelInfo with trained_model loaded, extra file must be downloaded separately.
|
|
1945
|
+
"""
|
|
1946
|
+
response = requests.get(self.__url() + f"models/{identifier}/",
|
|
1947
|
+
headers=self.__header())
|
|
1948
|
+
if response.status_code == 200:
|
|
1949
|
+
model_info = ModelInfo()
|
|
1950
|
+
model_info.from_json(response.json())
|
|
1951
|
+
self.load_model(model_info)
|
|
1952
|
+
return model_info
|
|
1953
|
+
else:
|
|
1954
|
+
self.__raise_error(response)
|
|
1955
|
+
|
|
1956
|
+
|
|
1957
|
+
def download_file(self,
|
|
1958
|
+
model: ModelInfo = None,
|
|
1959
|
+
file: ModelFile = None,
|
|
1960
|
+
identifier: str = None,
|
|
1961
|
+
path: str = None):
|
|
1962
|
+
"""
|
|
1963
|
+
download a model extra file from the repository.
|
|
1964
|
+
:param model: model (ModelInfo), alternatively can use identifier
|
|
1965
|
+
:param file: file (ModelFile), alternatively can use path
|
|
1966
|
+
:param identifier: identifier including alias of the model.
|
|
1967
|
+
:param path: path name of the file including the extension.
|
|
1968
|
+
:return: bytes content.
|
|
1969
|
+
"""
|
|
1970
|
+
|
|
1971
|
+
if model is None and identifier is None:
|
|
1972
|
+
raise TypeError('model or identifier must be provided')
|
|
1973
|
+
|
|
1974
|
+
if file is None and path is None:
|
|
1975
|
+
raise TypeError('file or path must be provided')
|
|
1976
|
+
|
|
1977
|
+
if identifier is None:
|
|
1978
|
+
identifier = model.identifier(include_alias=True)
|
|
1979
|
+
|
|
1980
|
+
if path is None:
|
|
1981
|
+
path = file.path
|
|
1982
|
+
|
|
1983
|
+
response = requests.get(self.__url() + f"models/{identifier}/files/{path}/",
|
|
1984
|
+
headers=self.__header())
|
|
1985
|
+
if response.status_code == 200:
|
|
1986
|
+
return response.content
|
|
1987
|
+
else:
|
|
1988
|
+
self.__raise_error(response)
|
|
1989
|
+
|
|
1990
|
+
|
|
1991
|
+
def upload_file(self,
|
|
1992
|
+
content,
|
|
1993
|
+
model: ModelInfo = None,
|
|
1994
|
+
file: ModelFile = None,
|
|
1995
|
+
identifier: str = None,
|
|
1996
|
+
path: str = None
|
|
1997
|
+
):
|
|
1998
|
+
"""
|
|
1999
|
+
upload a model extra file to the repository.
|
|
2000
|
+
please use upload_model for a trained_model
|
|
2001
|
+
:param content: the bytes content of the file.
|
|
2002
|
+
:param model: model (ModelInfo), alternatively can use identifier
|
|
2003
|
+
:param file: file (ModelFile), alternatively can use path
|
|
2004
|
+
:param identifier: identifier including alias of the model.
|
|
2005
|
+
:param path: path name of the file including the extension.
|
|
2006
|
+
:return: bytes content.
|
|
2007
|
+
"""
|
|
2008
|
+
if path == "trained_model.pkl" or path == "trained_model.pt" or path == "_metadata.json":
|
|
2009
|
+
raise RuntimeError("upload_file cannot be used to upload reserved metadata or the primary trained model")
|
|
2010
|
+
|
|
2011
|
+
if model is None and identifier is None:
|
|
2012
|
+
raise TypeError('model or identifier must be provided')
|
|
2013
|
+
|
|
2014
|
+
if file is None and path is None:
|
|
2015
|
+
raise TypeError('file or path must be provided')
|
|
2016
|
+
|
|
2017
|
+
if identifier is None:
|
|
2018
|
+
identifier = model.identifier(include_alias=True)
|
|
2019
|
+
|
|
2020
|
+
if path is None:
|
|
2021
|
+
path = file.path
|
|
2022
|
+
|
|
2023
|
+
headers = self.__header()
|
|
2024
|
+
headers["Content-Type"] = "application/octet-stream"
|
|
2025
|
+
response = requests.post(self.__url() + f"models/{identifier}/files/{path}",
|
|
2026
|
+
headers=headers,
|
|
2027
|
+
data=content,
|
|
2028
|
+
timeout=60)
|
|
2029
|
+
if response.status_code != 200 and response.status_code != 201:
|
|
2030
|
+
return
|
|
2031
|
+
else:
|
|
2032
|
+
self.__raise_error(response)
|
|
2033
|
+
|
|
1938
2034
|
def load_model(self, model):
|
|
1939
2035
|
"""
|
|
1940
2036
|
load a model pickle or torch from the repository ready to be used.
|
|
@@ -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=
|
|
19
|
+
wizata_dsapi/mlmodel.py,sha256=m-mVF-o632nbs_IJ2H73KM2hfcRwnUGFmPt5oVrU8Ws,24548
|
|
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=CtB6-HwJ2OtqUIbwAVTcawLmvYfudgIwGiPZARwTobM,31778
|
|
@@ -31,10 +31,10 @@ 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=
|
|
34
|
+
wizata_dsapi/version.py,sha256=j-LL6DcHF5yj7NOasGPQ6T3sqftww9ENT9_7iiAY06I,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
|
-
wizata_dsapi/wizata_dsapi_client.py,sha256=
|
|
37
|
+
wizata_dsapi/wizata_dsapi_client.py,sha256=KycD4Rv2yoqCx7kugTUfw_4Z064TYTUvEfyKjzkQOjc,84395
|
|
38
38
|
wizata_dsapi/words.py,sha256=tV8CqzCqODZCV7PgBxBF5exBxeF_ya9t5DiUy-cg6Sg,1535
|
|
39
39
|
wizata_dsapi/models/__init__.py,sha256=O5PHqw8lKILw4apO-MfDxPz73wK0vADD9y3xjuzX7Tw,104
|
|
40
40
|
wizata_dsapi/models/common.py,sha256=1dTqE80-mFJnUwEdNlJdhJzfZ2N5Kp8Nb3LQ8uwPtLc,3808
|
|
@@ -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.
|
|
46
|
-
wizata_dsapi-1.3.
|
|
47
|
-
wizata_dsapi-1.3.
|
|
48
|
-
wizata_dsapi-1.3.
|
|
49
|
-
wizata_dsapi-1.3.
|
|
45
|
+
wizata_dsapi-1.3.43.dist-info/licenses/LICENSE.txt,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
46
|
+
wizata_dsapi-1.3.43.dist-info/METADATA,sha256=KJ9I7wiko6x8_zkUg9s_AEGpMWG9FkvCDi3OjZZSGPk,5651
|
|
47
|
+
wizata_dsapi-1.3.43.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
48
|
+
wizata_dsapi-1.3.43.dist-info/top_level.txt,sha256=-OeTJbEnh5DuWyTOHtvw0Dw3LRg3G27TNS6W4ZtfwPs,13
|
|
49
|
+
wizata_dsapi-1.3.43.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|