naeural-core 7.7.246__py3-none-any.whl → 7.7.248__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.
- naeural_core/comm/communication_manager.py +6 -1
- naeural_core/comm/default/mqtt.py +5 -2
- naeural_core/local_libraries/config_handler_mixin.py +81 -9
- naeural_core/main/orchestrator.py +4 -2
- naeural_core/main/ver.py +1 -1
- {naeural_core-7.7.246.dist-info → naeural_core-7.7.248.dist-info}/METADATA +1 -1
- {naeural_core-7.7.246.dist-info → naeural_core-7.7.248.dist-info}/RECORD +9 -9
- {naeural_core-7.7.246.dist-info → naeural_core-7.7.248.dist-info}/WHEEL +0 -0
- {naeural_core-7.7.246.dist-info → naeural_core-7.7.248.dist-info}/licenses/LICENSE +0 -0
|
@@ -84,7 +84,12 @@ class CommunicationManager(Manager, _ConfigHandlerMixin):
|
|
|
84
84
|
def has_failed_comms(self):
|
|
85
85
|
comm = self._has_failed_comms()
|
|
86
86
|
if comm is not None:
|
|
87
|
-
|
|
87
|
+
retries = comm._nr_conn_retry_iters
|
|
88
|
+
self.P("Detected {} comm failures on comm {}. This may generate shutdown/restart.".format(
|
|
89
|
+
retries, comm.__class__.__name__
|
|
90
|
+
),
|
|
91
|
+
color='error'
|
|
92
|
+
)
|
|
88
93
|
return True
|
|
89
94
|
return False
|
|
90
95
|
|
|
@@ -13,7 +13,8 @@ from naeural_core.comm.base import BaseCommThread
|
|
|
13
13
|
_CONFIG = {
|
|
14
14
|
**BaseCommThread.CONFIG,
|
|
15
15
|
|
|
16
|
-
"CONNECTION_FAIL_SLEEP_TIME":
|
|
16
|
+
"CONNECTION_FAIL_SLEEP_TIME": 50,
|
|
17
|
+
"BURST_RECONNECTS" : 2,
|
|
17
18
|
|
|
18
19
|
'VALIDATION_RULES': {
|
|
19
20
|
**BaseCommThread.CONFIG['VALIDATION_RULES'],
|
|
@@ -83,7 +84,9 @@ class MQTTCommThread(BaseCommThread):
|
|
|
83
84
|
if self.connection is None or not self.has_server_conn:
|
|
84
85
|
self.has_send_conn = False
|
|
85
86
|
self.has_recv_conn = False
|
|
86
|
-
dct_ret = self._controller.server_connect(
|
|
87
|
+
dct_ret = self._controller.server_connect(
|
|
88
|
+
max_retries=self.cfg_burst_reconnects
|
|
89
|
+
)
|
|
87
90
|
self.has_server_conn = dct_ret['has_connection']
|
|
88
91
|
msg = dct_ret['msg']
|
|
89
92
|
msg_type = dct_ret['msg_type']
|
|
@@ -208,8 +208,58 @@ class _ConfigHandlerMixin(object):
|
|
|
208
208
|
|
|
209
209
|
|
|
210
210
|
def create_config_handlers(self, verbose=0):
|
|
211
|
-
if hasattr(self, 'config_data') and isinstance(self.config_data, dict) and len(self.config_data) > 0:
|
|
212
|
-
|
|
211
|
+
if not (hasattr(self, 'config_data') and isinstance(self.config_data, dict) and len(self.config_data) > 0):
|
|
212
|
+
return
|
|
213
|
+
|
|
214
|
+
cache_enabled = False
|
|
215
|
+
if hasattr(self, 'log') and hasattr(self.log, 'config_data'):
|
|
216
|
+
cache_enabled = self.log.config_data.get('BM_CACHE_CONFIG_HANDLERS', False)
|
|
217
|
+
|
|
218
|
+
res = []
|
|
219
|
+
cls = type(self)
|
|
220
|
+
|
|
221
|
+
if cache_enabled:
|
|
222
|
+
# 1) Ensure BasePluginExecutor base keys are created once (no import)
|
|
223
|
+
base_cls = next((c for c in cls.mro() if c.__name__ == "BasePluginExecutor"), None)
|
|
224
|
+
if base_cls is not None:
|
|
225
|
+
base_created = getattr(base_cls, '_cfg_keys_created', None)
|
|
226
|
+
if base_created is None:
|
|
227
|
+
base_created = set()
|
|
228
|
+
setattr(base_cls, '_cfg_keys_created', base_created)
|
|
229
|
+
|
|
230
|
+
base_cfg = getattr(base_cls, 'CONFIG', {}) or {}
|
|
231
|
+
base_keys = set(base_cfg.keys())
|
|
232
|
+
missing_base = base_keys - base_created
|
|
233
|
+
|
|
234
|
+
for k in missing_base:
|
|
235
|
+
func_name = self._get_prop(k)
|
|
236
|
+
if not hasattr(base_cls, func_name):
|
|
237
|
+
fnc = partial(getter, key=k) # create the func
|
|
238
|
+
fnc_prop = property(fget=fnc, doc="Get '{}' from config_data".format(k)) # create prop from func
|
|
239
|
+
setattr(base_cls, func_name, fnc_prop) # set the prop of the class
|
|
240
|
+
base_created.add(k)
|
|
241
|
+
|
|
242
|
+
# 2) Per-subclass cache for extra keys
|
|
243
|
+
created_keys = getattr(cls, '_cfg_keys_created', None)
|
|
244
|
+
if created_keys is None:
|
|
245
|
+
created_keys = set()
|
|
246
|
+
setattr(cls, '_cfg_keys_created', created_keys)
|
|
247
|
+
|
|
248
|
+
current_keys = set(self.config_data.keys())
|
|
249
|
+
missing_keys = current_keys - created_keys
|
|
250
|
+
|
|
251
|
+
for k in missing_keys:
|
|
252
|
+
func_name = self._get_prop(k)
|
|
253
|
+
if not hasattr(cls, func_name):
|
|
254
|
+
# below is a bit tricky: using a lambda generates a non-deterministic abnormal behavior
|
|
255
|
+
# the ideea is to create a global func instance that wil be then loaded on the class (not instance)
|
|
256
|
+
# as a descriptor object - ie a `property`. "many Bothans died to bring the plans of the Death Star..."
|
|
257
|
+
fnc = partial(getter, key=k) # create the func
|
|
258
|
+
fnc_prop = property(fget=fnc, doc="Get '{}' from config_data".format(k)) # create prop from func
|
|
259
|
+
setattr(cls, func_name, fnc_prop) # set the prop of the class
|
|
260
|
+
res.append(func_name)
|
|
261
|
+
created_keys.add(k)
|
|
262
|
+
else:
|
|
213
263
|
for k in self.config_data:
|
|
214
264
|
func_name = self._get_prop(k)
|
|
215
265
|
if not hasattr(self, func_name):
|
|
@@ -217,13 +267,13 @@ class _ConfigHandlerMixin(object):
|
|
|
217
267
|
# the ideea is to create a global func instance that wil be then loaded on the class (not instance)
|
|
218
268
|
# as a descriptor object - ie a `property`. "many Bothans died to bring the plans of the Death Star..."
|
|
219
269
|
fnc = partial(getter, key=k) # create the func
|
|
220
|
-
cls = type(self) # get the class
|
|
221
270
|
fnc_prop = property(fget=fnc, doc="Get '{}' from config_data".format(k)) # create prop from func
|
|
222
271
|
setattr(cls, func_name, fnc_prop) # set the prop of the class
|
|
223
272
|
res.append(func_name)
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
self.
|
|
273
|
+
|
|
274
|
+
if len(res) > 0 and verbose > 1:
|
|
275
|
+
self.P("Created '{}' config_data handlers: {}".format(self.__class__.__name__, res), color='b')
|
|
276
|
+
self.__cfg_ready = True
|
|
227
277
|
return
|
|
228
278
|
|
|
229
279
|
|
|
@@ -480,12 +530,34 @@ class _ConfigHandlerMixin(object):
|
|
|
480
530
|
for msg in fail_msgs:
|
|
481
531
|
self.add_error(msg)
|
|
482
532
|
|
|
483
|
-
|
|
484
|
-
|
|
533
|
+
cache_enabled = False
|
|
534
|
+
if hasattr(self, 'log') and hasattr(self.log, 'config_data'):
|
|
535
|
+
cache_enabled = self.log.config_data.get('BM_CACHE_VALIDATORS', False)
|
|
536
|
+
|
|
537
|
+
if cache_enabled:
|
|
538
|
+
cls = self.__class__
|
|
539
|
+
validators = getattr(cls, "_cfg_validators", None)
|
|
540
|
+
if validators is None:
|
|
541
|
+
validators = []
|
|
542
|
+
for method_name, func in self.log.get_class_methods(cls, include_parent=True):
|
|
543
|
+
if method_name.startswith('validate_'):
|
|
544
|
+
validators.append(func)
|
|
545
|
+
setattr(cls, "_cfg_validators", validators)
|
|
546
|
+
|
|
547
|
+
for func in validators:
|
|
485
548
|
try:
|
|
486
549
|
func(self)
|
|
487
550
|
except:
|
|
488
|
-
self.add_error("Programming error in validation method '{}'.\n{}".format(
|
|
551
|
+
self.add_error("Programming error in validation method '{}'.\n{}".format(
|
|
552
|
+
func.__name__, traceback.format_exc()))
|
|
553
|
+
else:
|
|
554
|
+
for method_name, func in self.log.get_class_methods(self.__class__, include_parent=True):
|
|
555
|
+
if method_name.startswith('validate_'):
|
|
556
|
+
try:
|
|
557
|
+
func(self)
|
|
558
|
+
except:
|
|
559
|
+
self.add_error("Programming error in validation method '{}'.\n{}".format(
|
|
560
|
+
method_name, traceback.format_exc()))
|
|
489
561
|
|
|
490
562
|
lst_errors = self.get_errors()
|
|
491
563
|
lst_warnings = self.get_warnings()
|
|
@@ -432,8 +432,9 @@ class Orchestrator(DecentrAIObject,
|
|
|
432
432
|
|
|
433
433
|
|
|
434
434
|
def _maybe_save_local_info(self):
|
|
435
|
-
if (time() - self.__last_local_info_save) >=
|
|
435
|
+
if (time() - self.__last_local_info_save) >= 10: # save local info every 10 seconds
|
|
436
436
|
self.save_local_address()
|
|
437
|
+
self.__last_local_info_save = time()
|
|
437
438
|
return
|
|
438
439
|
|
|
439
440
|
|
|
@@ -481,7 +482,6 @@ class Orchestrator(DecentrAIObject,
|
|
|
481
482
|
self.P(f"Failed to get local info: {exc}", color='r')
|
|
482
483
|
with open(addr_file, 'w') as f:
|
|
483
484
|
f.write(json.dumps(data, indent=2))
|
|
484
|
-
self.__last_local_info_save = time()
|
|
485
485
|
except Exception as e:
|
|
486
486
|
if not self.__save_local_address_error_logged:
|
|
487
487
|
self.P(f"Error saving local info: {e}\n{traceback.format_exc()}", color='r')
|
|
@@ -1809,7 +1809,9 @@ class Orchestrator(DecentrAIObject,
|
|
|
1809
1809
|
|
|
1810
1810
|
self.__loop_stage = "0"
|
|
1811
1811
|
self.log.start_timer(self._main_loop_timer_name)
|
|
1812
|
+
self.__loop_stage = "0.maybe_delay"
|
|
1812
1813
|
self._maybe_delay_main_loop()
|
|
1814
|
+
self.__loop_stage = "0.save_info"
|
|
1813
1815
|
self._maybe_save_local_info()
|
|
1814
1816
|
self._main_loop_counts['ITER'] += 1
|
|
1815
1817
|
|
naeural_core/main/ver.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: naeural_core
|
|
3
|
-
Version: 7.7.
|
|
3
|
+
Version: 7.7.248
|
|
4
4
|
Summary: Ratio1 Core is the backbone of the Ratio1 Edge Protocol.
|
|
5
5
|
Project-URL: Homepage, https://github.com/Ratio1/naeural_core
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/Ratio1/naeural_core/issues
|
|
@@ -102,11 +102,11 @@ naeural_core/business/training/minio_download_dataset.py,sha256=7uoo5CFLynWbLkBh
|
|
|
102
102
|
naeural_core/business/training/minio_upload_dataset.py,sha256=5stm_E_L3SLwcjd2znUVMIC2PWO07f6QfBdcrKRiHCo,2162
|
|
103
103
|
naeural_core/business/training/second_stage_training_process.py,sha256=z8LG9xx2G6s5AqeSD-t5rBegIctkFMEf4ZqEJVXZcz0,3152
|
|
104
104
|
naeural_core/comm/__init__.py,sha256=SpAWJIyYdOouZSImzVrEF_M4-nrCrY9p3cVYwvmbt20,105
|
|
105
|
-
naeural_core/comm/communication_manager.py,sha256=
|
|
105
|
+
naeural_core/comm/communication_manager.py,sha256=dj6bkuD6RywGLuG6CAFy1uB4OLkuIQE_gi0bHHlrjoQ,30547
|
|
106
106
|
naeural_core/comm/base/__init__.py,sha256=rDzAtPwcMOsW3aCp0t07GpJz5qweLiJgafTngHwEMOo,44
|
|
107
107
|
naeural_core/comm/base/base_comm_thread.py,sha256=DVPzLN9UfKxjiVf0FtjOr5001-YzkjPMmC4RJFhoGG0,27034
|
|
108
108
|
naeural_core/comm/default/amqp.py,sha256=-6_qGlOIjOUz42nkwnfMQZEVfdeUKGTNgjcTuo49v4E,4145
|
|
109
|
-
naeural_core/comm/default/mqtt.py,sha256=
|
|
109
|
+
naeural_core/comm/default/mqtt.py,sha256=I0cAqSvETKhzszMctryt7vJ_3onOFAojWJvnsXk9_Aw,4788
|
|
110
110
|
naeural_core/comm/default/readme.md,sha256=hNY9V5HU8yW0JjyseiPWMkV8l7YU0ZEBw_iq_lpW-Uk,162
|
|
111
111
|
naeural_core/comm/mixins/__init__.py,sha256=d8o2tKAkQ-P9voRB6REnEmObVyi4AiQgNVZuAKKObKo,290
|
|
112
112
|
naeural_core/comm/mixins/commandcontrol_comm_mixin.py,sha256=VhAGzR23-x8INn8VGBd7z2YUtT4GIkeTNwNK0CmAjio,4781
|
|
@@ -207,7 +207,7 @@ naeural_core/local_libraries/__init__.py,sha256=j1oqXOivpe5pu-yUfJdNuuSbTv-jw2uk
|
|
|
207
207
|
naeural_core/local_libraries/azure_logger.py,sha256=VC-8UnleVzG5NHcAw7fvM1XmYwUv4-x5SlfD_Xrx-cg,2910
|
|
208
208
|
naeural_core/local_libraries/clustering.py,sha256=J0GNywMNrQcYVI4Ty0aaS86cR-ztXygZTp2N9j-T4Hk,3051
|
|
209
209
|
naeural_core/local_libraries/config.txt,sha256=sOe3IGuBPCNZOMm4cxf5D7ukDYLV5qsM-q0acGqPJCA,70
|
|
210
|
-
naeural_core/local_libraries/config_handler_mixin.py,sha256=
|
|
210
|
+
naeural_core/local_libraries/config_handler_mixin.py,sha256=8O2s19XUxLy3AeH7RyZ3OYfGELkIaTzrgbE1r9zNcAc,22015
|
|
211
211
|
naeural_core/local_libraries/custom_layers.py,sha256=5ajYAPCjmwpHNwwf9KjZwXkMM_D-nDoebFB_4DpPuQQ,1297
|
|
212
212
|
naeural_core/local_libraries/decorators.py,sha256=dSGH3TZAMizEuemc2I_tRUETFnCaFv57Vp94GuzsKGA,224
|
|
213
213
|
naeural_core/local_libraries/model_helper.inf,sha256=Xws-UlelG5wEltHfcH7CzZBCrjjL_4aJdxl34MltZW0,22
|
|
@@ -344,8 +344,8 @@ naeural_core/main/epochs_manager.py,sha256=lH01Pv9E_uz5fdvh_W2dZ29hZLM0CL2NZfuYJ
|
|
|
344
344
|
naeural_core/main/geoloc.py,sha256=TEqyuNzpVqZSBCo0OOrpHYncIsHSClvRt28hgvxJ35o,24909
|
|
345
345
|
naeural_core/main/main_loop_data_handler.py,sha256=hABB65OUBhtur3rd2mYsEhdAc54jVILzybrvxml5h0s,13815
|
|
346
346
|
naeural_core/main/net_mon.py,sha256=qlyo1fqTeQy_M9VfJOxon_PBbQat0QO9Zbu_93FMbLc,88144
|
|
347
|
-
naeural_core/main/orchestrator.py,sha256=
|
|
348
|
-
naeural_core/main/ver.py,sha256=
|
|
347
|
+
naeural_core/main/orchestrator.py,sha256=PzKsv3M-knOmfum41MEN3tRmMjbRcTLn0aj3NVK35MM,70878
|
|
348
|
+
naeural_core/main/ver.py,sha256=Ulb7BDcSagoVACfyK_sEKr0DiMGB9RS_q3e-Qcqka8E,335
|
|
349
349
|
naeural_core/main/orchestrator_mixins/__init__.py,sha256=MNleg48vdlqsyAR8Vamjl4ahG2jwCH5kLbQN5CfU57E,149
|
|
350
350
|
naeural_core/main/orchestrator_mixins/managers_init.py,sha256=sQVqpr99a5WP9HCloYCyaWDW5J3IypEImlf703bqTF4,6692
|
|
351
351
|
naeural_core/main/orchestrator_mixins/utils.py,sha256=jMa0uStVNLQmp0VhNMRvfBDjo387ORLlUVLthRNBKqc,1866
|
|
@@ -555,7 +555,7 @@ naeural_core/utils/tracing/onnx/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
|
|
|
555
555
|
naeural_core/utils/tracing/onnx/base_trt_scripter.py,sha256=1FelEBo7JGsc8hbJ3sevzxnM-J61nvBHz6L1VLpZrVc,2043
|
|
556
556
|
naeural_core/utils/tracing/onnx/utils.py,sha256=IKmqUWakrMWn34uJvbRjNLacdszD8jkkQBFPUhgJtOQ,5618
|
|
557
557
|
naeural_core/utils/web_app/favicon.ico,sha256=zU6-Jxx4ol1A9FJvcQELYV9DiqwqyvjPS89xQybZE74,15406
|
|
558
|
-
naeural_core-7.7.
|
|
559
|
-
naeural_core-7.7.
|
|
560
|
-
naeural_core-7.7.
|
|
561
|
-
naeural_core-7.7.
|
|
558
|
+
naeural_core-7.7.248.dist-info/METADATA,sha256=gSIrss11lt0A52kui8DuqG2By9gqFfJGOf-MBkDnrhA,6522
|
|
559
|
+
naeural_core-7.7.248.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
560
|
+
naeural_core-7.7.248.dist-info/licenses/LICENSE,sha256=SPHPWjOdAUUUUI020nI5VNCtFjmTOlJpi1cZxyB3gKo,11339
|
|
561
|
+
naeural_core-7.7.248.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|