qwak-sdk 0.5.89__py3-none-any.whl → 0.5.91__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.

Potentially problematic release.


This version of qwak-sdk might be problematic. Click here for more details.

qwak_sdk/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # fmt: off
2
2
  __author__ = '''Qwak.ai'''
3
- __version__ = '0.5.89'
3
+ __version__ = '0.5.91'
4
4
 
5
5
  from qwak.inner import wire_dependencies
6
6
 
@@ -12,9 +12,11 @@ from _qwak_proto.qwak.auto_scaling.v1.auto_scaling_pb2 import (
12
12
  AGGREGATION_TYPE_P99,
13
13
  AGGREGATION_TYPE_SUM,
14
14
  METRIC_TYPE_CPU,
15
+ METRIC_TYPE_ERROR_RATE,
15
16
  METRIC_TYPE_GPU,
16
17
  METRIC_TYPE_LATENCY,
17
18
  METRIC_TYPE_MEMORY,
19
+ METRIC_TYPE_THROUGHPUT,
18
20
  AutoScalingConfig,
19
21
  PrometheusTrigger,
20
22
  QuerySpec,
@@ -22,12 +24,35 @@ from _qwak_proto.qwak.auto_scaling.v1.auto_scaling_pb2 import (
22
24
  Triggers,
23
25
  )
24
26
 
27
+ from qwak_sdk.exceptions import QwakCommandException
28
+
25
29
 
26
30
  class MetricType(Enum):
27
31
  cpu = METRIC_TYPE_CPU
28
32
  gpu = METRIC_TYPE_GPU
29
33
  latency = METRIC_TYPE_LATENCY
30
34
  memory = METRIC_TYPE_MEMORY
35
+ throughput = METRIC_TYPE_THROUGHPUT
36
+ error_rate = METRIC_TYPE_ERROR_RATE
37
+
38
+ @classmethod
39
+ def get_metric_type(cls, metric_type: str) -> "MetricType":
40
+ """
41
+ Converts a string representation of a metric type to its corresponding `MetricType` enum.
42
+ The method performs a case-insensitive lookup. If the provided metric type does not exist
43
+ in the `MetricType` enum, a `QwakCommandException` is raised.
44
+
45
+ :param metric_type: The name of the metric type to retrieve.
46
+ :return: The corresponding `MetricType` enum.
47
+ :raises: QwakCommandException if the provided `metric_type` does not match any member
48
+ """
49
+
50
+ try:
51
+ return cls[metric_type.lower()]
52
+ except KeyError as exception:
53
+ raise QwakCommandException(
54
+ f"The metric type {metric_type} doesn't exist"
55
+ ) from exception
31
56
 
32
57
 
33
58
  class AggregationType(Enum):
@@ -40,6 +65,24 @@ class AggregationType(Enum):
40
65
  p95 = AGGREGATION_TYPE_P95
41
66
  p99 = AGGREGATION_TYPE_P99
42
67
 
68
+ @classmethod
69
+ def get_aggregation_type(cls, aggregation_type: str) -> "AggregationType":
70
+ """
71
+ Converts a string representation of an aggregation type to its corresponding `AggregationType` enum.
72
+ The method performs a case-insensitive lookup. If the provided aggregation type does not exist
73
+ in the `AggregationType` enum, a `QwakCommandException` is raised.
74
+
75
+ :param aggregation_type: The name of the aggregation type to retrieve
76
+ :return: The corresponding `AggregationType` enum.
77
+ :raises: QwakCommandException if the provided `aggregation_type` does not match
78
+ """
79
+ try:
80
+ return cls[aggregation_type.lower()]
81
+ except KeyError as exception:
82
+ raise QwakCommandException(
83
+ f"The aggregation type {aggregation_type} doesn't exist"
84
+ ) from exception
85
+
43
86
 
44
87
  @dataclass
45
88
  class AutoScaling:
@@ -68,16 +111,18 @@ class AutoScaling:
68
111
  def to_autoscaling_api(self) -> AutoScalingConfig:
69
112
  triggers = Triggers()
70
113
  for trigger in self.triggers.prometheus_trigger:
114
+ metric_type: MetricType = MetricType.get_metric_type(
115
+ trigger.query_spec.metric_type
116
+ )
117
+ aggregation_type: AggregationType = AggregationType.get_aggregation_type(
118
+ trigger.query_spec.aggregation_type
119
+ )
71
120
  triggers.triggers.append(
72
121
  Trigger(
73
122
  prometheus_trigger=PrometheusTrigger(
74
123
  query_spec=QuerySpec(
75
- metric_type=MetricType[
76
- trigger.query_spec.metric_type.lower()
77
- ].value,
78
- aggregation_type=AggregationType[
79
- trigger.query_spec.aggregation_type.lower()
80
- ].value,
124
+ metric_type=metric_type.value,
125
+ aggregation_type=aggregation_type.value,
81
126
  time_period=trigger.query_spec.time_period,
82
127
  error_code=trigger.query_spec.error_code,
83
128
  ),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: qwak-sdk
3
- Version: 0.5.89
3
+ Version: 0.5.91
4
4
  Summary: Qwak SDK and CLI for qwak models
5
5
  License: Apache-2.0
6
6
  Keywords: mlops,ml,deployment,serving,model
@@ -34,7 +34,7 @@ Requires-Dist: pyarrow (>=6.0.0) ; extra == "batch" or extra == "feature-store"
34
34
  Requires-Dist: pyathena (>=2.2.0,!=2.18.0) ; extra == "feature-store"
35
35
  Requires-Dist: pyspark (==3.4.2) ; extra == "feature-store"
36
36
  Requires-Dist: python-json-logger (>=3.2.1,<4.0.0)
37
- Requires-Dist: qwak-core (==0.4.220)
37
+ Requires-Dist: qwak-core (==0.4.247)
38
38
  Requires-Dist: qwak-inference (>=0.1.20,<0.2.0)
39
39
  Requires-Dist: rich (>=13.0.0)
40
40
  Requires-Dist: tabulate (>=0.8.0)
@@ -46,3 +46,5 @@ Description-Content-Type: text/markdown
46
46
 
47
47
  Qwak is an end-to-end production ML platform designed to allow data scientists to build, deploy, and monitor their models in production with minimal engineering friction.
48
48
 
49
+ ### Qwak SDK
50
+
@@ -1,4 +1,4 @@
1
- qwak_sdk/__init__.py,sha256=q3XWCXwhGmFGETMTEoIiiggcGW4O5OkYgl-K8JDOlPM,135
1
+ qwak_sdk/__init__.py,sha256=x6-9NBYL7J0HwjIkwNAp8QNsoknm4YVTPW4pNDTzCqs,135
2
2
  qwak_sdk/cli.py,sha256=frMefF0AmLI1g5A9aADNueUkMDjRHikKlmXIA2i4kYA,4510
3
3
  qwak_sdk/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  qwak_sdk/commands/_logic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -55,7 +55,7 @@ qwak_sdk/commands/audience/update/ui.py,sha256=BRZvhZPM8d3Xcj64X_gWpe8e42XjXCvah
55
55
  qwak_sdk/commands/auto_scalling/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
56
  qwak_sdk/commands/auto_scalling/_logic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
57
  qwak_sdk/commands/auto_scalling/_logic/config/__init__.py,sha256=XtEX4zx1KhshBzM-pOs9G7fUlrk6Fl15ejmvOetdf40,49
58
- qwak_sdk/commands/auto_scalling/_logic/config/config.py,sha256=ofTq19SJSxy-IjZNsYqNhyxm5QLDi-3siUlbqYMzXsU,3294
58
+ qwak_sdk/commands/auto_scalling/_logic/config/config.py,sha256=IYF-goAE3niI3c-UoduOBE-SdBf_sZ12mywXOyaM51w,5250
59
59
  qwak_sdk/commands/auto_scalling/_logic/config/parser.py,sha256=PPo5cgE02X0MpqELLBHIPohUafvIUndZbzamPR0Sxg0,696
60
60
  qwak_sdk/commands/auto_scalling/attach/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
61
  qwak_sdk/commands/auto_scalling/attach/_logic.py,sha256=8V4DUIsCHbUaBzQls62MnAZOoOW4BSpVQFKVLofXAJs,1359
@@ -319,7 +319,7 @@ qwak_sdk/tools/colors.py,sha256=7pui_GGjC4uZKYFsIyXaJjYsjLxJVHb4OrfTgr93hqo,287
319
319
  qwak_sdk/tools/files.py,sha256=AyKJTOy7NhvP3SrqwIw_lxYNCOy1CvLgMmSJpWZ0OKM,2257
320
320
  qwak_sdk/tools/log_handling.py,sha256=Aa1EmxUPCX8YWiZRutUvnqPv6K_z1zoGMwIWsEv24mM,6327
321
321
  qwak_sdk/tools/utils.py,sha256=SHmU4r_m2ABZyFYMC03P17GvltPbYbmB39hvalIZEtI,1168
322
- qwak_sdk-0.5.89.dist-info/METADATA,sha256=5MR1Pkv-W7ijD-R81sjmE0M7PpGIGgMvolht_CvcnUA,2316
323
- qwak_sdk-0.5.89.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
324
- qwak_sdk-0.5.89.dist-info/entry_points.txt,sha256=vSl0ELYDyj640oMM57u0AjBP87wtLYxCcGOendhEx80,47
325
- qwak_sdk-0.5.89.dist-info/RECORD,,
322
+ qwak_sdk-0.5.91.dist-info/METADATA,sha256=9HxbbVIyV4OqXwPxY-idhNu0FXEA9UQmN3GIp2nBl9Y,2330
323
+ qwak_sdk-0.5.91.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
324
+ qwak_sdk-0.5.91.dist-info/entry_points.txt,sha256=vSl0ELYDyj640oMM57u0AjBP87wtLYxCcGOendhEx80,47
325
+ qwak_sdk-0.5.91.dist-info/RECORD,,