frogml-core 0.0.101__py3-none-any.whl → 0.0.102__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.
frogml_core/__init__.py CHANGED
@@ -1,7 +1,7 @@
1
1
  """Top-level package for frogml."""
2
2
 
3
3
  __author__ = "jfrog"
4
- __version__ = "0.0.101"
4
+ __version__ = "0.0.102"
5
5
 
6
6
  from frogml_core.inner.di_configuration import wire_dependencies
7
7
  from frogml_core.model.model_version_tracking import ( # noqa: F401,E501
@@ -1,8 +1,11 @@
1
1
  from datetime import timedelta
2
2
  from time import sleep, time
3
+ from typing import Optional
3
4
 
4
- from dependency_injector.wiring import Provide
5
-
5
+ import grpc
6
+ from frogml_core.clients.location_discovery import LocationDiscoveryClient
7
+ from frogml_core.inner.di_configuration import FrogmlContainer
8
+ from frogml_core.inner.tool.grpc.grpc_tools import create_grpc_channel
6
9
  from frogml_proto.qwak.analytics.analytics_pb2 import (
7
10
  QueryResultDownloadURLParams,
8
11
  QueryStatus,
@@ -16,7 +19,6 @@ from frogml_proto.qwak.analytics.analytics_service_pb2 import (
16
19
  from frogml_proto.qwak.analytics.analytics_service_pb2_grpc import (
17
20
  AnalyticsQueryServiceStub,
18
21
  )
19
- from frogml_core.inner.di_configuration import FrogmlContainer
20
22
 
21
23
 
22
24
  class AnalyticsEngineError(RuntimeError):
@@ -27,8 +29,10 @@ class AnalyticsEngineError(RuntimeError):
27
29
 
28
30
 
29
31
  class AnalyticsEngineClient:
30
- def __init__(self, grpc_channel=Provide[FrogmlContainer.core_grpc_channel]):
31
- self.grpc_client = AnalyticsQueryServiceStub(grpc_channel)
32
+ def __init__(
33
+ self, grpc_channel: Optional[FrogmlContainer.core_grpc_channel] = None
34
+ ):
35
+ self.grpc_client = self._create_grpc_client(grpc_channel)
32
36
 
33
37
  def get_analytics_data(self, query: str, timeout: timedelta = None) -> str:
34
38
  """
@@ -80,3 +84,25 @@ class AnalyticsEngineClient:
80
84
  request = GetQueryResultDownloadURLRequest(params=request_params)
81
85
  response = self.grpc_client.GetQueryResultDownloadURL(request)
82
86
  return response.download_url
87
+
88
+ def _create_grpc_client(
89
+ self, grpc_channel: Optional[grpc.Channel] = None
90
+ ) -> AnalyticsQueryServiceStub:
91
+ if grpc_channel:
92
+ return AnalyticsQueryServiceStub(grpc_channel)
93
+
94
+ channel = create_grpc_channel(
95
+ url=self._get_analytics_engine_url(),
96
+ status_for_retry=(
97
+ grpc.StatusCode.UNAVAILABLE,
98
+ grpc.StatusCode.CANCELLED,
99
+ ),
100
+ )
101
+ return AnalyticsQueryServiceStub(channel)
102
+
103
+ @staticmethod
104
+ def _get_analytics_engine_url() -> str:
105
+ """
106
+ Fetches the analytics engine service URL from the LocationDiscoveryService.
107
+ """
108
+ return LocationDiscoveryClient().get_analytics_engine().service_url
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: frogml-core
3
- Version: 0.0.101
3
+ Version: 0.0.102
4
4
  Summary: frogml Core contains the necessary objects and communication tools for using the Jfrog ml Platform
5
5
  License: Apache-2.0
6
6
  Keywords: mlops,ml,deployment,serving,model
@@ -1,4 +1,4 @@
1
- frogml_core/__init__.py,sha256=4z0TII-k4c2lgF2Z_V7DYetUqOIU-Q_S08zc8UHtPAI,778
1
+ frogml_core/__init__.py,sha256=DnKYcSHTL3k9v5mU-XujGUZRHWr0VFbcoD43pkDhdXY,778
2
2
  frogml_core/automations/__init__.py,sha256=j2gD15MN-xVWhI5rAFsDwhL0CIyICLNT0scXsKvNBkU,1547
3
3
  frogml_core/automations/automation_executions.py,sha256=xpOb9Dq8gPPGNQDJTvBBZbNz4woZDRZY0HqnLSu7pwU,3230
4
4
  frogml_core/automations/automations.py,sha256=GKEQyQMi8sxX5oZn62PaxPi0zD8IaJRjBkhczRJxHNs,13070
@@ -26,7 +26,7 @@ frogml_core/clients/alerts_registry/__init__.py,sha256=RszIZ4jLzCLapZQ3iQt0lTWPt
26
26
  frogml_core/clients/alerts_registry/channel.py,sha256=7NphgqqpcAsV31D_gsVJhm1ENLYaWWJAWsD-BRLzATQ,4058
27
27
  frogml_core/clients/alerts_registry/client.py,sha256=Ziy2qWjXwcbVkWQymgbU7faJ_eRmEwN6fPLB62lR4hA,5406
28
28
  frogml_core/clients/analytics/__init__.py,sha256=bSerqCrPyfBWnKDHT0ncofKUU-4NjmQZFZ2Uf66a4eA,42
29
- frogml_core/clients/analytics/client.py,sha256=jzkrczNpOlGpn80uVDrbrfoeFOcBjzfsSkqnQpEJsWI,3108
29
+ frogml_core/clients/analytics/client.py,sha256=gdRT8-NT2YbRCbdy23IVWZzLAoEd0sZ_yAjWu_CfCL4,4007
30
30
  frogml_core/clients/audience/__init__.py,sha256=WMgEXjWSmDFUC3A3L8Fe3OoPv2SrQNXY-1OPQpuqGHM,35
31
31
  frogml_core/clients/audience/client.py,sha256=FIacuza9skP81Pj2gNU1mzafa6aXcubv3R1_dfcDus4,2125
32
32
  frogml_core/clients/automation_management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -1114,7 +1114,7 @@ frogml_services_mock/mocks/workspace_manager_service_mock.py,sha256=WbOiWgOyr-xT
1114
1114
  frogml_services_mock/services_mock.py,sha256=sgKgwhu2W0YOHtzil8x7f1znK_sZr_i27XSeiF4xqVE,21200
1115
1115
  frogml_services_mock/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1116
1116
  frogml_services_mock/utils/service_utils.py,sha256=ZlB0CnB1J6oBn6_m7fQO2U8tKoboHdUa6ljjkRMYNXU,265
1117
- frogml_storage/__init__.py,sha256=TyaYK2YyDFzWjL2Sm55Lwi_AIuIz9SMdMXLntdeh95o,24
1117
+ frogml_storage/__init__.py,sha256=NwgaP3r0RQBB6vGkoVP2n9r1kcxM5G7WposnBkzezhs,24
1118
1118
  frogml_storage/_environment.py,sha256=zuzOJBtBwFaguwn_JkKjfhXStZoustgP30KzOP3mYv8,707
1119
1119
  frogml_storage/artifactory/__init__.py,sha256=C02rcm7kqsZBVA6c6Gztxamj96hn8Aj6BuzYWFRmWbQ,71
1120
1120
  frogml_storage/artifactory/_artifactory_api.py,sha256=Oz0HOpQPSNwWIVAy94UJUyPhLetc7sdZjoTfSXtrFug,11200
@@ -1153,6 +1153,6 @@ frogml_storage/utils/__init__.py,sha256=HQUWfuGUIPZY7kfS795TRW8BQ4WmNqrNjS7lUrbx
1153
1153
  frogml_storage/utils/_input_checks_utility.py,sha256=CFiJOdTBS9piJMtR3lemEz27wZcQ6_-7XESu8iy-mrw,3221
1154
1154
  frogml_storage/utils/_storage_utils.py,sha256=HB2g7uY5A3b33yIcAUM1OjHb5jWsnpESsiDrEviQwrI,366
1155
1155
  frogml_storage/utils/_url_utils.py,sha256=NUEfz9Fp1iE8b676-A5wrMlSTsJVRKrUhcUItOFAJD8,821
1156
- frogml_core-0.0.101.dist-info/METADATA,sha256=IyP9PUbLkhZ6VGpbPHteLlwCXR7BhggClvcg40TEG8o,14976
1157
- frogml_core-0.0.101.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
1158
- frogml_core-0.0.101.dist-info/RECORD,,
1156
+ frogml_core-0.0.102.dist-info/METADATA,sha256=OBtK03EexmdzE2wtcs9P9qBuvExHj--bMsnp7KIGW3o,14976
1157
+ frogml_core-0.0.102.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
1158
+ frogml_core-0.0.102.dist-info/RECORD,,
@@ -1 +1 @@
1
- __version__ = "0.0.101"
1
+ __version__ = "0.0.102"