esd-services-api-client 2.5.13__tar.gz → 2.5.14a148.dev1__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.
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/PKG-INFO +1 -1
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/__init__.py +1 -1
- esd_services_api_client-2.5.14a148.dev1/esd_services_api_client/_version.py +1 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/README.md +1 -1
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/core/app_core.py +33 -20
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/core/app_dependencies.py +8 -9
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/pyproject.toml +1 -1
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/LICENSE +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/README.md +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/beast/__init__.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/beast/v3/__init__.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/beast/v3/_connector.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/beast/v3/_models.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/boxer/README.md +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/boxer/__init__.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/boxer/_auth.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/boxer/_base.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/boxer/_connector.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/boxer/_models.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/common/__init__.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/crystal/__init__.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/crystal/_api_versions.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/crystal/_connector.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/crystal/_models.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/__init__.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/abstractions/__init__.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/abstractions/algrorithm_cache.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/abstractions/input_object.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/abstractions/logger_factory.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/abstractions/nexus_object.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/abstractions/socket_provider.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/algorithms/__init__.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/algorithms/_baseline_algorithm.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/algorithms/_remote_algorithm.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/algorithms/distributed.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/algorithms/forked_algorithm.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/algorithms/minimalistic.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/algorithms/recursive.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/configurations/__init__.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/configurations/algorithm_configuration.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/core/__init__.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/core/serializers.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/exceptions/__init__.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/exceptions/_nexus_error.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/exceptions/cache_errors.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/exceptions/input_reader_error.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/exceptions/startup_error.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/input/__init__.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/input/input_processor.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/input/input_reader.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/input/payload_reader.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/modules/__init__.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/modules/astra_client_module.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/modules/mlflow_module.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/telemetry/__init__.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/telemetry/recorder.py +0 -0
- {esd_services_api_client-2.5.13 → esd_services_api_client-2.5.14a148.dev1}/esd_services_api_client/nexus/telemetry/user_telemetry_recorder.py +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = 'v2.5.14a148.dev1'
|
@@ -27,12 +27,11 @@ from typing import final, Type, Optional
|
|
27
27
|
|
28
28
|
import backoff
|
29
29
|
import urllib3.exceptions
|
30
|
-
import azure.core.exceptions
|
31
30
|
from adapta.logs import LoggerInterface
|
32
31
|
from adapta.process_communication import DataSocket
|
33
32
|
from adapta.storage.blob.base import StorageClient
|
34
33
|
from adapta.storage.query_enabled_store import QueryEnabledStore
|
35
|
-
from injector import Injector, Module
|
34
|
+
from injector import Injector, Module, singleton
|
36
35
|
|
37
36
|
import esd_services_api_client.nexus.exceptions
|
38
37
|
from esd_services_api_client.crystal import (
|
@@ -119,6 +118,7 @@ class Nexus:
|
|
119
118
|
self._run_args = args
|
120
119
|
self._algorithm_run_task: Optional[asyncio.Task] = None
|
121
120
|
self._on_complete_tasks: list[type[UserTelemetryRecorder]] = []
|
121
|
+
self._payload_types: list[type[AlgorithmPayload]] = []
|
122
122
|
|
123
123
|
attach_signal_handlers()
|
124
124
|
|
@@ -157,22 +157,11 @@ class Nexus:
|
|
157
157
|
self._algorithm_class = algorithm
|
158
158
|
return self
|
159
159
|
|
160
|
-
|
160
|
+
def inject_payload(self, *payload_types: Type[AlgorithmPayload]) -> "Nexus":
|
161
161
|
"""
|
162
|
-
Adds
|
162
|
+
Adds payload types to inject to the DI container. Payloads will be deserialized at runtime.
|
163
163
|
"""
|
164
|
-
|
165
|
-
|
166
|
-
async def get_payload() -> payload_type: # pylint: disable=W0640
|
167
|
-
async with AlgorithmPayloadReader(
|
168
|
-
payload_uri=self._run_args.sas_uri,
|
169
|
-
payload_type=payload_type, # pylint: disable=W0640
|
170
|
-
) as reader:
|
171
|
-
return reader.payload
|
172
|
-
|
173
|
-
# pylint warnings are silenced here because closure is called inside the same loop it is defined, thus each value of a loop variable is used
|
174
|
-
|
175
|
-
self._configurator = self._configurator.with_payload((await get_payload()))
|
164
|
+
self._payload_types = payload_types
|
176
165
|
return self
|
177
166
|
|
178
167
|
def inject_configuration(
|
@@ -202,10 +191,7 @@ class Nexus:
|
|
202
191
|
) -> None:
|
203
192
|
@backoff.on_exception(
|
204
193
|
wait_gen=backoff.expo,
|
205
|
-
exception=(
|
206
|
-
azure.core.exceptions.HttpResponseError,
|
207
|
-
urllib3.exceptions.HTTPError,
|
208
|
-
),
|
194
|
+
exception=(urllib3.exceptions.HTTPError,),
|
209
195
|
max_time=10,
|
210
196
|
raise_on_giveup=True,
|
211
197
|
)
|
@@ -258,6 +244,15 @@ class Nexus:
|
|
258
244
|
case _:
|
259
245
|
sys.exit(1)
|
260
246
|
|
247
|
+
async def _get_payload(
|
248
|
+
self, payload_type: type[AlgorithmPayload]
|
249
|
+
) -> AlgorithmPayload:
|
250
|
+
async with AlgorithmPayloadReader(
|
251
|
+
payload_uri=self._run_args.sas_uri,
|
252
|
+
payload_type=payload_type,
|
253
|
+
) as reader:
|
254
|
+
return reader.payload
|
255
|
+
|
261
256
|
async def activate(self):
|
262
257
|
"""
|
263
258
|
Activates the run sequence.
|
@@ -273,6 +268,16 @@ class Nexus:
|
|
273
268
|
|
274
269
|
root_logger.start()
|
275
270
|
|
271
|
+
for payload_type in self._payload_types:
|
272
|
+
try:
|
273
|
+
payload = await self._get_payload(payload_type=payload_type)
|
274
|
+
self._injector.binder.bind(
|
275
|
+
payload.__class__, to=payload, scope=singleton
|
276
|
+
)
|
277
|
+
except BaseException as ex: # pylint: disable=broad-except
|
278
|
+
root_logger.error("Error reading algorithm payload", ex)
|
279
|
+
sys.exit(1)
|
280
|
+
|
276
281
|
root_logger.info(
|
277
282
|
"Running algorithm {algorithm} on Nexus version {version}",
|
278
283
|
algorithm=algorithm.__class__.__name__,
|
@@ -286,6 +291,14 @@ class Nexus:
|
|
286
291
|
await self._algorithm_run_task
|
287
292
|
ex = self._algorithm_run_task.exception()
|
288
293
|
|
294
|
+
if ex is not None:
|
295
|
+
root_logger.error(
|
296
|
+
"Algorithm {algorithm} run failed on Nexus version {version}",
|
297
|
+
ex,
|
298
|
+
algorithm=self._algorithm_class,
|
299
|
+
version=__version__,
|
300
|
+
)
|
301
|
+
|
289
302
|
await self._submit_result(
|
290
303
|
self._algorithm_run_task.result() if not ex else None,
|
291
304
|
self._algorithm_run_task.exception(),
|
@@ -247,6 +247,7 @@ class ServiceConfigurator:
|
|
247
247
|
CacheModule(),
|
248
248
|
type(f"{TelemetryRecorder.__name__}Module", (Module,), {})(),
|
249
249
|
]
|
250
|
+
self._runtime_injection_binds = []
|
250
251
|
|
251
252
|
@property
|
252
253
|
def injection_binds(self) -> list:
|
@@ -255,6 +256,13 @@ class ServiceConfigurator:
|
|
255
256
|
"""
|
256
257
|
return self._injection_binds
|
257
258
|
|
259
|
+
@property
|
260
|
+
def runtime_injection_binds(self) -> list:
|
261
|
+
"""
|
262
|
+
Currently configured injection bindings that are added at runtime
|
263
|
+
"""
|
264
|
+
return self._runtime_injection_binds
|
265
|
+
|
258
266
|
def with_module(self, module: Type[Module]) -> "ServiceConfigurator":
|
259
267
|
"""
|
260
268
|
Adds a (custom) module into the DI container.
|
@@ -280,15 +288,6 @@ class ServiceConfigurator:
|
|
280
288
|
)
|
281
289
|
return self
|
282
290
|
|
283
|
-
def with_payload(self, payload: AlgorithmPayload) -> "ServiceConfigurator":
|
284
|
-
"""
|
285
|
-
Adds the specified payload instance to the DI container.
|
286
|
-
"""
|
287
|
-
self._injection_binds.append(
|
288
|
-
lambda binder: binder.bind(payload.__class__, to=payload, scope=singleton)
|
289
|
-
)
|
290
|
-
return self
|
291
|
-
|
292
291
|
def with_configuration(self, config: NexusConfiguration) -> "ServiceConfigurator":
|
293
292
|
"""
|
294
293
|
Adds the specified payload instance to the DI container.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "esd-services-api-client"
|
3
|
-
version = "
|
3
|
+
version = "v2.5.14a148.dev1"
|
4
4
|
description = "Python clients for ESD services"
|
5
5
|
authors = ["ECCO Sneaks & Data <esdsupport@ecco.com>"]
|
6
6
|
maintainers = ['GZU <gzu@ecco.com>', 'JRB <ext-jrb@ecco.com>', 'VISA <visa@ecco.com>']
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|