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 +1 -1
- frogml_core/clients/analytics/client.py +31 -5
- {frogml_core-0.0.101.dist-info → frogml_core-0.0.102.dist-info}/METADATA +1 -1
- {frogml_core-0.0.101.dist-info → frogml_core-0.0.102.dist-info}/RECORD +6 -6
- frogml_storage/__init__.py +1 -1
- {frogml_core-0.0.101.dist-info → frogml_core-0.0.102.dist-info}/WHEEL +0 -0
frogml_core/__init__.py
CHANGED
@@ -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
|
-
|
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__(
|
31
|
-
self.
|
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,4 +1,4 @@
|
|
1
|
-
frogml_core/__init__.py,sha256=
|
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=
|
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=
|
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.
|
1157
|
-
frogml_core-0.0.
|
1158
|
-
frogml_core-0.0.
|
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,,
|
frogml_storage/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.0.
|
1
|
+
__version__ = "0.0.102"
|
File without changes
|