esd-services-api-client 2.5.13a144.dev1__py3-none-any.whl → 2.5.14a148.dev5__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.
- esd_services_api_client/_version.py +1 -1
- esd_services_api_client/nexus/README.md +1 -1
- esd_services_api_client/nexus/core/app_core.py +36 -22
- esd_services_api_client/nexus/core/app_dependencies.py +8 -12
- {esd_services_api_client-2.5.13a144.dev1.dist-info → esd_services_api_client-2.5.14a148.dev5.dist-info}/METADATA +1 -1
- {esd_services_api_client-2.5.13a144.dev1.dist-info → esd_services_api_client-2.5.14a148.dev5.dist-info}/RECORD +8 -8
- {esd_services_api_client-2.5.13a144.dev1.dist-info → esd_services_api_client-2.5.14a148.dev5.dist-info}/LICENSE +0 -0
- {esd_services_api_client-2.5.13a144.dev1.dist-info → esd_services_api_client-2.5.14a148.dev5.dist-info}/WHEEL +0 -0
@@ -1 +1 @@
|
|
1
|
-
__version__ = 'v2.5.
|
1
|
+
__version__ = 'v2.5.14a148.dev5'
|
@@ -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.
|
@@ -265,14 +260,25 @@ class Nexus:
|
|
265
260
|
|
266
261
|
self._injector = Injector(self._configurator.injection_binds)
|
267
262
|
|
268
|
-
algorithm: BaselineAlgorithm = self._injector.get(self._algorithm_class)
|
269
|
-
telemetry_recorder: TelemetryRecorder = self._injector.get(TelemetryRecorder)
|
270
263
|
root_logger: LoggerInterface = self._injector.get(LoggerFactory).create_logger(
|
271
264
|
logger_type=self.__class__,
|
272
265
|
)
|
273
266
|
|
274
267
|
root_logger.start()
|
275
268
|
|
269
|
+
for payload_type in self._payload_types:
|
270
|
+
try:
|
271
|
+
payload = await self._get_payload(payload_type=payload_type)
|
272
|
+
self._injector.binder.bind(
|
273
|
+
payload.__class__, to=payload, scope=singleton
|
274
|
+
)
|
275
|
+
except BaseException as ex: # pylint: disable=broad-except
|
276
|
+
root_logger.error("Error reading algorithm payload", ex)
|
277
|
+
sys.exit(1)
|
278
|
+
|
279
|
+
algorithm: BaselineAlgorithm = self._injector.get(self._algorithm_class)
|
280
|
+
telemetry_recorder: TelemetryRecorder = self._injector.get(TelemetryRecorder)
|
281
|
+
|
276
282
|
root_logger.info(
|
277
283
|
"Running algorithm {algorithm} on Nexus version {version}",
|
278
284
|
algorithm=algorithm.__class__.__name__,
|
@@ -286,6 +292,14 @@ class Nexus:
|
|
286
292
|
await self._algorithm_run_task
|
287
293
|
ex = self._algorithm_run_task.exception()
|
288
294
|
|
295
|
+
if ex is not None:
|
296
|
+
root_logger.error(
|
297
|
+
"Algorithm {algorithm} run failed on Nexus version {version}",
|
298
|
+
ex,
|
299
|
+
algorithm=self._algorithm_class,
|
300
|
+
version=__version__,
|
301
|
+
)
|
302
|
+
|
289
303
|
await self._submit_result(
|
290
304
|
self._algorithm_run_task.result() if not ex else None,
|
291
305
|
self._algorithm_run_task.exception(),
|
@@ -42,9 +42,6 @@ from esd_services_api_client.nexus.exceptions.startup_error import (
|
|
42
42
|
)
|
43
43
|
from esd_services_api_client.nexus.input.input_processor import InputProcessor
|
44
44
|
from esd_services_api_client.nexus.input.input_reader import InputReader
|
45
|
-
from esd_services_api_client.nexus.input.payload_reader import (
|
46
|
-
AlgorithmPayload,
|
47
|
-
)
|
48
45
|
from esd_services_api_client.nexus.telemetry.recorder import TelemetryRecorder
|
49
46
|
from esd_services_api_client.nexus.core.serializers import (
|
50
47
|
TelemetrySerializer,
|
@@ -247,6 +244,7 @@ class ServiceConfigurator:
|
|
247
244
|
CacheModule(),
|
248
245
|
type(f"{TelemetryRecorder.__name__}Module", (Module,), {})(),
|
249
246
|
]
|
247
|
+
self._runtime_injection_binds = []
|
250
248
|
|
251
249
|
@property
|
252
250
|
def injection_binds(self) -> list:
|
@@ -255,6 +253,13 @@ class ServiceConfigurator:
|
|
255
253
|
"""
|
256
254
|
return self._injection_binds
|
257
255
|
|
256
|
+
@property
|
257
|
+
def runtime_injection_binds(self) -> list:
|
258
|
+
"""
|
259
|
+
Currently configured injection bindings that are added at runtime
|
260
|
+
"""
|
261
|
+
return self._runtime_injection_binds
|
262
|
+
|
258
263
|
def with_module(self, module: Type[Module]) -> "ServiceConfigurator":
|
259
264
|
"""
|
260
265
|
Adds a (custom) module into the DI container.
|
@@ -280,15 +285,6 @@ class ServiceConfigurator:
|
|
280
285
|
)
|
281
286
|
return self
|
282
287
|
|
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
288
|
def with_configuration(self, config: NexusConfiguration) -> "ServiceConfigurator":
|
293
289
|
"""
|
294
290
|
Adds the specified payload instance to the DI container.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
esd_services_api_client/__init__.py,sha256=4LskDwFuAFMOjHtN3_-71G_VZ4MNfjMJ7wX2cHYxV-0,648
|
2
|
-
esd_services_api_client/_version.py,sha256=
|
2
|
+
esd_services_api_client/_version.py,sha256=FrmlYBMHa48XHRqBIZUWCZDO-FJfblJzIeg6CSTLDmE,33
|
3
3
|
esd_services_api_client/beast/__init__.py,sha256=zNhXcHSP5w4P9quM1XP4oXVJEccvC_VScG41TZ0GzZ8,723
|
4
4
|
esd_services_api_client/beast/v3/__init__.py,sha256=FtumtInoDyCCRE424Llqv8QZLRuwXzj-smyfu1od1nc,754
|
5
5
|
esd_services_api_client/beast/v3/_connector.py,sha256=VqxiCzJWKERh42aZAIphzmOEG5cdOcKM0DQzG7eQ_-8,11479
|
@@ -15,7 +15,7 @@ esd_services_api_client/crystal/__init__.py,sha256=oeyJjdQ9EpTnIq6XnjPq5v0DWPdHq
|
|
15
15
|
esd_services_api_client/crystal/_api_versions.py,sha256=GHbmV_5lP9fP72TZE0j_ZeQSeJjMRcRaBRxNJbz-MWQ,837
|
16
16
|
esd_services_api_client/crystal/_connector.py,sha256=0CqBpPahozAnentM6ZZrH84s_D7SoWCShr5_cRQGMX8,13110
|
17
17
|
esd_services_api_client/crystal/_models.py,sha256=j8SEbwp_iAKjn06i-0f8npmhQhs2YJlmQ3eHwc2TwQE,4366
|
18
|
-
esd_services_api_client/nexus/README.md,sha256=
|
18
|
+
esd_services_api_client/nexus/README.md,sha256=2-o9TeOYsVlUm72LsI6HUVaVx6ndYblRVDE7ncosYNQ,10032
|
19
19
|
esd_services_api_client/nexus/__init__.py,sha256=sOgKKq3_LZGbLmQMtMS7lDw2hv027qownTmNIRV0BB8,627
|
20
20
|
esd_services_api_client/nexus/abstractions/__init__.py,sha256=sOgKKq3_LZGbLmQMtMS7lDw2hv027qownTmNIRV0BB8,627
|
21
21
|
esd_services_api_client/nexus/abstractions/algrorithm_cache.py,sha256=6GevJJ7mf1c_PImhKQ_4_6n652VyHlgK_12LNidirxs,3644
|
@@ -33,8 +33,8 @@ esd_services_api_client/nexus/algorithms/recursive.py,sha256=uaCCl4q-st_KqbcmkdO
|
|
33
33
|
esd_services_api_client/nexus/configurations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
34
34
|
esd_services_api_client/nexus/configurations/algorithm_configuration.py,sha256=eE7diX2PATCGkmqhvFOcZwXrr6vns4fqnJGmgNvhhZM,1091
|
35
35
|
esd_services_api_client/nexus/core/__init__.py,sha256=sOgKKq3_LZGbLmQMtMS7lDw2hv027qownTmNIRV0BB8,627
|
36
|
-
esd_services_api_client/nexus/core/app_core.py,sha256=
|
37
|
-
esd_services_api_client/nexus/core/app_dependencies.py,sha256=
|
36
|
+
esd_services_api_client/nexus/core/app_core.py,sha256=SNKcD0nOXdq1P_9T2-aQr1mZZ2qApRlf6i40DW_8iq0,12811
|
37
|
+
esd_services_api_client/nexus/core/app_dependencies.py,sha256=tA18Smbiv1HjgXnpCHnigrR2mTmIeZawPKxMH0pezIU,8615
|
38
38
|
esd_services_api_client/nexus/core/serializers.py,sha256=Vk9FaEeDHXx3S7rPlYoWzsOcN6gzLzemsrjq6ytfaI0,2217
|
39
39
|
esd_services_api_client/nexus/exceptions/__init__.py,sha256=feN33VdqB5-2bD9aJesJl_OlsKrNNo3hZCnQgKuaU9k,696
|
40
40
|
esd_services_api_client/nexus/exceptions/_nexus_error.py,sha256=QvtY38mNoIA6t26dUN6UIsaPfljhtVNsbQVS7ksMb-Q,895
|
@@ -51,7 +51,7 @@ esd_services_api_client/nexus/modules/mlflow_module.py,sha256=d4y8XetGF37md4dEpE
|
|
51
51
|
esd_services_api_client/nexus/telemetry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
52
52
|
esd_services_api_client/nexus/telemetry/recorder.py,sha256=-shxk2vYDTafJ0U3CzkHxIHBQtxVJ1ZNI4ST0p1YV2g,4801
|
53
53
|
esd_services_api_client/nexus/telemetry/user_telemetry_recorder.py,sha256=NgnjSY64nEx1kslkdomENC6vMqkEOpfXggJXwm-NyFs,5163
|
54
|
-
esd_services_api_client-2.5.
|
55
|
-
esd_services_api_client-2.5.
|
56
|
-
esd_services_api_client-2.5.
|
57
|
-
esd_services_api_client-2.5.
|
54
|
+
esd_services_api_client-2.5.14a148.dev5.dist-info/LICENSE,sha256=0gS6zXsPp8qZhzi1xaGCIYPzb_0e8on7HCeFJe8fOpw,10693
|
55
|
+
esd_services_api_client-2.5.14a148.dev5.dist-info/METADATA,sha256=PCgeW72rd26I9ZuEXh2kaTO8hW7RGtU414USNQg1d5w,1174
|
56
|
+
esd_services_api_client-2.5.14a148.dev5.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
57
|
+
esd_services_api_client-2.5.14a148.dev5.dist-info/RECORD,,
|
File without changes
|
File without changes
|