wizata-dsapi 2.1.0.dev22__tar.gz → 2.1.0.dev24__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.
Files changed (67) hide show
  1. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/PKG-INFO +1 -1
  2. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/api_config.py +18 -0
  3. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/execution_log.py +11 -0
  4. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/notification.py +15 -0
  5. wizata_dsapi-2.1.0.dev24/wizata_dsapi/version.py +1 -0
  6. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/wizata_dsapi_client.py +70 -60
  7. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi.egg-info/PKG-INFO +1 -1
  8. wizata_dsapi-2.1.0.dev22/wizata_dsapi/version.py +0 -1
  9. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/LICENSE.txt +0 -0
  10. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/README.rst +0 -0
  11. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/setup.cfg +0 -0
  12. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/setup.py +0 -0
  13. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/__init__.py +0 -0
  14. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/api_dto.py +0 -0
  15. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/api_interface.py +0 -0
  16. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/bucket.py +0 -0
  17. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/business_label.py +0 -0
  18. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/context.py +0 -0
  19. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/dashboard.py +0 -0
  20. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/dataframe_toolkit.py +0 -0
  21. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/datapoint.py +0 -0
  22. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/datastore.py +0 -0
  23. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/deployment.py +0 -0
  24. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/ds_dataframe.py +0 -0
  25. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/dsapi_json_encoder.py +0 -0
  26. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/edge_config.py +0 -0
  27. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/edge_device.py +0 -0
  28. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/edge_module.py +0 -0
  29. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/evaluation.py +0 -0
  30. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/execution.py +0 -0
  31. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/experiment.py +0 -0
  32. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/graylog_log.py +0 -0
  33. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/group_system.py +0 -0
  34. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/ilogger.py +0 -0
  35. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/insight.py +0 -0
  36. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/mlmodel.py +0 -0
  37. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/mobile_asset.py +0 -0
  38. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/model_toolkit.py +0 -0
  39. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/models/__init__.py +0 -0
  40. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/models/common.py +0 -0
  41. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/paged_query_result.py +0 -0
  42. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/pipeline.py +0 -0
  43. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/pipeline_image.py +0 -0
  44. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/plot.py +0 -0
  45. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/plots/__init__.py +0 -0
  46. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/plots/common.py +0 -0
  47. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/plots/theme.py +0 -0
  48. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/request.py +0 -0
  49. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/script.py +0 -0
  50. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/scripts/__init__.py +0 -0
  51. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/scripts/common.py +0 -0
  52. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/search.py +0 -0
  53. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/solution_component.py +0 -0
  54. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/streamlit_utils.py +0 -0
  55. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/template.py +0 -0
  56. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/template_config.py +0 -0
  57. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/trigger.py +0 -0
  58. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/twin.py +0 -0
  59. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/twinregistration.py +0 -0
  60. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/user.py +0 -0
  61. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/wizard_function.py +0 -0
  62. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/wizard_request.py +0 -0
  63. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi/words.py +0 -0
  64. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi.egg-info/SOURCES.txt +0 -0
  65. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi.egg-info/dependency_links.txt +0 -0
  66. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi.egg-info/requires.txt +0 -0
  67. {wizata_dsapi-2.1.0.dev22 → wizata_dsapi-2.1.0.dev24}/wizata_dsapi.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wizata_dsapi
3
- Version: 2.1.0.dev22
3
+ Version: 2.1.0.dev24
4
4
  Summary: Wizata Data Science Toolkit
5
5
  Author: Wizata S.A.
6
6
  Author-email: info@wizata.com
@@ -20,6 +20,8 @@ from .pipeline_image import PipelineImage
20
20
  from .deployment import Deployment
21
21
  from .insight import Insight
22
22
  from .edge_device import EdgeDevice
23
+ from .notification import RecipientList
24
+ from .execution_log import ExecutionLog
23
25
 
24
26
 
25
27
  # Entities withdrawn from the client, and what to say instead.
@@ -85,6 +87,22 @@ _registry = {
85
87
  "cloud_dsapi": ['lists', 'get_by_id', 'update', 'delete', 'search'],
86
88
  "cloud_context": []
87
89
  },
90
+ "recipientlists":
91
+ {
92
+ "class": RecipientList,
93
+ # Keyed by 'key', not an id: /notifications/recipients/<key>/. Listing
94
+ # is what get_by_key uses, so both go together.
95
+ "cloud_dsapi": ['lists', 'get_by_key'],
96
+ "cloud_context": []
97
+ },
98
+ "executionlogs":
99
+ {
100
+ "class": ExecutionLog,
101
+ # Read one by id. Searching them is search_executions(), which asks a
102
+ # different endpoint entirely and has its own runner-stream argument.
103
+ "cloud_dsapi": ['get_by_id'],
104
+ "cloud_context": []
105
+ },
88
106
  "datastores":
89
107
  {
90
108
  "class": DataStore,
@@ -45,6 +45,17 @@ class ExecutionLog(Dto):
45
45
  :ivar list messages: list of error and/or warning messages
46
46
  """
47
47
 
48
+ @classmethod
49
+ def route(cls):
50
+ """
51
+ Endpoint name in Web API — GET /execute/<id>/ returns one execution.
52
+ """
53
+ return "execute"
54
+
55
+ @classmethod
56
+ def get_type(cls):
57
+ return "json"
58
+
48
59
  @classmethod
49
60
  def from_dict(cls, data: dict) -> "ExecutionLog":
50
61
 
@@ -581,6 +581,21 @@ class RecipientList:
581
581
  (follows preferences) or a free address with explicit channel.
582
582
  """
583
583
 
584
+ @classmethod
585
+ def route(cls):
586
+ """
587
+ Endpoint name in Web API.
588
+
589
+ Recipient lists live under notifications rather than at the top level, which
590
+ is why a route was never declared and get() answered "not supported" for an
591
+ entity the API has served all along.
592
+ """
593
+ return "notifications/recipients"
594
+
595
+ @classmethod
596
+ def get_type(cls):
597
+ return "json"
598
+
584
599
  def __init__(self, key: str = None, name: str = None):
585
600
  self.key: Optional[str] = key
586
601
  self.name: Optional[str] = name
@@ -0,0 +1 @@
1
+ __version__ = "2.1.0.dev24"
@@ -1984,72 +1984,82 @@ class WizataDSAPIClient(ApiInterface, ApiDtoInterface):
1984
1984
  else:
1985
1985
  raise self.__raise_error(response)
1986
1986
 
1987
+ #: Executions are streamed per runner, and the two do not mix: a scheduled run
1988
+ #: is logged by the pipeline runner, an experiment by the experiment runner.
1989
+ #: Searching the wrong one returns a confident, complete, empty answer.
1990
+ PRODUCTION_RUNS = "pipeline_runner"
1991
+ EXPERIMENT_RUNS = "experiment_runner"
1992
+
1987
1993
  def search_executions(self,
1994
+ search_query=None,
1995
+ service: str = PRODUCTION_RUNS,
1996
+ pipeline: str = None,
1997
+ twin: str = None,
1998
+ status=None,
1988
1999
  page: int = 1,
1989
- size: int = 20,
1990
- sort: str = "id",
1991
- direction: str = "asc",
1992
- pipeline_id: uuid.UUID = None,
1993
- twin_id: uuid.UUID = None,
1994
- template_id: uuid.UUID = None,
1995
- status: ExecutionStatus = None) -> PagedQueryResult:
2000
+ size: int = 20) -> PagedQueryResult:
2001
+ """
2002
+ Search executions with filters, sorting and pagination.
2003
+
2004
+ Executions are searched per runner. ``service`` selects which: scheduled
2005
+ runs are logged by :attr:`PRODUCTION_RUNS`, experiments by
2006
+ :attr:`EXPERIMENT_RUNS`. They are separate streams, so looking in the wrong
2007
+ one answers "no executions" rather than telling you that you asked the
2008
+ wrong question.
2009
+
2010
+ :param search_query: SearchQuery or dict for the full query. When given,
2011
+ the convenience arguments below are ignored.
2012
+ :param service: which runner's executions to search.
2013
+ :param pipeline: pipeline KEY, not id - executions are labelled by key.
2014
+ :param twin: twin hardware id.
2015
+ :param status: ExecutionStatus, or its value.
2016
+ :param page: page number, from 1.
2017
+ :param size: results per page.
2018
+ :return: PagedQueryResult with Execution results.
1996
2019
  """
1997
- get executions with a paged query.
1998
- :param page: numero of the page - default 1.
1999
- :param size: quantity per page - default 20 max 100.
2000
- :param sort: column to sort results - default id.
2001
- :param direction: sorting direction by default asc, accept also desc.
2002
- :param pipeline_id: filter on a specific pipeline.
2003
- :param twin_id: filter on a specific twin.
2004
- :param template_id: filter on a specific template.
2005
- :param status: filter on a specific status.
2006
- :return: PagedQueryResults, check total for number of potential results and results for the list of entity.
2007
- """
2008
- query = PagedQueryResult(
2009
- page=page,
2010
- size=size,
2011
- sort=sort,
2012
- direction=direction
2013
- )
2014
-
2015
- if sort not in ["id", "pipelineId", "twinId", "templateId",
2016
- "createdDate" , "createdById",
2017
- "updatedDate", "updatedById",
2018
- "status"]:
2019
- raise ValueError("invalid sort column")
2020
-
2021
- parameter_str = "?page=" + str(page) + "&size=" + str(size) + "&sort=" + str(sort) + "&direction=" + str(direction)
2022
-
2023
- if pipeline_id is not None:
2024
- parameter_str += "&pipelineId=" + sanitize_url_parameter(str(pipeline_id))
2025
-
2026
- if twin_id is not None:
2027
- parameter_str += "&twinId=" + sanitize_url_parameter(str(twin_id))
2028
-
2029
- if template_id is not None:
2030
- parameter_str += "&templateId=" + sanitize_url_parameter(str(template_id))
2031
-
2032
- if status is not None:
2033
- if not isinstance(status, ExecutionStatus):
2034
- raise ValueError(f'status is not a valid ExecutionStatus')
2035
- parameter_str += "&status=" + sanitize_url_parameter(status.value)
2020
+ if search_query is None:
2021
+ search_query = SearchQuery()
2022
+ search_query.page = page
2023
+ search_query.size = size
2024
+ search_query.service_name = service
2025
+ filters = {}
2026
+ if pipeline is not None:
2027
+ filters["pipeline"] = {"eq": str(pipeline)}
2028
+ if twin is not None:
2029
+ filters["twin"] = {"eq": str(twin)}
2030
+ if status is not None:
2031
+ value = status.value if isinstance(status, ExecutionStatus) else status
2032
+ filters["status"] = {"eq": str(value)}
2033
+ search_query.filters = filters
2034
+ elif isinstance(search_query, dict):
2035
+ search_query = SearchQuery.from_dict(search_query)
2036
2036
 
2037
- response = requests.request("GET",
2038
- self.__url() + "execute/filter" + parameter_str,
2039
- headers=self.__header()
2040
- )
2041
- if response.status_code == 200:
2042
- response_obj = response.json()
2043
- query.total = int(response_obj["total"])
2044
- query.results = []
2045
- for obj in response_obj["results"]:
2046
- execution = Execution()
2047
- execution.from_json(obj)
2048
- query.results.append(execution)
2049
- return query
2050
- else:
2037
+ response = requests.post(
2038
+ self.__url() + "execute/search",
2039
+ headers=self.__header(),
2040
+ data=json.dumps(search_query.to_dict())
2041
+ )
2042
+ if response.status_code != 200:
2051
2043
  raise self.__raise_error(response)
2052
2044
 
2045
+ body = response.json()
2046
+ # PagedQueryResult refuses a null sort, so a response that omits it would
2047
+ # raise on an answer that succeeded. The executions endpoint orders by
2048
+ # timestamp descending unless told otherwise; say so rather than break.
2049
+ query = PagedQueryResult(
2050
+ page=body.get("page", page),
2051
+ size=body.get("size", size),
2052
+ sort=body.get("sort") or "timestamp",
2053
+ direction=body.get("direction") or "desc"
2054
+ )
2055
+ query.total = int(body.get("total", 0))
2056
+ # ExecutionLog, not Execution: this endpoint answers with log rows, whose
2057
+ # id is a uuid and whose pipeline, twin and template are keys rather than
2058
+ # ids. Execution.from_json reads id as an int and raises on the first row.
2059
+ query.results = [ExecutionLog.from_dict(obj)
2060
+ for obj in body.get("results", [])]
2061
+ return query
2062
+
2053
2063
  def search_execution(self, search_query=None) -> PagedQueryResult:
2054
2064
  """
2055
2065
  search executions using filters, sorting and pagination via POST.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wizata_dsapi
3
- Version: 2.1.0.dev22
3
+ Version: 2.1.0.dev24
4
4
  Summary: Wizata Data Science Toolkit
5
5
  Author: Wizata S.A.
6
6
  Author-email: info@wizata.com
@@ -1 +0,0 @@
1
- __version__ = "2.1.0.dev22"