esd-services-api-client 2.5.1a123.dev5__tar.gz → 2.5.3__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.1a123.dev5 → esd_services_api_client-2.5.3}/PKG-INFO +1 -1
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/__init__.py +1 -1
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/algorithms/forked_algorithm.py +63 -14
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/core/app_core.py +4 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/telemetry/recorder.py +25 -23
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/telemetry/user_telemetry_recorder.py +3 -1
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/pyproject.toml +1 -1
- esd_services_api_client-2.5.1a123.dev5/esd_services_api_client/_version.py +0 -1
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/LICENSE +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/README.md +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/beast/__init__.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/beast/v3/__init__.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/beast/v3/_connector.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/beast/v3/_models.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/boxer/README.md +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/boxer/__init__.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/boxer/_auth.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/boxer/_base.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/boxer/_connector.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/boxer/_models.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/common/__init__.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/crystal/__init__.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/crystal/_api_versions.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/crystal/_connector.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/crystal/_models.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/README.md +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/__init__.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/abstractions/__init__.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/abstractions/algrorithm_cache.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/abstractions/input_object.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/abstractions/logger_factory.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/abstractions/nexus_object.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/abstractions/socket_provider.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/algorithms/__init__.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/algorithms/_baseline_algorithm.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/algorithms/_remote_algorithm.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/algorithms/distributed.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/algorithms/minimalistic.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/algorithms/recursive.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/configurations/__init__.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/configurations/algorithm_configuration.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/core/__init__.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/core/app_dependencies.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/core/serializers.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/exceptions/__init__.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/exceptions/_nexus_error.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/exceptions/cache_errors.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/exceptions/input_reader_error.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/exceptions/startup_error.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/input/__init__.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/input/input_processor.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/input/input_reader.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/input/payload_reader.py +0 -0
- {esd_services_api_client-2.5.1a123.dev5 → esd_services_api_client-2.5.3}/esd_services_api_client/nexus/telemetry/__init__.py +0 -0
@@ -64,19 +64,61 @@ class ForkedAlgorithm(NexusObject[TPayload, AlgorithmResult]):
|
|
64
64
|
self,
|
65
65
|
metrics_provider: MetricsProvider,
|
66
66
|
logger_factory: LoggerFactory,
|
67
|
-
forks: list[RemoteAlgorithm],
|
68
67
|
*input_processors: InputProcessor,
|
69
68
|
cache: InputCache,
|
70
69
|
):
|
71
70
|
super().__init__(metrics_provider, logger_factory)
|
72
71
|
self._input_processors = input_processors
|
73
|
-
self._forks = forks
|
74
72
|
self._cache = cache
|
73
|
+
self._inputs: dict = {}
|
74
|
+
|
75
|
+
@property
|
76
|
+
def inputs(self) -> dict:
|
77
|
+
"""
|
78
|
+
Inputs generated for this algorithm run.
|
79
|
+
"""
|
80
|
+
return self._inputs
|
81
|
+
|
82
|
+
@abstractmethod
|
83
|
+
async def _get_forks(self, **kwargs) -> list[RemoteAlgorithm]:
|
84
|
+
"""
|
85
|
+
Resolve forks to be used in this run, if any
|
86
|
+
"""
|
87
|
+
|
88
|
+
@abstractmethod
|
89
|
+
async def _main_run(self, **kwargs) -> AlgorithmResult:
|
90
|
+
"""
|
91
|
+
Logic to use for the main run - if this node is the root node - **this result** will be returned to the client.
|
92
|
+
"""
|
93
|
+
|
94
|
+
@abstractmethod
|
95
|
+
async def _fork_run(self, **kwargs) -> AlgorithmResult:
|
96
|
+
"""
|
97
|
+
Logic to use for the fork - if this node is **NOT** the root node - **result will be ignored by the client**.
|
98
|
+
"""
|
75
99
|
|
76
100
|
@abstractmethod
|
77
|
-
async def
|
101
|
+
async def _is_forked(self, **kwargs) -> bool:
|
78
102
|
"""
|
79
|
-
|
103
|
+
Determine if this is the main run or a fork run.
|
104
|
+
"""
|
105
|
+
|
106
|
+
async def _default_inputs(self, **kwargs) -> dict:
|
107
|
+
"""
|
108
|
+
Generate inputs by invoking all processors.
|
109
|
+
"""
|
110
|
+
return await self._cache.resolve(*self._input_processors, **kwargs)
|
111
|
+
|
112
|
+
@abstractmethod
|
113
|
+
async def _main_inputs(self, **kwargs) -> dict:
|
114
|
+
"""
|
115
|
+
Sets inputs for the main run - if this node is the root node
|
116
|
+
"""
|
117
|
+
|
118
|
+
@abstractmethod
|
119
|
+
async def _fork_inputs(self, **kwargs) -> dict:
|
120
|
+
"""
|
121
|
+
Sets inputs for the forked run - if this node is **NOT** the root node
|
80
122
|
"""
|
81
123
|
|
82
124
|
@property
|
@@ -96,29 +138,36 @@ class ForkedAlgorithm(NexusObject[TPayload, AlgorithmResult]):
|
|
96
138
|
},
|
97
139
|
)
|
98
140
|
async def _measured_run(**run_args) -> AlgorithmResult:
|
99
|
-
|
141
|
+
if await self._is_forked(**run_args):
|
142
|
+
return await self._fork_run(**run_args)
|
143
|
+
|
144
|
+
return await self._main_run(**run_args)
|
100
145
|
|
101
|
-
if
|
146
|
+
# evaluate if additional forks will be spawned
|
147
|
+
forks = await self._get_forks(**kwargs)
|
148
|
+
|
149
|
+
if len(forks) > 0:
|
102
150
|
self._logger.info(
|
103
|
-
"
|
104
|
-
forks=",".join([fork.alias() for fork in
|
151
|
+
"Forking node with: {forks}, after the node run",
|
152
|
+
forks=",".join([fork.alias() for fork in forks]),
|
105
153
|
)
|
106
154
|
else:
|
107
|
-
self._logger.info(
|
108
|
-
"This algorithm supports forks but none were injected. Proceeding with a main run only"
|
109
|
-
)
|
155
|
+
self._logger.info("Leaf algorithm node: proceeding with this node run only")
|
110
156
|
|
111
|
-
|
157
|
+
if self._is_forked(**kwargs):
|
158
|
+
self._inputs = await self._fork_inputs(**kwargs)
|
159
|
+
else:
|
160
|
+
self._inputs = await self._main_inputs(**kwargs)
|
112
161
|
|
113
162
|
run_result = await partial(
|
114
163
|
_measured_run,
|
115
|
-
**
|
164
|
+
**self._inputs,
|
116
165
|
metric_tags=self._metric_tags,
|
117
166
|
metrics_provider=self._metrics_provider,
|
118
167
|
logger=self._logger,
|
119
168
|
)()
|
120
169
|
|
121
170
|
# now await callback scheduling
|
122
|
-
await asyncio.wait([fork.run(**kwargs) for fork in
|
171
|
+
await asyncio.wait([fork.run(**kwargs) for fork in forks])
|
123
172
|
|
124
173
|
return run_result
|
@@ -264,6 +264,8 @@ class Nexus:
|
|
264
264
|
logger_type=self.__class__,
|
265
265
|
)
|
266
266
|
|
267
|
+
root_logger.start()
|
268
|
+
|
267
269
|
root_logger.info(
|
268
270
|
"Running algorithm {algorithm} on Nexus version {version}",
|
269
271
|
algorithm=algorithm.__class__.__name__,
|
@@ -322,6 +324,8 @@ class Nexus:
|
|
322
324
|
qes = self._injector.get(QueryEnabledStore)
|
323
325
|
qes.close()
|
324
326
|
|
327
|
+
root_logger.stop()
|
328
|
+
|
325
329
|
@classmethod
|
326
330
|
def create(cls) -> "Nexus":
|
327
331
|
"""
|
@@ -67,32 +67,34 @@ class TelemetryRecorder(NexusCoreObject):
|
|
67
67
|
entity_name=entity_name,
|
68
68
|
run_id=run_id,
|
69
69
|
)
|
70
|
-
|
71
|
-
|
72
|
-
|
70
|
+
|
71
|
+
try:
|
72
|
+
serialization_format = self._serializer.get_serialization_format(
|
73
|
+
entity_to_record
|
74
|
+
)
|
75
|
+
except KeyError:
|
73
76
|
self._logger.warning(
|
74
|
-
"
|
75
|
-
telemetry_entity_type=type(entity_to_record),
|
77
|
+
"No telemetry serialization format injected for data type: {telemetry_entity_type}. Telemetry recording skipped.",
|
78
|
+
telemetry_entity_type=str(type(entity_to_record)),
|
76
79
|
)
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
data_format="null",
|
90
|
-
).parse_data_path(),
|
91
|
-
serialization_format=self._serializer.get_serialization_format(
|
92
|
-
entity_to_record
|
80
|
+
return
|
81
|
+
|
82
|
+
self._storage_client.save_data_as_blob(
|
83
|
+
data=entity_to_record,
|
84
|
+
blob_path=DataSocket(
|
85
|
+
alias="telemetry",
|
86
|
+
data_path=os.path.join(
|
87
|
+
self._telemetry_base_path,
|
88
|
+
"telemetry_group=inputs",
|
89
|
+
f"entity_name={entity_name}",
|
90
|
+
f"request_id={run_id}",
|
91
|
+
run_id,
|
93
92
|
),
|
94
|
-
|
95
|
-
)
|
93
|
+
data_format="null",
|
94
|
+
).parse_data_path(),
|
95
|
+
serialization_format=serialization_format,
|
96
|
+
overwrite=True,
|
97
|
+
)
|
96
98
|
|
97
99
|
telemetry_tasks = [
|
98
100
|
asyncio.create_task(
|
@@ -151,7 +151,9 @@ class UserTelemetryRecorder(Generic[TPayload, TResult], ABC):
|
|
151
151
|
),
|
152
152
|
data_format="null",
|
153
153
|
).parse_data_path(),
|
154
|
-
serialization_format=self._serializer.get_serialization_format(
|
154
|
+
serialization_format=self._serializer.get_serialization_format(
|
155
|
+
telemetry.telemetry
|
156
|
+
),
|
155
157
|
overwrite=True,
|
156
158
|
)
|
157
159
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "esd-services-api-client"
|
3
|
-
version = "
|
3
|
+
version = "2.5.3"
|
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>']
|
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = 'v2.5.1a123.dev5'
|
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
|