qwak-core 0.4.276__py3-none-any.whl → 0.4.278__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.
@@ -1 +1 @@
1
- __version__ = "0.4.276"
1
+ __version__ = "0.4.278"
qwak/__init__.py CHANGED
@@ -1,7 +1,7 @@
1
1
  """Top-level package for qwak-core."""
2
2
 
3
3
  __author__ = "Qwak.ai"
4
- __version__ = "0.4.276"
4
+ __version__ = "0.4.278"
5
5
 
6
6
  from qwak.inner.di_configuration import wire_dependencies
7
7
  from qwak.model.experiment_tracking import log_metric, log_param
@@ -1,6 +1,8 @@
1
1
  from datetime import timedelta
2
2
  from time import sleep, time
3
+ from typing import Optional
3
4
 
5
+ import grpc
4
6
  from _qwak_proto.qwak.analytics.analytics_pb2 import (
5
7
  QueryResultDownloadURLParams,
6
8
  QueryStatus,
@@ -14,8 +16,9 @@ from _qwak_proto.qwak.analytics.analytics_service_pb2 import (
14
16
  from _qwak_proto.qwak.analytics.analytics_service_pb2_grpc import (
15
17
  AnalyticsQueryServiceStub,
16
18
  )
17
- from dependency_injector.wiring import Provide
19
+ from qwak.clients.location_discovery import LocationDiscoveryClient
18
20
  from qwak.inner.di_configuration import QwakContainer
21
+ from qwak.inner.tool.grpc.grpc_tools import create_grpc_channel
19
22
 
20
23
 
21
24
  class AnalyticsEngineError(RuntimeError):
@@ -26,8 +29,8 @@ class AnalyticsEngineError(RuntimeError):
26
29
 
27
30
 
28
31
  class AnalyticsEngineClient:
29
- def __init__(self, grpc_channel=Provide[QwakContainer.core_grpc_channel]):
30
- self.grpc_client = AnalyticsQueryServiceStub(grpc_channel)
32
+ def __init__(self, grpc_channel: Optional[QwakContainer.core_grpc_channel] = None):
33
+ self.grpc_client = self._create_grpc_client(grpc_channel)
31
34
 
32
35
  def get_analytics_data(self, query: str, timeout: timedelta = None) -> str:
33
36
  """
@@ -79,3 +82,25 @@ class AnalyticsEngineClient:
79
82
  request = GetQueryResultDownloadURLRequest(params=request_params)
80
83
  response = self.grpc_client.GetQueryResultDownloadURL(request)
81
84
  return response.download_url
85
+
86
+ def _create_grpc_client(
87
+ self, grpc_channel: Optional[grpc.Channel] = None
88
+ ) -> AnalyticsQueryServiceStub:
89
+ if grpc_channel:
90
+ return AnalyticsQueryServiceStub(grpc_channel)
91
+
92
+ channel = create_grpc_channel(
93
+ url=self._get_analytics_engine_url(),
94
+ status_for_retry=(
95
+ grpc.StatusCode.UNAVAILABLE,
96
+ grpc.StatusCode.CANCELLED,
97
+ ),
98
+ )
99
+ return AnalyticsQueryServiceStub(channel)
100
+
101
+ @staticmethod
102
+ def _get_analytics_engine_url() -> str:
103
+ """
104
+ Fetches the analytics engine service URL from the LocationDiscoveryService.
105
+ """
106
+ return LocationDiscoveryClient().get_analytics_engine().service_url
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: qwak-core
3
- Version: 0.4.276
3
+ Version: 0.4.278
4
4
  Summary: Qwak Core contains the necessary objects and communication tools for using the Qwak Platform
5
5
  License: Apache-2.0
6
6
  Keywords: mlops,ml,deployment,serving,model
@@ -601,7 +601,7 @@ _qwak_proto/qwak/workspace/workspace_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXH
601
601
  _qwak_proto/qwak/workspace/workspace_service_pb2.py,sha256=AB3C9S_AbOD7Nx1Ni4j1rW6PNtYTV1zjiqFQk-goQ74,21429
602
602
  _qwak_proto/qwak/workspace/workspace_service_pb2.pyi,sha256=nKKCHwnovZhsy8TSVmdz-Vtl0nviOOoX56HD-41Xo08,13726
603
603
  _qwak_proto/qwak/workspace/workspace_service_pb2_grpc.py,sha256=yKGuexxTBza99Ihe0DSTniV2ZSd_AG47inHenqfi890,27193
604
- frogml_storage/__init__.py,sha256=BlXr3uYckdOWMhffLFsOKzr_DufG6Dwiq0XoMZnxgN0,24
604
+ frogml_storage/__init__.py,sha256=GlF0ZqPI_c_FSzh36rBb6_zp-aHKjzIU7FsPffjBnx8,24
605
605
  frogml_storage/artifactory/__init__.py,sha256=C02rcm7kqsZBVA6c6Gztxamj96hn8Aj6BuzYWFRmWbQ,71
606
606
  frogml_storage/artifactory/_artifactory_api.py,sha256=z8YX90bCy82BWqMNUdpbbig1qF5CarkIOfP6V96uYYg,11188
607
607
  frogml_storage/authentication/login/__init__.py,sha256=ch8UhQwh3o5ddyoJykQ0Bnog5-8qKHmeDpwqny8xMzM,46
@@ -639,7 +639,7 @@ frogml_storage/utils/_environment.py,sha256=NEnRxaFdRDi3UA33IVTSfQxqc9ZB6nV9YlHD
639
639
  frogml_storage/utils/_input_checks_utility.py,sha256=ZUvkxhcTcbSKtpSo5ePWha3Ca5xohxIpiAlZlpcQ3xk,3221
640
640
  frogml_storage/utils/_storage_utils.py,sha256=HB2g7uY5A3b33yIcAUM1OjHb5jWsnpESsiDrEviQwrI,366
641
641
  frogml_storage/utils/_url_utils.py,sha256=NUEfz9Fp1iE8b676-A5wrMlSTsJVRKrUhcUItOFAJD8,821
642
- qwak/__init__.py,sha256=91UfSER818MVRSdl5aJAonCIC_KGYYa4YYp8G8B1cvk,587
642
+ qwak/__init__.py,sha256=6XzzDEU0zC9EdfFRTw4REa9bXshk7DRrEX7hj52Yij8,587
643
643
  qwak/automations/__init__.py,sha256=qFZRvCxUUn8gcxkJR0v19ulHW2oJ0x6-Rif7HiheDP4,1522
644
644
  qwak/automations/automation_executions.py,sha256=5MeH_epYYWb8NKXgAozwT_jPyyUDednBHG7izloi7RY,3228
645
645
  qwak/automations/automations.py,sha256=3yx8e2v0uSKDnXbqyknasyEoQ5vxGni6K40Hbi1_zkk,12599
@@ -667,7 +667,7 @@ qwak/clients/alerts_registry/__init__.py,sha256=RszIZ4jLzCLapZQ3iQt0lTWPtttf9HWi
667
667
  qwak/clients/alerts_registry/channel.py,sha256=k7ghsOuS-zi-7SnwxnMhwdZ0vy0CdzYlDVKxVBzf8pQ,4040
668
668
  qwak/clients/alerts_registry/client.py,sha256=bOl-w5h5YDSWdtyYylwMCtL5nkUkU6Qe0-pcxNsGM4Q,5355
669
669
  qwak/clients/analytics/__init__.py,sha256=bSerqCrPyfBWnKDHT0ncofKUU-4NjmQZFZ2Uf66a4eA,42
670
- qwak/clients/analytics/client.py,sha256=7Yk8AM0bdsCvU-FMx-Aerrl3U3M56RJeQ5OeiVIaXLk,3093
670
+ qwak/clients/analytics/client.py,sha256=rbe2YTg2VLfCkO4e0VxaI5gJkjkvMkvRFjKkdBPMnSk,3965
671
671
  qwak/clients/audience/__init__.py,sha256=WMgEXjWSmDFUC3A3L8Fe3OoPv2SrQNXY-1OPQpuqGHM,35
672
672
  qwak/clients/audience/client.py,sha256=L5U1yEJobIB5VAYC8mq5IqgQiZ0JW-akCxBTDKnI9Zs,2110
673
673
  qwak/clients/automation_management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -1113,6 +1113,6 @@ qwak_services_mock/mocks/workspace_manager_service_mock.py,sha256=O9ZSwln4T4kHVk
1113
1113
  qwak_services_mock/services_mock.py,sha256=zXtHcX8a_acz7ynxuCBxxVpHpde7aAGjIn6Uw52LY1s,19593
1114
1114
  qwak_services_mock/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1115
1115
  qwak_services_mock/utils/service_utils.py,sha256=ZlB0CnB1J6oBn6_m7fQO2U8tKoboHdUa6ljjkRMYNXU,265
1116
- qwak_core-0.4.276.dist-info/METADATA,sha256=_fbvMv1pWNG8NA3dfZowU7Fq4EJgs3HPEQzUX1B2jW8,15142
1117
- qwak_core-0.4.276.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
1118
- qwak_core-0.4.276.dist-info/RECORD,,
1116
+ qwak_core-0.4.278.dist-info/METADATA,sha256=UiMORjjbOv20bew6FQjYzEf-dwCJKf1m3SPDzFha4H0,15142
1117
+ qwak_core-0.4.278.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
1118
+ qwak_core-0.4.278.dist-info/RECORD,,