naeural-client 3.0.6__py3-none-any.whl → 3.0.7__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 CHANGED
@@ -1,4 +1,4 @@
1
- __VER__ = "3.0.6"
1
+ __VER__ = "3.0.7"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  with open("pyproject.toml", "rt") as fd:
@@ -89,7 +89,7 @@ class GenericSession(BaseDecentrAIObject):
89
89
  on_notification=None,
90
90
  on_heartbeat=None,
91
91
  debug_silent=True,
92
- debug=False,
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 'False` for a more verbose log, by default False
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.P(f"Net mon from <{sender_addr}> `{ee_id}`: {len(online_addresses)}/{len(all_addresses)}", color='y')
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.P(
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
@@ -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.P(f'Sending command <{command}> to instance <{self.__repr__()}>', color="b")
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
 
@@ -156,6 +156,7 @@ class Pipeline(BaseCodeChecker):
156
156
  Print debug message.
157
157
  """
158
158
  if self.__debug:
159
+ kwargs["color"] = 'd' if kwargs.get("color") != 'r' else 'r'
159
160
  self.P(*args, **kwargs)
160
161
  return
161
162
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: naeural_client
3
- Version: 3.0.6
3
+ Version: 3.0.7
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=jz8z7wmDrMakgqysslBMdMWlK_qlzv3qrEQiMJ73AmA,330
2
+ naeural_client/_ver.py,sha256=OPLz5MVG0CNDQKO3wg7bABmsaCfJEnDBjWTzSQG15qk,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=_yokitSejGFQUp8iyMEomUiDGa-c7G9ro6er4R9_GMM,115513
8
- naeural_client/base/instance.py,sha256=WqCrN5OPKmqgkQEd9jijcZMS2SnfCQ_EO_XHDIQhg78,20721
9
- naeural_client/base/pipeline.py,sha256=38txaMKmQ8KFBmZR8rr16cAt0AKNYcALTCPJ-HFSo6E,60001
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
@@ -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.6.dist-info/METADATA,sha256=t896emzhsxe93SJUbJytZxrUIAM8sFhAwryN_FqSXmg,12353
100
- naeural_client-3.0.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
101
- naeural_client-3.0.6.dist-info/entry_points.txt,sha256=CTua17GUrRa4aXeafezGC9TiWKGKQzwTjQmB2jyj22g,91
102
- naeural_client-3.0.6.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
103
- naeural_client-3.0.6.dist-info/RECORD,,
99
+ naeural_client-3.0.7.dist-info/METADATA,sha256=KVJVFkcGJk5qGxCuKHzww_JJS7v-P3GVaYHERlroykU,12353
100
+ naeural_client-3.0.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
101
+ naeural_client-3.0.7.dist-info/entry_points.txt,sha256=CTua17GUrRa4aXeafezGC9TiWKGKQzwTjQmB2jyj22g,91
102
+ naeural_client-3.0.7.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
103
+ naeural_client-3.0.7.dist-info/RECORD,,