naeural-client 2.5.22__py3-none-any.whl → 2.5.23__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- naeural_client/_ver.py +1 -1
- naeural_client/base/generic_session.py +8 -7
- naeural_client/cli/cli.py +12 -11
- naeural_client/cli/nodes.py +51 -24
- naeural_client/const/__init__.py +1 -1
- naeural_client/const/misc.py +10 -0
- naeural_client/utils/config.py +1 -1
- {naeural_client-2.5.22.dist-info → naeural_client-2.5.23.dist-info}/METADATA +1 -1
- {naeural_client-2.5.22.dist-info → naeural_client-2.5.23.dist-info}/RECORD +12 -12
- {naeural_client-2.5.22.dist-info → naeural_client-2.5.23.dist-info}/WHEEL +0 -0
- {naeural_client-2.5.22.dist-info → naeural_client-2.5.23.dist-info}/entry_points.txt +0 -0
- {naeural_client-2.5.22.dist-info → naeural_client-2.5.23.dist-info}/licenses/LICENSE +0 -0
naeural_client/_ver.py
CHANGED
@@ -14,7 +14,7 @@ from ..bc import DefaultBlockEngine, _DotDict
|
|
14
14
|
from ..const import (
|
15
15
|
COMMANDS, ENVIRONMENT, HB, PAYLOAD_DATA, STATUS_TYPE,
|
16
16
|
PLUGIN_SIGNATURES, DEFAULT_PIPELINES,
|
17
|
-
BLOCKCHAIN_CONFIG
|
17
|
+
BLOCKCHAIN_CONFIG, SESSION_CT
|
18
18
|
)
|
19
19
|
from ..const import comms as comm_ct
|
20
20
|
from ..io_formatter import IOFormatterWrapper
|
@@ -2324,10 +2324,11 @@ class GenericSession(BaseDecentrAIObject):
|
|
2324
2324
|
elapsed = tm() - start
|
2325
2325
|
# end while
|
2326
2326
|
# done waiting for supervisors
|
2327
|
+
best_super = 'ERROR'
|
2328
|
+
best_super_alias = 'ERROR'
|
2327
2329
|
|
2328
2330
|
if len(self.__current_network_statuses) > 0:
|
2329
2331
|
best_info = {}
|
2330
|
-
best_super = None
|
2331
2332
|
for supervisor, net_info in self.__current_network_statuses.items():
|
2332
2333
|
if len(net_info) > len(best_info):
|
2333
2334
|
best_info = net_info
|
@@ -2368,10 +2369,10 @@ class GenericSession(BaseDecentrAIObject):
|
|
2368
2369
|
# end if
|
2369
2370
|
pd.options.display.float_format = '{:.1f}'.format
|
2370
2371
|
dct_result = _DotDict({
|
2371
|
-
|
2372
|
-
|
2373
|
-
|
2374
|
-
|
2375
|
-
|
2372
|
+
SESSION_CT.NETSTATS_REPORT : pd.DataFrame(res),
|
2373
|
+
SESSION_CT.NETSTATS_REPORTER : best_super,
|
2374
|
+
SESSION_CT.NETSTATS_REPORTER_ALIAS : best_super_alias,
|
2375
|
+
SESSION_CT.NETSTATS_NR_SUPERVISORS : len(self.__current_network_statuses),
|
2376
|
+
SESSION_CT.NETSTATS_ELAPSED : elapsed,
|
2376
2377
|
})
|
2377
2378
|
return dct_result
|
naeural_client/cli/cli.py
CHANGED
@@ -98,17 +98,18 @@ def main():
|
|
98
98
|
"""
|
99
99
|
try:
|
100
100
|
# Initialize configuration if necessary
|
101
|
-
maybe_init_config()
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
args
|
110
|
-
|
111
|
-
|
101
|
+
initialized = maybe_init_config()
|
102
|
+
|
103
|
+
if initialized:
|
104
|
+
# Build the CLI parser
|
105
|
+
parser = build_parser()
|
106
|
+
args = parser.parse_args()
|
107
|
+
|
108
|
+
# Check if a command function is provided
|
109
|
+
if hasattr(args, "func"):
|
110
|
+
args.func(args) # Pass parsed arguments to the command function
|
111
|
+
else:
|
112
|
+
parser.print_help()
|
112
113
|
|
113
114
|
except Exception as e:
|
114
115
|
# Handle unexpected errors gracefully
|
naeural_client/cli/nodes.py
CHANGED
@@ -1,6 +1,30 @@
|
|
1
|
+
from time import time
|
1
2
|
from naeural_client.utils.config import log_with_color
|
3
|
+
from naeural_client.const import SESSION_CT
|
2
4
|
|
3
5
|
|
6
|
+
def _get_netstats(
|
7
|
+
silent=True,
|
8
|
+
online_only=False,
|
9
|
+
allowed_only=False,
|
10
|
+
supervisor=None,
|
11
|
+
supervisors_only=False,
|
12
|
+
):
|
13
|
+
t1 = time()
|
14
|
+
from naeural_client import Session
|
15
|
+
sess = Session(silent=silent)
|
16
|
+
dct_info = sess.get_network_known_nodes(
|
17
|
+
online_only=online_only, allowed_only=allowed_only, supervisor=supervisor,
|
18
|
+
supervisors_only=supervisors_only,
|
19
|
+
)
|
20
|
+
df = dct_info[SESSION_CT.NETSTATS_REPORT]
|
21
|
+
supervisor = dct_info[SESSION_CT.NETSTATS_REPORTER]
|
22
|
+
super_alias = dct_info[SESSION_CT.NETSTATS_REPORTER_ALIAS]
|
23
|
+
nr_supers = dct_info[SESSION_CT.NETSTATS_NR_SUPERVISORS]
|
24
|
+
_elapsed = dct_info[SESSION_CT.NETSTATS_ELAPSED] # computed on call
|
25
|
+
elapsed = time() - t1 # elapsed=_elapsed
|
26
|
+
return df, supervisor, super_alias, nr_supers, elapsed
|
27
|
+
|
4
28
|
def get_nodes(args):
|
5
29
|
"""
|
6
30
|
This function is used to get the information about the nodes and it will perform the following:
|
@@ -13,22 +37,21 @@ def get_nodes(args):
|
|
13
37
|
supervisor_addr = args.supervisor
|
14
38
|
if args.verbose:
|
15
39
|
log_with_color(f"Getting nodes from supervisor <{supervisor_addr}>...", color='b')
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
online_only=online_only, allowed_only=allowed_only, supervisor=supervisor_addr
|
40
|
+
|
41
|
+
res = _get_netstats(
|
42
|
+
silent=not args.verbose,
|
43
|
+
online_only=args.online or args.peered,
|
44
|
+
allowed_only=args.peered,
|
45
|
+
supervisor=supervisor_addr,
|
23
46
|
)
|
24
|
-
df =
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
47
|
+
df, supervisor, super_alias, nr_supers, elapsed = res
|
48
|
+
|
49
|
+
prefix = "Online n" if (args.online or args.peered) else "N"
|
50
|
+
if supervisor == "ERROR":
|
51
|
+
log_with_color(f"No supervisors or no comms available in {elapsed:.1f}s. Please check your settings.", color='r')
|
52
|
+
else:
|
53
|
+
log_with_color(f"{prefix}odes reported by <{supervisor}> '{super_alias}' in {elapsed:.1f}s ({nr_supers} supervisors seen):", color='b')
|
54
|
+
log_with_color(f"{df}")
|
32
55
|
return
|
33
56
|
|
34
57
|
|
@@ -38,15 +61,19 @@ def get_supervisors(args):
|
|
38
61
|
"""
|
39
62
|
if args.verbose:
|
40
63
|
log_with_color("Getting supervisors...", color='b')
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
elapsed =
|
48
|
-
|
49
|
-
|
64
|
+
|
65
|
+
res = _get_netstats(
|
66
|
+
silent=not args.verbose,
|
67
|
+
online_only=True,
|
68
|
+
supervisors_only=True,
|
69
|
+
)
|
70
|
+
df, supervisor, super_alias, nr_supers, elapsed = res
|
71
|
+
|
72
|
+
if supervisor == "ERROR":
|
73
|
+
log_with_color(f"No supervisors or no comms available in {elapsed:.1f}s. Please check your settings.", color='r')
|
74
|
+
else:
|
75
|
+
log_with_color(f"Supervisors reported by <{supervisor}> '{super_alias}' in {elapsed:.1f}s", color='b')
|
76
|
+
log_with_color(f"{df}")
|
50
77
|
return
|
51
78
|
|
52
79
|
|
naeural_client/const/__init__.py
CHANGED
naeural_client/const/misc.py
CHANGED
@@ -18,3 +18,13 @@ WEEKDAYS_SHORT = [
|
|
18
18
|
'SAT',
|
19
19
|
'SUN'
|
20
20
|
]
|
21
|
+
|
22
|
+
|
23
|
+
class SESSION_CT:
|
24
|
+
NETSTATS_REPORT = 'report'
|
25
|
+
NETSTATS_REPORTER = 'reporter'
|
26
|
+
NETSTATS_REPORTER_ALIAS = 'reporter_alias'
|
27
|
+
NETSTATS_NR_SUPERVISORS = 'nr_super'
|
28
|
+
NETSTATS_ELAPSED = 'elapsed'
|
29
|
+
|
30
|
+
|
naeural_client/utils/config.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: naeural_client
|
3
|
-
Version: 2.5.
|
3
|
+
Version: 2.5.23
|
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,10 +1,10 @@
|
|
1
1
|
naeural_client/__init__.py,sha256=GP8WSrn87sjTPO-QRNL2PG8JK5Mixbiea_HrtbG8RAQ,592
|
2
|
-
naeural_client/_ver.py,sha256=
|
2
|
+
naeural_client/_ver.py,sha256=5iGYqdgSJ5XDV0vYuONK0InShYC-HR0Q8mnnsX2d8wY,331
|
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=pux9CrnVimYrNiXdjKLCHNRRuscGvHS1nUBs_ThC21s,89312
|
8
8
|
naeural_client/base/instance.py,sha256=kcZJmjLBtx8Bjj_ysIOx1JmLA-qSpG7E28j5rq6IYus,20444
|
9
9
|
naeural_client/base/pipeline.py,sha256=b4uNHrEIOlAtw4PGUx20dxwBhDck5__SrVXaHcSi8ZA,58251
|
10
10
|
naeural_client/base/plugin_template.py,sha256=qGaXByd_JZFpjvH9GXNbT7KaitRxIJB6-1IhbKrZjq4,138123
|
@@ -20,9 +20,9 @@ naeural_client/bc/ec.py,sha256=mWjodWCRgC3omVXOA9jtNdtPVNn2kMKV3Dcjt9oFUCQ,22974
|
|
20
20
|
naeural_client/certs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
21
|
naeural_client/certs/r9092118.ala.eu-central-1.emqxsl.com.crt,sha256=y-6io0tseyx9-a4Pmde1z1gPULtJNSYUpG_YFkYaMKU,1337
|
22
22
|
naeural_client/cli/README.md,sha256=WPdI_EjzAbUW1aPyj1sSR8rLydcJKZtoiaEtklQrjHo,74
|
23
|
-
naeural_client/cli/cli.py,sha256=
|
23
|
+
naeural_client/cli/cli.py,sha256=Lo5qsANtjvWP0CG2BxIdYF8QLSpUQoLmYIgCGCVZp9Y,3808
|
24
24
|
naeural_client/cli/cli_commands.py,sha256=Y81oKz5Rx8qxYgzEzCwI9eB8iVL6iET7dETLVygs_VE,1686
|
25
|
-
naeural_client/cli/nodes.py,sha256=
|
25
|
+
naeural_client/cli/nodes.py,sha256=lC6M2ODPyt_ciGIAqz0IJOm9s5PpGWy-gpFdRYlvNuI,3248
|
26
26
|
naeural_client/code_cheker/__init__.py,sha256=pwkdeZGVL16ZA4Qf2mRahEhoOvKhL7FyuQbMFLr1E5M,33
|
27
27
|
naeural_client/code_cheker/base.py,sha256=lT5DRIFO5rqzsMNCmdMRfkAeevmezozehyfgmhnKpuI,19074
|
28
28
|
naeural_client/code_cheker/checker.py,sha256=QWupeM7ToancVIq1tRUxRNUrI8B5l5eoY0kDU4-O5aE,7365
|
@@ -30,14 +30,14 @@ naeural_client/comm/__init__.py,sha256=za3B2HUKNXzYtjElMgGM9xbxNsdQfFY4JB_YzdyFk
|
|
30
30
|
naeural_client/comm/amqp_wrapper.py,sha256=hzj6ih07DnLQy2VSfA88giDIFHaCp9uSdGLTA-IFE4s,8535
|
31
31
|
naeural_client/comm/mqtt_wrapper.py,sha256=Ig3bFZkCbWd4y_Whn2PPa91Z3aLgNbNPau6Tn5yLPZ8,16167
|
32
32
|
naeural_client/const/README.md,sha256=6OHesr-f5NBuuJGryEoi_TCu2XdlhfQYlDKx_IJoXeg,177
|
33
|
-
naeural_client/const/__init__.py,sha256=
|
33
|
+
naeural_client/const/__init__.py,sha256=MM6Zib6i7M2qWcMkLtLx14zqU-lE-u2uPHjNvbh2jAM,478
|
34
34
|
naeural_client/const/apps.py,sha256=gIONTZUkqPveu3DwelyJWpbFMeIR9l6DlaNg-xEfK1A,611
|
35
35
|
naeural_client/const/base.py,sha256=-NeZPwE0JrbTHmlI9BOmgzaGu5jUZHl9vOZ4hhh_QQo,3100
|
36
36
|
naeural_client/const/comms.py,sha256=La6JXWHexH8CfcBCKyT4fCIoeaoZlcm7KtZ57ab4ZgU,2201
|
37
37
|
naeural_client/const/environment.py,sha256=iytmTDgbOjvORPwHQmc0K0r-xJx7dnnzNnqAJJiFCDA,870
|
38
38
|
naeural_client/const/formatter.py,sha256=AW3bWlqf39uaqV4BBUuW95qKYfF2OkkU4f9hy3kSVhM,200
|
39
39
|
naeural_client/const/heartbeat.py,sha256=jGHmKfeHTFOXJaKUT3o_ocnQyF-EpcLeunW-ifkYKfU,2534
|
40
|
-
naeural_client/const/misc.py,sha256=
|
40
|
+
naeural_client/const/misc.py,sha256=VDCwwpf5bl9ltx9rzT2WPVP8B3mZFRufU1tSS5MO240,413
|
41
41
|
naeural_client/const/payload.py,sha256=vHKxSrPXnfBTBwD_xp9Aw7nue0_gxz4r01YjXRYiTIM,6479
|
42
42
|
naeural_client/default/__init__.py,sha256=ozU6CMMuWl0LhG8Ae3LrZ65a6tLrptfscVYGf83zjxM,46
|
43
43
|
naeural_client/default/instance/__init__.py,sha256=w1de6OMj9a5GPGF-Wl1b_I_YAy9fWBEss2QnyPPyaB0,546
|
@@ -79,10 +79,10 @@ naeural_client/logging/tzlocal/win32.py,sha256=zBoj0vFVrGhnCm_f7xmYzGym4-fV-4Ij2
|
|
79
79
|
naeural_client/logging/tzlocal/windows_tz.py,sha256=Sv9okktjZJfRGGUOOppsvQuX_eXyXUxkSKCAFmWT9Hw,34203
|
80
80
|
naeural_client/utils/__init__.py,sha256=mAnke3-MeRzz3nhQvhuHqLnpaaCSmDxicd7Ck9uwpmI,77
|
81
81
|
naeural_client/utils/comm_utils.py,sha256=4cS9llRr_pK_3rNgDcRMCQwYPO0kcNU7AdWy_LtMyCY,1072
|
82
|
-
naeural_client/utils/config.py,sha256=
|
82
|
+
naeural_client/utils/config.py,sha256=1hXyL-Kx31IyMF8p5RoVmS03xFek7rYEyfrJFCeSUmE,5265
|
83
83
|
naeural_client/utils/dotenv.py,sha256=_AgSo35n7EnQv5yDyu7C7i0kHragLJoCGydHjvOkrYY,2008
|
84
|
-
naeural_client-2.5.
|
85
|
-
naeural_client-2.5.
|
86
|
-
naeural_client-2.5.
|
87
|
-
naeural_client-2.5.
|
88
|
-
naeural_client-2.5.
|
84
|
+
naeural_client-2.5.23.dist-info/METADATA,sha256=wTPQEnsYckvyw7XarklnpPcedoUB3BYnn7AGimztW-w,14619
|
85
|
+
naeural_client-2.5.23.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
86
|
+
naeural_client-2.5.23.dist-info/entry_points.txt,sha256=PNdyotDaQBAslZREx5luVyj0kqpQnwNACwkFNTPIHU4,55
|
87
|
+
naeural_client-2.5.23.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
|
88
|
+
naeural_client-2.5.23.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|