naeural-client 3.0.6__py3-none-any.whl → 3.0.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 +23 -7
- naeural_client/base/instance.py +2 -1
- naeural_client/base/pipeline.py +1 -0
- naeural_client/cli/cli.py +10 -0
- {naeural_client-3.0.6.dist-info → naeural_client-3.0.8.dist-info}/METADATA +1 -1
- {naeural_client-3.0.6.dist-info → naeural_client-3.0.8.dist-info}/RECORD +10 -10
- {naeural_client-3.0.6.dist-info → naeural_client-3.0.8.dist-info}/WHEEL +0 -0
- {naeural_client-3.0.6.dist-info → naeural_client-3.0.8.dist-info}/entry_points.txt +0 -0
- {naeural_client-3.0.6.dist-info → naeural_client-3.0.8.dist-info}/licenses/LICENSE +0 -0
naeural_client/_ver.py
CHANGED
@@ -89,7 +89,7 @@ class GenericSession(BaseDecentrAIObject):
|
|
89
89
|
on_notification=None,
|
90
90
|
on_heartbeat=None,
|
91
91
|
debug_silent=True,
|
92
|
-
debug=
|
92
|
+
debug=1,
|
93
93
|
silent=False,
|
94
94
|
verbosity=1,
|
95
95
|
dotenv_path=None,
|
@@ -145,6 +145,7 @@ class GenericSession(BaseDecentrAIObject):
|
|
145
145
|
As arguments, it has a reference to this Session object, the node name, the pipeline, signature and instance, and the payload.
|
146
146
|
This callback acts as a default payload processor and will be called even if for a given instance
|
147
147
|
the user has defined a specific callback.
|
148
|
+
|
148
149
|
on_notification : Callable[[Session, str, dict], None], optional
|
149
150
|
Callback that handles notifications received from this network.
|
150
151
|
As arguments, it has a reference to this Session object, the node name and the notification payload.
|
@@ -153,6 +154,7 @@ class GenericSession(BaseDecentrAIObject):
|
|
153
154
|
This callback will be called when there are notifications related to the node itself, e.g. when the node runs
|
154
155
|
low on memory.
|
155
156
|
Defaults to None.
|
157
|
+
|
156
158
|
on_heartbeat : Callable[[Session, str, dict], None], optional
|
157
159
|
Callback that handles heartbeats received from this network.
|
158
160
|
As arguments, it has a reference to this Session object, the node name and the heartbeat payload.
|
@@ -162,8 +164,12 @@ class GenericSession(BaseDecentrAIObject):
|
|
162
164
|
This flag will disable debug logs, set to 'False` for a more verbose log, by default True
|
163
165
|
Observation: Obsolete, will be removed
|
164
166
|
|
165
|
-
debug : bool, optional
|
166
|
-
This flag will enable debug logs, set to '
|
167
|
+
debug : bool or int, optional
|
168
|
+
This flag will enable debug logs, set to 'True` or 2 for a more verbose log, by default 1
|
169
|
+
- 0 or False will disable debug logs
|
170
|
+
- 1 will enable level 1
|
171
|
+
- 2 will enable full debug
|
172
|
+
|
167
173
|
|
168
174
|
|
169
175
|
silent : bool, optional
|
@@ -185,8 +191,11 @@ class GenericSession(BaseDecentrAIObject):
|
|
185
191
|
If True, the SDK will use the home folder as the base folder for the local cache.
|
186
192
|
NOTE: if you need to use development style ./_local_cache, set this to False.
|
187
193
|
"""
|
188
|
-
|
189
194
|
debug = debug or not debug_silent
|
195
|
+
if isinstance(debug, bool):
|
196
|
+
debug = 2 if debug else 0
|
197
|
+
|
198
|
+
self.__debug = int(debug) > 0
|
190
199
|
|
191
200
|
self.__at_least_one_node_peered = False
|
192
201
|
self.__at_least_a_netmon_received = False
|
@@ -278,13 +287,20 @@ class GenericSession(BaseDecentrAIObject):
|
|
278
287
|
|
279
288
|
super(GenericSession, self).__init__(
|
280
289
|
log=log,
|
281
|
-
DEBUG=debug,
|
290
|
+
DEBUG=int(debug) > 1,
|
282
291
|
create_logger=True,
|
283
292
|
silent=self.silent,
|
284
293
|
local_cache_base_folder=local_cache_base_folder,
|
285
294
|
local_cache_app_folder=local_cache_app_folder,
|
286
295
|
)
|
287
296
|
return
|
297
|
+
|
298
|
+
def Pd(self, *args, **kwargs):
|
299
|
+
if self.__debug:
|
300
|
+
kwargs["color"] = 'd' if kwargs.get("color") != 'r' else 'r'
|
301
|
+
self.log.P(*args, **kwargs)
|
302
|
+
return
|
303
|
+
|
288
304
|
|
289
305
|
def startup(self):
|
290
306
|
## 1st config step - we prepare config via ~/.naeural/config or .env
|
@@ -830,7 +846,7 @@ class GenericSession(BaseDecentrAIObject):
|
|
830
846
|
if needs_netconfig:
|
831
847
|
lst_netconfig_request.append(node_addr)
|
832
848
|
# end for each node in network map
|
833
|
-
self.
|
849
|
+
self.Pd(f"Net mon from <{sender_addr}> `{ee_id}`: {len(online_addresses)}/{len(all_addresses)}")
|
834
850
|
if len(lst_netconfig_request) > 0:
|
835
851
|
self.__request_pipelines_from_net_config_monitor(lst_netconfig_request)
|
836
852
|
# end if needs netconfig
|
@@ -1607,7 +1623,7 @@ class GenericSession(BaseDecentrAIObject):
|
|
1607
1623
|
)
|
1608
1624
|
self.bc_engine.sign(msg_to_send, use_digest=True)
|
1609
1625
|
if show_command:
|
1610
|
-
self.
|
1626
|
+
self.Pd(
|
1611
1627
|
"Sending command '{}' to '{}':\n{}".format(command, worker, json.dumps(msg_to_send, indent=2)),
|
1612
1628
|
color='y',
|
1613
1629
|
verbosity=1
|
naeural_client/base/instance.py
CHANGED
@@ -77,6 +77,7 @@ class Instance():
|
|
77
77
|
|
78
78
|
def Pd(self, *args, **kwargs):
|
79
79
|
if self.__debug:
|
80
|
+
kwargs["color"] = 'd' if kwargs.get("color") != 'r' else 'r'
|
80
81
|
self.log.P(*args, **kwargs)
|
81
82
|
return
|
82
83
|
|
@@ -522,7 +523,7 @@ class Instance():
|
|
522
523
|
The list of transactions generated, or None if `wait_confirmation` is False.
|
523
524
|
|
524
525
|
"""
|
525
|
-
self.
|
526
|
+
self.Pd(f'Sending command <{command}> to instance <{self.__repr__()}>', color="b")
|
526
527
|
|
527
528
|
self.__was_last_operation_successful = None
|
528
529
|
|
naeural_client/base/pipeline.py
CHANGED
naeural_client/cli/cli.py
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
import signal
|
2
|
+
import sys
|
1
3
|
import argparse
|
2
4
|
|
3
5
|
from naeural_client.utils.config import maybe_init_config, log_with_color
|
@@ -6,6 +8,11 @@ from naeural_client.cli.cli_commands import CLI_COMMANDS
|
|
6
8
|
from naeural_client import version
|
7
9
|
import traceback
|
8
10
|
|
11
|
+
def handle_sigint(signum, frame):
|
12
|
+
"""Handler for the SIGINT signal (Ctrl-C)."""
|
13
|
+
print("Interrupted. Exiting...")
|
14
|
+
sys.exit(1)
|
15
|
+
|
9
16
|
|
10
17
|
def create_global_parser():
|
11
18
|
"""
|
@@ -96,6 +103,9 @@ def main():
|
|
96
103
|
Ensures the configuration is initialized, builds the parser,
|
97
104
|
and executes the appropriate command function.
|
98
105
|
"""
|
106
|
+
# Register the SIGINT handler
|
107
|
+
signal.signal(signal.SIGINT, handle_sigint)
|
108
|
+
|
99
109
|
try:
|
100
110
|
# Initialize configuration if necessary
|
101
111
|
initialized = maybe_init_config()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: naeural_client
|
3
|
-
Version: 3.0.
|
3
|
+
Version: 3.0.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=agGbq5olvN2ffZrM6LrywhSzIGk7JKT-eRMKkI0bRjM,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=
|
8
|
-
naeural_client/base/instance.py,sha256=
|
9
|
-
naeural_client/base/pipeline.py,sha256=
|
7
|
+
naeural_client/base/generic_session.py,sha256=UVrcCfq9W-wBCF8b3XTFtNzXJ2NDaBJKPx5NWwIW1Xk,115925
|
8
|
+
naeural_client/base/instance.py,sha256=bDb9y9ez1vLEGGOCAACQoil7Dw-h7UAwCc18IEfqEas,20789
|
9
|
+
naeural_client/base/pipeline.py,sha256=GYqDd59QQEn7_MTM_dhWsZtdit5q3rECC8HEivWXowo,60068
|
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
|
@@ -22,7 +22,7 @@ naeural_client/certs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
|
|
22
22
|
naeural_client/certs/r9092118.ala.eu-central-1.emqxsl.com.crt,sha256=y-6io0tseyx9-a4Pmde1z1gPULtJNSYUpG_YFkYaMKU,1337
|
23
23
|
naeural_client/certs/s624dbd4.ala.us-east-1.emqxsl.com.crt,sha256=y-6io0tseyx9-a4Pmde1z1gPULtJNSYUpG_YFkYaMKU,1337
|
24
24
|
naeural_client/cli/README.md,sha256=WPdI_EjzAbUW1aPyj1sSR8rLydcJKZtoiaEtklQrjHo,74
|
25
|
-
naeural_client/cli/cli.py,sha256=
|
25
|
+
naeural_client/cli/cli.py,sha256=MH43FKpUfEG5Y8x8n1KZQh3UaSiLOwyvrWiYp_wLVW4,4070
|
26
26
|
naeural_client/cli/cli_commands.py,sha256=XfZGVCSD2-rUr2EdQXOxxN2VwQd2f2aTMeSgRzXnuvs,3829
|
27
27
|
naeural_client/cli/nodes.py,sha256=53-Ht42Xiq3rJEVA2ErZHLLC9OUjh6-rNGrc2RA-U8o,5733
|
28
28
|
naeural_client/cli/oracles.py,sha256=Y_PzHshfSERS_Utjjtw5d_BsQRdGr6P4L6uW8yTdA0M,4809
|
@@ -96,8 +96,8 @@ naeural_client/utils/comm_utils.py,sha256=4cS9llRr_pK_3rNgDcRMCQwYPO0kcNU7AdWy_L
|
|
96
96
|
naeural_client/utils/config.py,sha256=upTCJWpZ-Or8V_71DHrIZ429LKn08KNySKcw0WIADcc,10348
|
97
97
|
naeural_client/utils/dotenv.py,sha256=_AgSo35n7EnQv5yDyu7C7i0kHragLJoCGydHjvOkrYY,2008
|
98
98
|
naeural_client/utils/oracle_sync/oracle_tester.py,sha256=X-923ccjkr6_kzbbiuAAcWSIhMtBDOH2VURjTh55apQ,27235
|
99
|
-
naeural_client-3.0.
|
100
|
-
naeural_client-3.0.
|
101
|
-
naeural_client-3.0.
|
102
|
-
naeural_client-3.0.
|
103
|
-
naeural_client-3.0.
|
99
|
+
naeural_client-3.0.8.dist-info/METADATA,sha256=YL5ezBTn3NKUskdV7k5H1DuWYtHlMI9Q0bWiDYjVTrA,12353
|
100
|
+
naeural_client-3.0.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
101
|
+
naeural_client-3.0.8.dist-info/entry_points.txt,sha256=CTua17GUrRa4aXeafezGC9TiWKGKQzwTjQmB2jyj22g,91
|
102
|
+
naeural_client-3.0.8.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
|
103
|
+
naeural_client-3.0.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|