naeural-client 2.7.6__py3-none-any.whl → 2.7.8__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_client/_ver.py +1 -1
- naeural_client/base/generic_session.py +148 -53
- naeural_client/base/pipeline.py +15 -2
- naeural_client/bc/base.py +3 -0
- naeural_client/const/payload.py +1 -0
- {naeural_client-2.7.6.dist-info → naeural_client-2.7.8.dist-info}/METADATA +1 -1
- {naeural_client-2.7.6.dist-info → naeural_client-2.7.8.dist-info}/RECORD +10 -10
- {naeural_client-2.7.6.dist-info → naeural_client-2.7.8.dist-info}/WHEEL +0 -0
- {naeural_client-2.7.6.dist-info → naeural_client-2.7.8.dist-info}/entry_points.txt +0 -0
- {naeural_client-2.7.6.dist-info → naeural_client-2.7.8.dist-info}/licenses/LICENSE +0 -0
naeural_client/_ver.py
CHANGED
@@ -42,6 +42,7 @@ from ..utils.config import (
|
|
42
42
|
|
43
43
|
|
44
44
|
DEBUG_MQTT_SERVER = "r9092118.ala.eu-central-1.emqxsl.com"
|
45
|
+
SDK_NETCONFIG_REQUEST_DELAY = 300
|
45
46
|
|
46
47
|
|
47
48
|
class GenericSession(BaseDecentrAIObject):
|
@@ -88,6 +89,7 @@ class GenericSession(BaseDecentrAIObject):
|
|
88
89
|
on_notification=None,
|
89
90
|
on_heartbeat=None,
|
90
91
|
debug_silent=True,
|
92
|
+
debug=False,
|
91
93
|
silent=False,
|
92
94
|
verbosity=1,
|
93
95
|
dotenv_path=None,
|
@@ -156,8 +158,13 @@ class GenericSession(BaseDecentrAIObject):
|
|
156
158
|
As arguments, it has a reference to this Session object, the node name and the heartbeat payload.
|
157
159
|
Defaults to None.
|
158
160
|
|
159
|
-
debug_silent : bool, optional
|
161
|
+
debug_silent : bool, optional
|
160
162
|
This flag will disable debug logs, set to 'False` for a more verbose log, by default True
|
163
|
+
Observation: Obsolete, will be removed
|
164
|
+
|
165
|
+
debug : bool, optional
|
166
|
+
This flag will enable debug logs, set to 'False` for a more verbose log, by default False
|
167
|
+
|
161
168
|
|
162
169
|
silent : bool, optional
|
163
170
|
This flag will disable all logs, set to 'False` for a more verbose log, by default False
|
@@ -174,9 +181,11 @@ class GenericSession(BaseDecentrAIObject):
|
|
174
181
|
Defaults to True.
|
175
182
|
"""
|
176
183
|
|
184
|
+
debug = debug or not debug_silent
|
185
|
+
|
177
186
|
self.__at_least_one_node_peered = False
|
178
187
|
self.__at_least_a_netmon_received = False
|
179
|
-
|
188
|
+
|
180
189
|
# TODO: maybe read config from file?
|
181
190
|
self._config = {**self.default_config, **config}
|
182
191
|
|
@@ -203,7 +212,11 @@ class GenericSession(BaseDecentrAIObject):
|
|
203
212
|
self._dct_online_nodes_last_heartbeat: dict[str, dict] = {}
|
204
213
|
self._dct_can_send_to_node: dict[str, bool] = {}
|
205
214
|
self._dct_node_last_seen_time = {} # key is node address
|
206
|
-
self.
|
215
|
+
self.__dct_node_address_to_alias = {}
|
216
|
+
self.__dct_node_eth_addr_to_node_addr = {}
|
217
|
+
|
218
|
+
self._dct_netconfig_pipelines_requests = {}
|
219
|
+
|
207
220
|
self.online_timeout = 60
|
208
221
|
self.filter_workers = filter_workers
|
209
222
|
self.__show_commands = show_commands
|
@@ -260,7 +273,7 @@ class GenericSession(BaseDecentrAIObject):
|
|
260
273
|
|
261
274
|
super(GenericSession, self).__init__(
|
262
275
|
log=log,
|
263
|
-
DEBUG=
|
276
|
+
DEBUG=debug,
|
264
277
|
create_logger=True,
|
265
278
|
silent=self.silent,
|
266
279
|
local_cache_base_folder=local_cache_base_folder,
|
@@ -474,17 +487,24 @@ class GenericSession(BaseDecentrAIObject):
|
|
474
487
|
"""
|
475
488
|
return self.filter_workers is not None and node_addr not in self.filter_workers
|
476
489
|
|
477
|
-
def __track_online_node(self, node_addr, node_id):
|
490
|
+
def __track_online_node(self, node_addr, node_id, node_eth_address=None):
|
478
491
|
"""
|
479
492
|
Track the last time a node was seen online.
|
480
493
|
|
481
494
|
Parameters
|
482
495
|
----------
|
496
|
+
node_id : str
|
497
|
+
The alias of the Ratio1 edge node that sent the message.
|
483
498
|
node_addr : str
|
484
|
-
The address of the
|
499
|
+
The address of the Ratio1 edge node that sent the message.
|
500
|
+
node_eth_address : str, optional
|
501
|
+
The Ethereum address of the Ratio1 edge node that sent the message, by
|
485
502
|
"""
|
486
503
|
self._dct_node_last_seen_time[node_addr] = tm()
|
487
|
-
self.
|
504
|
+
self.__dct_node_address_to_alias[node_addr] = node_id
|
505
|
+
if node_eth_address is not None:
|
506
|
+
self.__dct_node_eth_addr_to_node_addr[node_eth_address] = node_addr
|
507
|
+
# endif node_eth address not provided - this is just for safety and it should not happen!
|
488
508
|
return
|
489
509
|
|
490
510
|
def __track_allowed_node_by_hb(self, node_addr, dict_msg):
|
@@ -528,8 +548,7 @@ class GenericSession(BaseDecentrAIObject):
|
|
528
548
|
**kwargs
|
529
549
|
)
|
530
550
|
self.bc_engine.sign(msg_to_send)
|
531
|
-
|
532
|
-
self.P(f'Sending encrypted payload to <{node_addr}>', color='y')
|
551
|
+
self.P(f'Sending encrypted payload to <{node_addr}>', color='d')
|
533
552
|
self._send_payload(msg_to_send)
|
534
553
|
return
|
535
554
|
|
@@ -551,10 +570,12 @@ class GenericSession(BaseDecentrAIObject):
|
|
551
570
|
additional_data = {
|
552
571
|
PAYLOAD_DATA.EE_PAYLOAD_PATH: [self.bc_engine.address, DEFAULT_PIPELINES.ADMIN_PIPELINE, PLUGIN_SIGNATURES.NET_CONFIG_MONITOR, None]
|
553
572
|
}
|
573
|
+
self.D("Sending net-config request to <{}>".format(node_addr), color='y')
|
554
574
|
self.send_encrypted_payload(
|
555
575
|
node_addr=node_addr, payload=payload,
|
556
576
|
additional_data=additional_data
|
557
577
|
)
|
578
|
+
self._dct_netconfig_pipelines_requests[node_addr] = tm()
|
558
579
|
return
|
559
580
|
|
560
581
|
def __track_allowed_node_by_netmon(self, node_addr, dict_msg):
|
@@ -573,14 +594,27 @@ class GenericSession(BaseDecentrAIObject):
|
|
573
594
|
node_secured = dict_msg.get(PAYLOAD_DATA.NETMON_NODE_SECURED, False)
|
574
595
|
node_online = dict_msg.get(PAYLOAD_DATA.NETMON_STATUS_KEY) == PAYLOAD_DATA.NETMON_STATUS_ONLINE
|
575
596
|
node_alias = dict_msg.get(PAYLOAD_DATA.NETMON_EEID, None)
|
597
|
+
node_eth_address = dict_msg.get(PAYLOAD_DATA.NETMON_ETH_ADDRESS, None)
|
576
598
|
|
577
599
|
if node_online:
|
578
|
-
self.__track_online_node(
|
600
|
+
self.__track_online_node(
|
601
|
+
node_addr=node_addr,
|
602
|
+
node_id=node_alias,
|
603
|
+
node_eth_address=node_eth_address
|
604
|
+
)
|
579
605
|
|
580
606
|
client_is_allowed = self.bc_engine.contains_current_address(node_whitelist)
|
581
|
-
can_send = not node_secured or client_is_allowed or self.bc_engine.address == node_addr
|
607
|
+
can_send = not node_secured or client_is_allowed or self.bc_engine.address == node_addr
|
582
608
|
if node_addr not in self._dct_can_send_to_node and can_send:
|
583
|
-
|
609
|
+
if node_online:
|
610
|
+
# only attempt to request pipelines if the node is online and if not recently requested
|
611
|
+
last_requested_by_netmon = self._dct_netconfig_pipelines_requests.get(node_addr, 0)
|
612
|
+
if tm() - last_requested_by_netmon > SDK_NETCONFIG_REQUEST_DELAY:
|
613
|
+
self.__request_pipelines_from_net_config_monitor(node_addr)
|
614
|
+
else:
|
615
|
+
self.D(f"Node <{node_addr}> is online but pipelines were recently requested", color='y')
|
616
|
+
else:
|
617
|
+
self.D(f"Node <{node_addr}> is offline thus NOT sending net-config request", color='y')
|
584
618
|
# endif node seen for the first time
|
585
619
|
|
586
620
|
self._dct_can_send_to_node[node_addr] = can_send
|
@@ -623,6 +657,7 @@ class GenericSession(BaseDecentrAIObject):
|
|
623
657
|
The name of the instance that sent the message.
|
624
658
|
"""
|
625
659
|
# extract relevant data from the message
|
660
|
+
self.D("<HB> Received hb from: {}".format(msg_node_addr), verbosity=2)
|
626
661
|
|
627
662
|
if dict_msg.get(HB.HEARTBEAT_VERSION) == HB.V2:
|
628
663
|
str_data = self.log.decompress_text(dict_msg[HB.ENCODED_DATA])
|
@@ -632,9 +667,14 @@ class GenericSession(BaseDecentrAIObject):
|
|
632
667
|
self._dct_online_nodes_last_heartbeat[msg_node_addr] = dict_msg
|
633
668
|
|
634
669
|
msg_node_id = dict_msg[PAYLOAD_DATA.EE_ID]
|
670
|
+
msg_node_eth_addr = dict_msg.get(PAYLOAD_DATA.EE_ETH_ADDR, None)
|
635
671
|
# track the node based on heartbeat - a normal heartbeat means the node is online
|
636
672
|
# however this can lead to long wait times for the first heartbeat for all nodes
|
637
|
-
self.__track_online_node(
|
673
|
+
self.__track_online_node(
|
674
|
+
node_addr=msg_node_addr,
|
675
|
+
node_id=msg_node_id,
|
676
|
+
node_eth_address=msg_node_eth_addr
|
677
|
+
)
|
638
678
|
|
639
679
|
msg_active_configs = dict_msg.get(HB.CONFIG_STREAMS)
|
640
680
|
if msg_active_configs is None:
|
@@ -647,7 +687,7 @@ class GenericSession(BaseDecentrAIObject):
|
|
647
687
|
# this is for legacy and custom implementation where heartbeats still contain
|
648
688
|
# the pipeline configuration.
|
649
689
|
pipeline_names = [x.get(PAYLOAD_DATA.NAME, None) for x in msg_active_configs]
|
650
|
-
self.D(f'<HB>
|
690
|
+
self.D(f'<HB> Processing pipelines from <{msg_node_addr}>:{pipeline_names}', color='y')
|
651
691
|
self.__process_node_pipelines(msg_node_addr, msg_active_configs)
|
652
692
|
|
653
693
|
# TODO: move this call in `__on_message_default_callback`
|
@@ -661,7 +701,7 @@ class GenericSession(BaseDecentrAIObject):
|
|
661
701
|
for transaction in open_transactions_copy:
|
662
702
|
transaction.handle_heartbeat(dict_msg)
|
663
703
|
|
664
|
-
self.D("Received hb from: {}".format(msg_node_addr), verbosity=2)
|
704
|
+
self.D("<HB> Received hb from: {}".format(msg_node_addr), verbosity=2)
|
665
705
|
|
666
706
|
self.__track_allowed_node_by_hb(msg_node_addr, dict_msg)
|
667
707
|
|
@@ -746,27 +786,31 @@ class GenericSession(BaseDecentrAIObject):
|
|
746
786
|
current_network = dict_msg.get(PAYLOAD_DATA.NETMON_CURRENT_NETWORK, {})
|
747
787
|
if current_network:
|
748
788
|
self.__at_least_a_netmon_received = True
|
749
|
-
all_addresses = [
|
750
|
-
x[PAYLOAD_DATA.NETMON_ADDRESS] for x in current_network.values()
|
751
|
-
]
|
752
|
-
online_addresses = [
|
753
|
-
x[PAYLOAD_DATA.NETMON_ADDRESS] for x in current_network.values()
|
754
|
-
if x[PAYLOAD_DATA.NETMON_STATUS_KEY] == PAYLOAD_DATA.NETMON_STATUS_ONLINE
|
755
|
-
]
|
756
|
-
self.P(f"Net config from <{sender_addr}> `{ee_id}`: {len(online_addresses)}/{len(all_addresses)}", color='y')
|
757
789
|
self.__current_network_statuses[sender_addr] = current_network
|
758
|
-
|
790
|
+
online_addresses = []
|
791
|
+
all_addresses = []
|
759
792
|
for _ , node_data in current_network.items():
|
760
|
-
node_addr = node_data.get(
|
793
|
+
node_addr = node_data.get(PAYLOAD_DATA.NETMON_ADDRESS, None)
|
794
|
+
all_addresses.append(node_addr)
|
795
|
+
is_online = node_data.get(PAYLOAD_DATA.NETMON_STATUS_KEY) == PAYLOAD_DATA.NETMON_STATUS_ONLINE
|
796
|
+
node_alias = node_data.get(PAYLOAD_DATA.NETMON_EEID, None)
|
797
|
+
if is_online:
|
798
|
+
# no need to call here __track_online_node as it is already called
|
799
|
+
# in below in __track_allowed_node_by_netmon
|
800
|
+
online_addresses.append(node_addr)
|
801
|
+
# end if is_online
|
761
802
|
if node_addr is not None:
|
762
803
|
self.__track_allowed_node_by_netmon(node_addr, node_data)
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
804
|
+
# end if node_addr
|
805
|
+
# end for each node in network map
|
806
|
+
nr_peers = sum(self._dct_can_send_to_node.values())
|
807
|
+
self.P(f"Net config from <{sender_addr}> `{ee_id}`: {len(online_addresses)}/{len(all_addresses)}", color='y')
|
808
|
+
if nr_peers > 0 and not self.__at_least_one_node_peered:
|
809
|
+
self.__at_least_one_node_peered = True
|
810
|
+
self.P(
|
811
|
+
f"Received {PLUGIN_SIGNATURES.NET_MON_01} from {sender_addr}, so far {nr_peers} peers that allow me: {json.dumps(self._dct_can_send_to_node, indent=2)}",
|
812
|
+
color='g'
|
813
|
+
)
|
770
814
|
# end for each node in network map
|
771
815
|
# end if current_network is valid
|
772
816
|
# end if NET_MON_01
|
@@ -786,31 +830,37 @@ class GenericSession(BaseDecentrAIObject):
|
|
786
830
|
if msg_pipeline.lower() == REQUIRED_PIPELINE.lower() and msg_signature.upper() == REQUIRED_SIGNATURE.upper():
|
787
831
|
# extract data
|
788
832
|
sender_addr = dict_msg.get(PAYLOAD_DATA.EE_SENDER, None)
|
833
|
+
short_sender_addr = sender_addr[:8] + '...' + sender_addr[-4:]
|
834
|
+
if self.client_address == sender_addr:
|
835
|
+
self.D("<NETCFG> Ignoring message from self", color='d')
|
789
836
|
receiver = dict_msg.get(PAYLOAD_DATA.EE_DESTINATION, None)
|
790
837
|
if not isinstance(receiver, list):
|
791
838
|
receiver = [receiver]
|
792
839
|
path = dict_msg.get(PAYLOAD_DATA.EE_PAYLOAD_PATH, [None, None, None, None])
|
793
840
|
ee_id = dict_msg.get(PAYLOAD_DATA.EE_ID, None)
|
841
|
+
op = dict_msg.get(NET_CONFIG.NET_CONFIG_DATA, {}).get(NET_CONFIG.OPERATION, "UNKNOWN")
|
842
|
+
# drop any incoming request as we are not a net-config provider just a consumer
|
843
|
+
if op == NET_CONFIG.REQUEST_COMMAND:
|
844
|
+
self.P(f"<NETCFG> Dropping request from <{short_sender_addr}> `{ee_id}`", color='d')
|
845
|
+
return
|
794
846
|
|
795
847
|
# check if I am allowed to see this payload
|
796
848
|
if not self.bc_engine.contains_current_address(receiver):
|
797
|
-
self.P(f"Received
|
849
|
+
self.P(f"<NETCFG> Received `{op}` from <{short_sender_addr}> `{ee_id}` but I am not in the receiver list: {receiver}", color='d')
|
798
850
|
return
|
799
851
|
|
800
|
-
#
|
852
|
+
# encryption check. By now all should be decrypted
|
801
853
|
is_encrypted = dict_msg.get(PAYLOAD_DATA.EE_IS_ENCRYPTED, False)
|
802
854
|
if not is_encrypted:
|
803
|
-
self.P(f"Received
|
855
|
+
self.P(f"<NETCFG> Received from <{short_sender_addr}> `{ee_id}` but it is not encrypted", color='r')
|
804
856
|
return
|
805
857
|
net_config_data = dict_msg.get(NET_CONFIG.NET_CONFIG_DATA, {})
|
806
858
|
received_pipelines = net_config_data.get('PIPELINES', [])
|
807
|
-
self.D(f"Received {len(received_pipelines)} pipelines from <{sender_addr}>")
|
859
|
+
self.D(f"<NETCFG> Received {len(received_pipelines)} pipelines from <{sender_addr}>")
|
808
860
|
new_pipelines = self.__process_node_pipelines(sender_addr, received_pipelines)
|
809
861
|
pipeline_names = [x.name for x in new_pipelines]
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
# load with same method as a hb
|
862
|
+
if len(new_pipelines) > 0:
|
863
|
+
self.P(f'<NETCFG> Received NEW pipelines from <{sender_addr}>:{pipeline_names}', color='y')
|
814
864
|
return True
|
815
865
|
|
816
866
|
|
@@ -1163,7 +1213,8 @@ class GenericSession(BaseDecentrAIObject):
|
|
1163
1213
|
self,
|
1164
1214
|
seconds=10,
|
1165
1215
|
close_session_on_timeout=True,
|
1166
|
-
close_pipeline_on_timeout=False
|
1216
|
+
close_pipeline_on_timeout=False,
|
1217
|
+
**kwargs,
|
1167
1218
|
):
|
1168
1219
|
"""
|
1169
1220
|
Wait for a given amount of time.
|
@@ -1178,11 +1229,21 @@ class GenericSession(BaseDecentrAIObject):
|
|
1178
1229
|
|
1179
1230
|
close_pipeline_on_timeout : bool, optional
|
1180
1231
|
If `True`, will close the pipelines when the time is up, by default False
|
1232
|
+
|
1233
|
+
**kwargs : dict
|
1234
|
+
Additional or replacement parameters to be passed to the `run` method:
|
1235
|
+
`close_session` : bool - If `True` will close the session when the loop is exited.
|
1236
|
+
`close_pipelines` : bool - If `True` will close all pipelines initiated by this session when the loop is exited.
|
1237
|
+
|
1181
1238
|
"""
|
1239
|
+
if "close_pipelines" in kwargs:
|
1240
|
+
close_pipeline_on_timeout = kwargs.get("close_pipelines")
|
1241
|
+
if "close_session" in kwargs:
|
1242
|
+
close_session_on_timeout = kwargs.get("close_session")
|
1182
1243
|
self.run(
|
1183
1244
|
wait=seconds,
|
1184
1245
|
close_session=close_session_on_timeout,
|
1185
|
-
close_pipelines=close_pipeline_on_timeout
|
1246
|
+
close_pipelines=close_pipeline_on_timeout,
|
1186
1247
|
)
|
1187
1248
|
return
|
1188
1249
|
|
@@ -1336,12 +1397,12 @@ class GenericSession(BaseDecentrAIObject):
|
|
1336
1397
|
self._config[comm_ct.SECURED] = secured
|
1337
1398
|
|
1338
1399
|
return
|
1339
|
-
|
1400
|
+
|
1340
1401
|
def __aliases_to_addresses(self):
|
1341
1402
|
"""
|
1342
1403
|
Convert the aliases to addresses.
|
1343
1404
|
"""
|
1344
|
-
dct_aliases = {v: k for k, v in self.
|
1405
|
+
dct_aliases = {v: k for k, v in self.__dct_node_address_to_alias.items()}
|
1345
1406
|
return dct_aliases
|
1346
1407
|
|
1347
1408
|
def __get_node_address(self, node):
|
@@ -1360,12 +1421,13 @@ class GenericSession(BaseDecentrAIObject):
|
|
1360
1421
|
str
|
1361
1422
|
The address of the node.
|
1362
1423
|
"""
|
1363
|
-
# if node not in self.get_active_nodes():
|
1364
|
-
# node = next((key for key, value in self._dct_node_addr_name.items() if value == node), node)
|
1365
1424
|
result = None
|
1366
|
-
if node in self.
|
1425
|
+
if node in self._dct_node_last_seen_time.keys():
|
1367
1426
|
# node seems to be already an address
|
1368
1427
|
result = node
|
1428
|
+
elif node in self.__dct_node_eth_addr_to_node_addr.keys():
|
1429
|
+
# node is an eth address
|
1430
|
+
result = self.__dct_node_eth_addr_to_node_addr.get(node, None)
|
1369
1431
|
else:
|
1370
1432
|
# maybe node is a name
|
1371
1433
|
aliases = self.__aliases_to_addresses()
|
@@ -1748,9 +1810,9 @@ class GenericSession(BaseDecentrAIObject):
|
|
1748
1810
|
return self.__get_node_address(name)
|
1749
1811
|
|
1750
1812
|
|
1751
|
-
def
|
1813
|
+
def get_node_alias(self, node_addr):
|
1752
1814
|
"""
|
1753
|
-
Get the
|
1815
|
+
Get the alias of a node.
|
1754
1816
|
|
1755
1817
|
Parameters
|
1756
1818
|
----------
|
@@ -1762,7 +1824,39 @@ class GenericSession(BaseDecentrAIObject):
|
|
1762
1824
|
str
|
1763
1825
|
The name of the node.
|
1764
1826
|
"""
|
1765
|
-
return self.
|
1827
|
+
return self.__dct_node_address_to_alias.get(node_addr, None)
|
1828
|
+
|
1829
|
+
def get_addr_by_eth_address(self, eth_address):
|
1830
|
+
"""
|
1831
|
+
Get the address of a node by its eth address.
|
1832
|
+
|
1833
|
+
Parameters
|
1834
|
+
----------
|
1835
|
+
eth_address : str
|
1836
|
+
The eth address of the node.
|
1837
|
+
|
1838
|
+
Returns
|
1839
|
+
-------
|
1840
|
+
str
|
1841
|
+
The address of the node.
|
1842
|
+
"""
|
1843
|
+
return self.__dct_node_eth_addr_to_node_addr.get(eth_address, None)
|
1844
|
+
|
1845
|
+
def get_eth_address_by_addr(self, node_addr):
|
1846
|
+
"""
|
1847
|
+
Get the eth address of a node by its address.
|
1848
|
+
|
1849
|
+
Parameters
|
1850
|
+
----------
|
1851
|
+
node_addr : str
|
1852
|
+
The address of the node.
|
1853
|
+
|
1854
|
+
Returns
|
1855
|
+
-------
|
1856
|
+
str
|
1857
|
+
The eth address of the node.
|
1858
|
+
"""
|
1859
|
+
return self.bc_engine.node_address_to_eth_address(node_addr)
|
1766
1860
|
|
1767
1861
|
def get_active_nodes(self):
|
1768
1862
|
"""
|
@@ -2130,14 +2224,15 @@ class GenericSession(BaseDecentrAIObject):
|
|
2130
2224
|
Parameters
|
2131
2225
|
----------
|
2132
2226
|
node : str
|
2133
|
-
The address or name of the
|
2227
|
+
The address or name of the Ratio1 edge node.
|
2134
2228
|
|
2135
2229
|
Returns
|
2136
2230
|
-------
|
2137
2231
|
bool
|
2138
2232
|
True if the node is online, False otherwise.
|
2139
2233
|
"""
|
2140
|
-
|
2234
|
+
node = self.__get_node_address(node)
|
2235
|
+
return node in self.get_active_nodes()
|
2141
2236
|
|
2142
2237
|
def create_chain_dist_custom_job(
|
2143
2238
|
self,
|
@@ -2803,7 +2898,7 @@ class GenericSession(BaseDecentrAIObject):
|
|
2803
2898
|
val = seconds_to_short_format(val)
|
2804
2899
|
elif key == PAYLOAD_DATA.NETMON_ADDRESS:
|
2805
2900
|
if self.bc_engine._remove_prefix(val) == self.bc_engine._remove_prefix(best_super):
|
2806
|
-
# again self.
|
2901
|
+
# again self.get_node_alias(best_super) might not work if using the hb data
|
2807
2902
|
best_super_alias = node_info.get(PAYLOAD_DATA.NETMON_EEID, None)
|
2808
2903
|
val = self.bc_engine._add_prefix(val)
|
2809
2904
|
if all_info:
|
naeural_client/base/pipeline.py
CHANGED
@@ -1541,11 +1541,24 @@ class Pipeline(BaseCodeChecker):
|
|
1541
1541
|
# end for instance
|
1542
1542
|
return
|
1543
1543
|
|
1544
|
+
@property
|
1545
|
+
def node_alias(self):
|
1546
|
+
"""
|
1547
|
+
Return the node alias of the pipeline.
|
1548
|
+
"""
|
1549
|
+
return self.session.get_node_alias(self.node_addr)
|
1550
|
+
|
1544
1551
|
@property
|
1545
1552
|
def node_id(self):
|
1546
1553
|
"""
|
1547
|
-
|
1554
|
+
Method alias for `node_alias`
|
1548
1555
|
"""
|
1549
|
-
return self.
|
1556
|
+
return self.node_alias
|
1550
1557
|
|
1558
|
+
@property
|
1559
|
+
def node_name(self):
|
1560
|
+
"""
|
1561
|
+
Method alias for `node_alias`
|
1562
|
+
"""
|
1563
|
+
return self.node_alias
|
1551
1564
|
|
naeural_client/bc/base.py
CHANGED
@@ -1514,6 +1514,7 @@ class BaseBlockEngine:
|
|
1514
1514
|
debug=False,
|
1515
1515
|
max_tries=5,
|
1516
1516
|
network=None,
|
1517
|
+
return_full_data=False,
|
1517
1518
|
**kwargs
|
1518
1519
|
):
|
1519
1520
|
"""
|
@@ -1662,4 +1663,6 @@ class BaseBlockEngine:
|
|
1662
1663
|
# Invalid URL, thus dct_env will remain None
|
1663
1664
|
self.P(f"dAuth URL is not invalid: {url}", color='r')
|
1664
1665
|
#end if url is valid
|
1666
|
+
if return_full_data:
|
1667
|
+
return dct_response
|
1665
1668
|
return dct_env
|
naeural_client/const/payload.py
CHANGED
@@ -199,6 +199,7 @@ class PAYLOAD_DATA:
|
|
199
199
|
NETMON_STATUS_KEY = "working"
|
200
200
|
NETMON_STATUS_ONLINE = "ONLINE"
|
201
201
|
NETMON_ADDRESS = "address"
|
202
|
+
NETMON_ETH_ADDRESS = "eth_address"
|
202
203
|
NETMON_EEID = "eeid"
|
203
204
|
NETMON_LAST_REMOTE_TIME = 'last_remote_time'
|
204
205
|
NETMON_NODE_UTC = 'node_utc'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: naeural_client
|
3
|
-
Version: 2.7.
|
3
|
+
Version: 2.7.8
|
4
4
|
Summary: `naeural_client` is the Python SDK required for client app development for the Naeural Edge Protocol Edge Protocol framework
|
5
5
|
Project-URL: Homepage, https://github.com/NaeuralEdgeProtocol/naeural_client
|
6
6
|
Project-URL: Bug Tracker, https://github.com/NaeuralEdgeProtocol/naeural_client/issues
|
@@ -1,12 +1,12 @@
|
|
1
1
|
naeural_client/__init__.py,sha256=YimqgDbjLuywsf8zCWE0EaUXH4MBUrqLxt0TDV558hQ,632
|
2
|
-
naeural_client/_ver.py,sha256=
|
2
|
+
naeural_client/_ver.py,sha256=xyIpvn7b735D9Wb7uaQLhUG4S1REdX5ilj50twPH4lk,330
|
3
3
|
naeural_client/base_decentra_object.py,sha256=C4iwZTkhKNBS4VHlJs5DfElRYLo4Q9l1V1DNVSk1fyQ,4412
|
4
4
|
naeural_client/plugins_manager_mixin.py,sha256=X1JdGLDz0gN1rPnTN_5mJXR8JmqoBFQISJXmPR9yvCo,11106
|
5
5
|
naeural_client/base/__init__.py,sha256=hACh83_cIv7-PwYMM3bQm2IBmNqiHw-3PAfDfAEKz9A,259
|
6
6
|
naeural_client/base/distributed_custom_code_presets.py,sha256=cvz5R88P6Z5V61Ce1vHVVh8bOkgXd6gve_vdESDNAsg,2544
|
7
|
-
naeural_client/base/generic_session.py,sha256=
|
7
|
+
naeural_client/base/generic_session.py,sha256=BdM28wRfDIqzAMOD3Msrtm8b-foDBo6X825MjyXGI5g,109812
|
8
8
|
naeural_client/base/instance.py,sha256=kcZJmjLBtx8Bjj_ysIOx1JmLA-qSpG7E28j5rq6IYus,20444
|
9
|
-
naeural_client/base/pipeline.py,sha256=
|
9
|
+
naeural_client/base/pipeline.py,sha256=SNl0QLJTbaP_mlwVm1p9Vwxo72Q1Bp2ls3rt1WGPg7c,58828
|
10
10
|
naeural_client/base/plugin_template.py,sha256=7YAFaND2iXoZLgtunjYkFf_TBGieFr3VdNLO3vCqzmM,138795
|
11
11
|
naeural_client/base/responses.py,sha256=ZKBZmRhYDv8M8mQ5C_ahGsQvtWH4b9ImRcuerQdZmNw,6937
|
12
12
|
naeural_client/base/transaction.py,sha256=bfs6td5M0fINgPQNxhrl_AUjb1YiilLDQ-Cd_o3OR_E,5146
|
@@ -14,7 +14,7 @@ naeural_client/base/webapp_pipeline.py,sha256=ZNGqZ36DY076XVDfGu2Q61kCt3kxIJ4Mi4
|
|
14
14
|
naeural_client/base/payload/__init__.py,sha256=y8fBI8tG2ObNfaXFWjyWZXwu878FRYj_I8GIbHT4GKE,29
|
15
15
|
naeural_client/base/payload/payload.py,sha256=x-au7l67Z_vfn_4R2C_pjZCaFuUVXHngJiGOfIAYVdE,2690
|
16
16
|
naeural_client/bc/__init__.py,sha256=FQj23D1PrY06NUOARiKQi4cdj0-VxnoYgYDEht8lpr8,158
|
17
|
-
naeural_client/bc/base.py,sha256=
|
17
|
+
naeural_client/bc/base.py,sha256=afXeOiPjA6_md3MGfuXwYIFTh7vErjU7vYK-rpQ_WRw,46536
|
18
18
|
naeural_client/bc/chain.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
19
|
naeural_client/bc/ec.py,sha256=-HPfKpYAqy_eZpiJf3gWR2L4ZDDP7fZY2uwdNYYmS80,23868
|
20
20
|
naeural_client/certs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -40,7 +40,7 @@ naeural_client/const/environment.py,sha256=RpdDhDgB8NgRoFTk28eODigf9y0WcT9lul6mB
|
|
40
40
|
naeural_client/const/formatter.py,sha256=AW3bWlqf39uaqV4BBUuW95qKYfF2OkkU4f9hy3kSVhM,200
|
41
41
|
naeural_client/const/heartbeat.py,sha256=xHZBX_NzHTklwA2_AEKR0SGdlbavMT4nirqjQg8WlTU,2550
|
42
42
|
naeural_client/const/misc.py,sha256=VDCwwpf5bl9ltx9rzT2WPVP8B3mZFRufU1tSS5MO240,413
|
43
|
-
naeural_client/const/payload.py,sha256=
|
43
|
+
naeural_client/const/payload.py,sha256=u_FLn19EJCDo4UqVfUX9ExikFWE-YFEhkj-Ij8an0VQ,6600
|
44
44
|
naeural_client/default/__init__.py,sha256=ozU6CMMuWl0LhG8Ae3LrZ65a6tLrptfscVYGf83zjxM,46
|
45
45
|
naeural_client/default/instance/__init__.py,sha256=_cr6a9gProAZKL9_uz855q2pWt2jHwqE16ed8sm6V8I,653
|
46
46
|
naeural_client/default/instance/chain_dist_custom_job_01_plugin.py,sha256=QtHi3uXKsVs9eyMgbnvBVbMylErhV1Du4X2-7zDL7Y0,1915
|
@@ -84,8 +84,8 @@ naeural_client/utils/comm_utils.py,sha256=4cS9llRr_pK_3rNgDcRMCQwYPO0kcNU7AdWy_L
|
|
84
84
|
naeural_client/utils/config.py,sha256=QDrVywnhmf1k-sAb5jIBHZ_80TjNZk02uRG-t8mYLKQ,7413
|
85
85
|
naeural_client/utils/dotenv.py,sha256=_AgSo35n7EnQv5yDyu7C7i0kHragLJoCGydHjvOkrYY,2008
|
86
86
|
naeural_client/utils/oracle_sync/oracle_tester.py,sha256=GmZwu2JM9_UB2K-4rKB3o0RgWLqM-7Im6HwBnQLXmHI,25312
|
87
|
-
naeural_client-2.7.
|
88
|
-
naeural_client-2.7.
|
89
|
-
naeural_client-2.7.
|
90
|
-
naeural_client-2.7.
|
91
|
-
naeural_client-2.7.
|
87
|
+
naeural_client-2.7.8.dist-info/METADATA,sha256=14nrgXbF5gavIW1PCqmurhH5_7HD5lbrVIlo9BObw_E,12353
|
88
|
+
naeural_client-2.7.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
89
|
+
naeural_client-2.7.8.dist-info/entry_points.txt,sha256=CTua17GUrRa4aXeafezGC9TiWKGKQzwTjQmB2jyj22g,91
|
90
|
+
naeural_client-2.7.8.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
|
91
|
+
naeural_client-2.7.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|