wizata-dsapi 1.4.0.dev9__py3-none-any.whl → 1.4.0.dev11__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/context.py CHANGED
@@ -4,6 +4,7 @@ import numpy as np
4
4
  import io
5
5
  import json
6
6
  import pickle
7
+ import logging
7
8
 
8
9
  from .mlmodel import ModelInfo, ModelFile
9
10
  from .plot import Plot
@@ -97,7 +98,7 @@ class Context(ILogger):
97
98
  self._api = None
98
99
  self.dataframe = dataframe
99
100
 
100
- def write_log(self, message: str, level: int = 7):
101
+ def write_log(self, message: str = None, level: int = logging.INFO):
101
102
  """
102
103
  write log in console (only in experiment mode) - if running locally it will print in the console.
103
104
  :param message: message to write.
@@ -1,4 +1,5 @@
1
1
  from .api_dto import Dto
2
+ from .plot import Plot
2
3
  from .experiment import Experiment
3
4
  from .pipeline import Pipeline
4
5
  from .twin import Twin
@@ -49,6 +50,12 @@ class ExecutionLog(Dto):
49
50
  if isinstance(properties, str):
50
51
  properties = json.loads(properties)
51
52
 
53
+ plots = data.get("plots")
54
+ _plots = []
55
+ if isinstance(plots, list):
56
+ for plot in plots:
57
+ _plots.append(Plot.from_dict(plot))
58
+
52
59
  return cls(
53
60
  execution_id=uuid.UUID(data["id"]) if "id" in data and not isinstance(data["id"], int) else None,
54
61
  experiment=data.get("experiment"),
@@ -64,7 +71,8 @@ class ExecutionLog(Dto):
64
71
  execution_time=int(data.get("executionTime")) if "executionTime" in data and data["executionTime"] is not None else None,
65
72
  trigger_id=uuid.UUID(data["executionTriggerId"]) if "executionTriggerId" in data and data["executionTriggerId"] is not None else None,
66
73
  version=data.get("version"),
67
- properties=properties
74
+ properties=properties,
75
+ plots=_plots
68
76
  )
69
77
 
70
78
  def __init__(self,
@@ -83,7 +91,8 @@ class ExecutionLog(Dto):
83
91
  execution_time: int = None,
84
92
  trigger_id: uuid.UUID = None,
85
93
  version: str = None,
86
- properties: dict = None):
94
+ properties: dict = None,
95
+ plots: list = None):
87
96
 
88
97
  # labels
89
98
  self._experiment = None
@@ -132,7 +141,10 @@ class ExecutionLog(Dto):
132
141
  properties = {}
133
142
  self.properties = properties
134
143
  self.models = []
135
- self.plots = []
144
+ if plots is not None:
145
+ self.plots = plots
146
+ else:
147
+ self.plots = []
136
148
  self.dataframes = []
137
149
  self.messages = []
138
150
 
@@ -409,6 +421,10 @@ class ExecutionLog(Dto):
409
421
  "version": self.version,
410
422
  "messages": self.messages or None
411
423
  }
424
+ if self.plots is not None and len(self.plots) > 0:
425
+ data["plots"] = []
426
+ for plot in self.plots:
427
+ data["plots"].append(plot.to_json(target="logs"))
412
428
  return {k: v for k, v in data.items() if v is not None}
413
429
 
414
430
  def to_dict(self) -> dict:
wizata_dsapi/ilogger.py CHANGED
@@ -1,4 +1,5 @@
1
- from .execution import Execution, ExecutionStepLog
1
+ from .execution_log import ExecutionLog
2
+ import logging
2
3
 
3
4
 
4
5
  class ILogger:
@@ -6,24 +7,16 @@ class ILogger:
6
7
  logger interface used within a pipeline and context.
7
8
  """
8
9
 
9
- def write_log(self, message: str, level: int = 7):
10
+ def write_log(self, message: str = None, level: int = logging.INFO):
10
11
  """
11
12
  write a log
12
13
  :param str message: message to write.
13
- :param int level: from 1 critical to 7 verbose.
14
+ :param int level: use logging level.
14
15
  """
15
16
  pass
16
17
 
17
- def notify_step(self, step_log: ExecutionStepLog):
18
+ def notify(self):
18
19
  """
19
- notify the listeners and watchers on current step status.
20
- :param wizata_dsapi.ExecutionStepLog step_log: step log.
21
- """
22
- pass
23
-
24
- def notify_execution(self, execution: Execution):
25
- """
26
- notify the listeners and watchers on current execution status.
27
- :param wizata_dsapi.Execution execution: execution log.
20
+ notify the listeners and watchers on current status.
28
21
  """
29
22
  pass
wizata_dsapi/plot.py CHANGED
@@ -6,7 +6,6 @@ class Plot(ApiDto):
6
6
  """
7
7
  A plot is a definition of a Plotly figure that can be stored and shared on Wizata.
8
8
  :ivar plot_id: The UUID of the plot.
9
- :ivar generatedById: The UUID of the Execution from which the plot was created.
10
9
  :ivar name: A simple name helping the user identifying the plot.
11
10
  :ivar figure: Plotly figure defining the plot itself.
12
11
  """
@@ -21,14 +20,12 @@ class Plot(ApiDto):
21
20
  obj.from_json(data)
22
21
  return obj
23
22
 
24
- def __init__(self, plot_id=None, name=None, generated_by_id=None, figure=None):
23
+ def __init__(self, plot_id=None, name=None, figure=None):
25
24
  if plot_id is None:
26
25
  self.plot_id = uuid.uuid4()
27
26
  else:
28
27
  self.plot_id = plot_id
29
28
  self.name = name
30
- self.generatedById = generated_by_id # Execution
31
- # Step Id
32
29
  self.figure = figure
33
30
 
34
31
  def api_id(self) -> str:
@@ -56,8 +53,6 @@ class Plot(ApiDto):
56
53
  self.name = obj["name"]
57
54
  if "figure" in obj.keys():
58
55
  self.figure = obj["figure"]
59
- if "generatedById" in obj.keys():
60
- self.generatedById = uuid.UUID(obj["generatedById"])
61
56
 
62
57
  def to_json(self, target: str = None):
63
58
  """
@@ -69,11 +64,7 @@ class Plot(ApiDto):
69
64
  }
70
65
  if self.name is not None:
71
66
  obj["name"] = self.name
72
- if target is None or target != 'backend-create':
67
+ if target is None or target != 'logs':
73
68
  if self.figure is not None:
74
69
  obj["figure"] = self.figure
75
- if self.generatedById is not None:
76
- #TODO: add generateById as UUID or find another way to store plots
77
- #obj["generatedById"] = str(self.generatedById)
78
- pass
79
70
  return obj
wizata_dsapi/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.4.0.dev9"
1
+ __version__ = "1.4.0.dev11"
@@ -1053,7 +1053,7 @@ class WizataDSAPIClient(ApiInterface, ApiDtoInterface):
1053
1053
  else:
1054
1054
  raise self.__raise_error(response)
1055
1055
 
1056
- def plot(self, plot_id: str = None, plot: Plot = None, figure=None,):
1056
+ def plot(self, plot_id: str = None, plot: Plot = None, figure=None):
1057
1057
  """
1058
1058
  Fetch and show plot.
1059
1059
  :param plot: Wizata Plot Object
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wizata_dsapi
3
- Version: 1.4.0.dev9
3
+ Version: 1.4.0.dev11
4
4
  Summary: Wizata Data Science Toolkit
5
5
  Author: Wizata S.A.
6
6
  Author-email: info@wizata.com
@@ -4,7 +4,7 @@ wizata_dsapi/api_dto.py,sha256=mguQMqsshL4uNFt_RlZTD5zeKDBpFpa2nJP91ZtqaoA,2700
4
4
  wizata_dsapi/api_interface.py,sha256=ju3Wz1e2uOS1_SrSihc0AECkWLRNNGHMhpMhV2L6tjo,13315
5
5
  wizata_dsapi/bucket.py,sha256=Zz9olv-pymikAutGitSuGWrAPiawOTW86JDDHG4ugTc,1150
6
6
  wizata_dsapi/business_label.py,sha256=u0TVfUNfoR9qSv8lzpf6rNjlg3G9xTiz6itefcKfeak,4151
7
- wizata_dsapi/context.py,sha256=SNlEOELJe2455fdN6F12xu_z5cyINjmC4jAjKZUNvHM,12563
7
+ wizata_dsapi/context.py,sha256=T45HsUTJUIKUSB6AU_ubuz60dIY2m5ebUQ_EchfF2co,12596
8
8
  wizata_dsapi/dataframe_toolkit.py,sha256=7D8JrhsFSGXeO3mRAd2e2cLmdjbXRjk04IuaMG8F974,9078
9
9
  wizata_dsapi/datapoint.py,sha256=UUatqzWMwC4ucM6HdeQDWtLS4fGqEsDABCNVmxoP5Hg,14635
10
10
  wizata_dsapi/datastore.py,sha256=BSHZmCSJ679boBA1eCkaWGJCy1CUeipKKGt2jDHzdVo,2663
@@ -12,10 +12,10 @@ wizata_dsapi/ds_dataframe.py,sha256=Sk2JRUuTRJzko3HosJnbK34STpgSJUlqxLq8w_E5VM4,
12
12
  wizata_dsapi/dsapi_json_encoder.py,sha256=_NJE2IncJCS-juOxV_IQWHq8WpaanKe2aWpGNZNUzyk,2062
13
13
  wizata_dsapi/evaluation.py,sha256=kB61SD66uRBBbKqiES7XZERn77bwhacbyufneSD4s8c,2222
14
14
  wizata_dsapi/execution.py,sha256=JuU8qZDcUZxtCvQwwvM_luwHi18GQ2jbBSxAjc2cSlM,14148
15
- wizata_dsapi/execution_log.py,sha256=ervc6DeZ_9Xwlasi209Hka4F8Rhw30AqWAfOjr0uETw,14630
15
+ wizata_dsapi/execution_log.py,sha256=uDpGXPswTml9sAT1JuwQDA2E0VMUPhbS_fV3DWi9Jm4,15161
16
16
  wizata_dsapi/experiment.py,sha256=QYQ1CJ-MTWsXq08xYbm5sAp95dRxbPOmGDgaAOoBMDQ,4631
17
17
  wizata_dsapi/group_system.py,sha256=6rUKe0_J3YWACysyBlzuw_TEpKNXgLOMxhpWsNxOzwY,1708
18
- wizata_dsapi/ilogger.py,sha256=iYnID-Z-qrYhie26C43404aIuU4_tHSKXbDeQIdo82Q,807
18
+ wizata_dsapi/ilogger.py,sha256=YKBTRp7pHYtBlnzroGRPT91_bMVJT93Pft3fUGcFSIM,488
19
19
  wizata_dsapi/insight.py,sha256=ABFZ04DqYxxzqAEfU1tzlTZqqrigM-zN-8Lbetko3g0,6468
20
20
  wizata_dsapi/mlmodel.py,sha256=QkWBNordOQiw6Vv4xN_pxwJWqbBm29vY1dyDZgmMS_4,26324
21
21
  wizata_dsapi/model_toolkit.py,sha256=UNyw5CFSgZeXydQFsiDIRTjoMeqIsdyIIuiwumLW5bA,1574
@@ -23,7 +23,7 @@ wizata_dsapi/paged_query_result.py,sha256=0Iyt2Kd4tvrfthhT-tk9EmSERsbJTaPNON2euH
23
23
  wizata_dsapi/pipeline.py,sha256=gqZ6R8d8f_uz9xI3Umz2uN3yTD4N3jsBPltAIg--Bjk,31646
24
24
  wizata_dsapi/pipeline_deployment.py,sha256=grekBaxUK0EhL9w7lDB8vNuW_wzLnHVm9Mq8Lkbkguk,1722
25
25
  wizata_dsapi/pipeline_image.py,sha256=4DhDo1SYftN6QcNbehNbM86VTD6EYGmtlcOmE5DP5Vc,6330
26
- wizata_dsapi/plot.py,sha256=JCpDoDa_yC_4z26rueCLqaLXksGgILzTxLqlX9oEUaI,2468
26
+ wizata_dsapi/plot.py,sha256=-gV6rZJQDhGH4CV9BgefjeJWI--X5HDBOjseEzHr3Gc,1971
27
27
  wizata_dsapi/request.py,sha256=W4E1BHacQdJiBLPI96yVeHz41rbfFuGrbuw1U60L_DM,27560
28
28
  wizata_dsapi/script.py,sha256=DeEciwVpuCYZetgJCoivw_bYe8ma52WuTaTQ_VkLEcg,12930
29
29
  wizata_dsapi/solution_component.py,sha256=8gbZWx2h_xUqI_pAXa3goqAnR5Y-GDMii8MeGlaK1IE,9531
@@ -32,10 +32,10 @@ wizata_dsapi/template.py,sha256=wtCRKKk3PchH4RrNgNYlEF_9C6bzZwKIeLyEvgv6Fdo,1370
32
32
  wizata_dsapi/trigger.py,sha256=w3BZYP-L3SUwvaT0oCTanh_Ewn57peZvlt7vxzHv9J8,5129
33
33
  wizata_dsapi/twin.py,sha256=S0DUzQf1smZXZTdXpXZPtkZYCfKIhw53EecCnsl9i4Q,11017
34
34
  wizata_dsapi/twinregistration.py,sha256=Mi6-YuwroiEXc0c1hgrOaphh4hNVoHupxOnXedVtJtE,13377
35
- wizata_dsapi/version.py,sha256=SICHCBoF2oCBiXadU6H-L_KMI2_7xdPUS_tUYQrlE2k,27
35
+ wizata_dsapi/version.py,sha256=D3hcB4cUqa8hrzfX4c-6RRRgmyjMsM7cure7QjYguz8,28
36
36
  wizata_dsapi/wizard_function.py,sha256=RbM7W7Gf-6Rhp_1dU9DBYkHaciknGAGvuAndhAS_vyo,942
37
37
  wizata_dsapi/wizard_request.py,sha256=v6BaqKLKvTWmUSo0_gda9FabAQz5x_-GOH1Av50GzFo,3762
38
- wizata_dsapi/wizata_dsapi_client.py,sha256=o-YMZzEXTglrU3dPR0FDQ3CZeiKVruVfzMM4vIFPxJk,85057
38
+ wizata_dsapi/wizata_dsapi_client.py,sha256=pClIADBb_CfgT4P4Hz9mopgsuC0Wa_XiZBuej7x5JUM,85056
39
39
  wizata_dsapi/words.py,sha256=tV8CqzCqODZCV7PgBxBF5exBxeF_ya9t5DiUy-cg6Sg,1535
40
40
  wizata_dsapi/models/__init__.py,sha256=O5PHqw8lKILw4apO-MfDxPz73wK0vADD9y3xjuzX7Tw,104
41
41
  wizata_dsapi/models/common.py,sha256=1dTqE80-mFJnUwEdNlJdhJzfZ2N5Kp8Nb3LQ8uwPtLc,3808
@@ -43,8 +43,8 @@ wizata_dsapi/plots/__init__.py,sha256=qgnSFqrjOPur-807M8uh5awIfjM1ZHXUXcAqHc-r2l
43
43
  wizata_dsapi/plots/common.py,sha256=jdPsJqLHBwSKc6dX83BSGPqSRxzIVNHSYO5yI_8sjGk,6568
44
44
  wizata_dsapi/scripts/__init__.py,sha256=hAxiETSQf0qOHde1si1tEAJU48seqEgHrchCzS2-LvQ,80
45
45
  wizata_dsapi/scripts/common.py,sha256=efwq-Rd0lvYljIs3gSFz9izogBD7asOU2cTK-IvHTkM,4244
46
- wizata_dsapi-1.4.0.dev9.dist-info/licenses/LICENSE.txt,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
47
- wizata_dsapi-1.4.0.dev9.dist-info/METADATA,sha256=CnFp57k7QwTJC-1_Y5NucciIZUk5FJlB7x50_ZRiCN8,4959
48
- wizata_dsapi-1.4.0.dev9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
49
- wizata_dsapi-1.4.0.dev9.dist-info/top_level.txt,sha256=-OeTJbEnh5DuWyTOHtvw0Dw3LRg3G27TNS6W4ZtfwPs,13
50
- wizata_dsapi-1.4.0.dev9.dist-info/RECORD,,
46
+ wizata_dsapi-1.4.0.dev11.dist-info/licenses/LICENSE.txt,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
47
+ wizata_dsapi-1.4.0.dev11.dist-info/METADATA,sha256=rKS2t7fXk3nrFFYOokkpeEu8KWDhDNtfX74uHeocC0I,4960
48
+ wizata_dsapi-1.4.0.dev11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
49
+ wizata_dsapi-1.4.0.dev11.dist-info/top_level.txt,sha256=-OeTJbEnh5DuWyTOHtvw0Dw3LRg3G27TNS6W4ZtfwPs,13
50
+ wizata_dsapi-1.4.0.dev11.dist-info/RECORD,,