naeural-client 3.0.4__py3-none-any.whl → 3.0.6__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.4"
1
+ __VER__ = "3.0.6"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  with open("pyproject.toml", "rt") as fd:
@@ -1778,6 +1778,7 @@ class GenericSession(BaseDecentrAIObject):
1778
1778
  on_notification=None,
1779
1779
  max_wait_time=0,
1780
1780
  pipeline_type=None,
1781
+ debug=False,
1781
1782
  **kwargs) -> Pipeline:
1782
1783
  """
1783
1784
  Create a new pipeline on a node. A pipeline is the equivalent of the "config file" used by the Naeural Edge Protocol edge node team internally.
@@ -1857,6 +1858,7 @@ class GenericSession(BaseDecentrAIObject):
1857
1858
  on_data=on_data,
1858
1859
  on_notification=on_notification,
1859
1860
  is_attached=False,
1861
+ debug=debug,
1860
1862
  **kwargs
1861
1863
  )
1862
1864
  self.own_pipelines.append(pipeline)
@@ -9,7 +9,19 @@ class Instance():
9
9
  The Instance class is a wrapper around a plugin instance. It provides a simple API for sending commands to the instance and updating its configuration.
10
10
  """
11
11
 
12
- def __init__(self, log, pipeline, instance_id, signature, on_data=None, on_notification=None, config={}, is_attached=False, **kwargs):
12
+ def __init__(
13
+ self,
14
+ log,
15
+ pipeline,
16
+ instance_id,
17
+ signature,
18
+ on_data=None,
19
+ on_notification=None,
20
+ config={},
21
+ is_attached=False,
22
+ debug=False,
23
+ **kwargs
24
+ ):
13
25
  """
14
26
  Create a new instance of the plugin.
15
27
 
@@ -39,6 +51,7 @@ class Instance():
39
51
  self.instance_id = instance_id
40
52
  self.signature = signature.upper()
41
53
  self.config = {}
54
+ self.__debug = debug
42
55
 
43
56
  if is_attached:
44
57
  assert len(kwargs) == 0, "When attaching an instance, no additional parameters are allowed"
@@ -61,6 +74,11 @@ class Instance():
61
74
  self.on_notification_callbacks.append(on_notification)
62
75
 
63
76
  return
77
+
78
+ def Pd(self, *args, **kwargs):
79
+ if self.__debug:
80
+ self.log.P(*args, **kwargs)
81
+ return
64
82
 
65
83
  # Message handling
66
84
  if True:
@@ -75,6 +93,7 @@ class Instance():
75
93
  data : dict | Payload
76
94
  The data received from the instance
77
95
  """
96
+ self.Pd(f"_on_data: {pipeline.name}:{self.signature}:{self.instance_id}")
78
97
  for callback in self.on_data_callbacks:
79
98
  callback(pipeline, data)
80
99
  for callback in self.temporary_on_data_callbacks.values():
@@ -40,6 +40,7 @@ class Pipeline(BaseCodeChecker):
40
40
  on_notification=None,
41
41
  is_attached=False,
42
42
  existing_config=None,
43
+ debug=False,
43
44
  **kwargs
44
45
  ) -> None:
45
46
  """
@@ -99,6 +100,7 @@ class Pipeline(BaseCodeChecker):
99
100
  self.session = session
100
101
  self.node_addr = node_addr
101
102
  self.name = name
103
+ self.__debug = debug
102
104
 
103
105
  self.config = {}
104
106
  plugins = config.pop('PLUGINS', plugins)
@@ -148,10 +150,27 @@ class Pipeline(BaseCodeChecker):
148
150
 
149
151
  self.__init_plugins(plugins, is_attached)
150
152
  return
153
+
154
+ def Pd(self, *args, **kwargs):
155
+ """
156
+ Print debug message.
157
+ """
158
+ if self.__debug:
159
+ self.P(*args, **kwargs)
160
+ return
151
161
 
152
162
  # Utils
153
163
  if True:
154
- def __init_instance(self, signature, instance_id, config, on_data, on_notification, is_attached):
164
+ def __init_instance(
165
+ self,
166
+ signature,
167
+ instance_id,
168
+ config,
169
+ on_data,
170
+ on_notification,
171
+ is_attached,
172
+ debug=False,
173
+ ):
155
174
  instance_class = None
156
175
  str_signature = None
157
176
  if isinstance(signature, str):
@@ -160,15 +179,17 @@ class Pipeline(BaseCodeChecker):
160
179
  else:
161
180
  instance_class = signature
162
181
  str_signature = instance_class.signature.upper()
163
- instance = instance_class(self.log,
164
- pipeline=self,
165
- signature=str_signature,
166
- instance_id=instance_id,
167
- config=config,
168
- on_data=on_data,
169
- on_notification=on_notification,
170
- is_attached=is_attached
171
- )
182
+ instance = instance_class(
183
+ self.log,
184
+ pipeline=self,
185
+ signature=str_signature,
186
+ instance_id=instance_id,
187
+ config=config,
188
+ on_data=on_data,
189
+ on_notification=on_notification,
190
+ is_attached=is_attached,
191
+ debug=debug,
192
+ )
172
193
  self.lst_plugin_instances.append(instance)
173
194
  return instance
174
195
 
@@ -710,6 +731,7 @@ class Pipeline(BaseCodeChecker):
710
731
  The payload of the message.
711
732
  """
712
733
  # call all self callbacks
734
+ self.Pd(f"Pipeline <{self.name}> received data from <{signature}:{instance_id}>")
713
735
  for callback in self.on_data_callbacks:
714
736
  callback(self, signature, instance_id, data)
715
737
 
@@ -834,6 +856,7 @@ class Pipeline(BaseCodeChecker):
834
856
  config={},
835
857
  on_data=None,
836
858
  on_notification=None,
859
+ debug=False,
837
860
  **kwargs
838
861
  ) -> Instance:
839
862
  """
@@ -884,7 +907,11 @@ class Pipeline(BaseCodeChecker):
884
907
 
885
908
  # create the new instance and add it to the list
886
909
  config = {**config, **kwargs}
887
- instance = self.__init_instance(signature, instance_id, config, on_data, on_notification, is_attached=False)
910
+ instance = self.__init_instance(
911
+ signature=signature, instance_id=instance_id, config=config,
912
+ on_data=on_data, on_notification=on_notification, is_attached=False,
913
+ debug=debug
914
+ )
888
915
  return instance
889
916
 
890
917
  def __remove_plugin_instance(self, instance):
@@ -268,8 +268,8 @@ class R1FSEngine:
268
268
 
269
269
  def _get_unique_or_complete_upload_name(self, fn=None, prefix="r1fs", suffix=""):
270
270
  if fn is not None and os.path.dirname(fn) == "":
271
- return os.path.join(self.__uploads_dir, fn)
272
- return self._get_unique_upload_name(prefix, suffix)
271
+ return os.path.join(self.__uploads_dir, f"{fn}{suffix}")
272
+ return self._get_unique_upload_name(prefix, suffix=suffix)
273
273
 
274
274
  def __set_reprovider_interval(self):
275
275
  # Command to set the Reprovider.Interval to 1 minute
@@ -566,6 +566,7 @@ class R1FSEngine:
566
566
  msg += f"\n Download: {self.__downloads_dir}"
567
567
  msg += f"\n Upload: {self.__uploads_dir}"
568
568
  msg += f"\n SwarmKey: {hidden_base64_swarm_key}"
569
+ msg += f"\n Debug: {self.__debug}"
569
570
  self.P(msg, color='d')
570
571
 
571
572
  ipfs_repo = os.path.expanduser("~/.ipfs")
@@ -251,7 +251,7 @@ def get_apps(args):
251
251
  # 2. Wait for node to appear online
252
252
  found = sess.wait_for_node(node)
253
253
  if not found:
254
- sess.P(f'Node {node} not found. Please check the configuration.', color='r')
254
+ log_with_color(f'Node {node} not found. Please check the configuration.', color='r')
255
255
  return
256
256
  # 3. Check if the node is peered with the client
257
257
  is_allowed = sess.is_peered(node)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: naeural_client
3
- Version: 3.0.4
3
+ Version: 3.0.6
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=7HXIMZFlcmBUxEX-K8mK6oifoBKxJTnecJBxWsd8Z3Y,330
2
+ naeural_client/_ver.py,sha256=jz8z7wmDrMakgqysslBMdMWlK_qlzv3qrEQiMJ73AmA,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=VCJb2gni2qtqqrYn68iG0MfaqsSQVBkj_XcHV3dLngg,115453
8
- naeural_client/base/instance.py,sha256=kcZJmjLBtx8Bjj_ysIOx1JmLA-qSpG7E28j5rq6IYus,20444
9
- naeural_client/base/pipeline.py,sha256=b4BJlqZ4vsGNqYPjJD9Uzrv5G8CVYG_jbND5rh_s8E0,59702
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
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
@@ -62,7 +62,7 @@ naeural_client/io_formatter/default/aixp1.py,sha256=MX0TeUR4APA-qN3vUC6uzcz8Pssz
62
62
  naeural_client/io_formatter/default/default.py,sha256=gEy78cP2D5s0y8vQh4aHuxqz7D10gGfuiKF311QhrpE,494
63
63
  naeural_client/ipfs/__init__.py,sha256=vXEDLUNUO6lOTMGa8iQ9Zf7ajIQq9GZuvYraAHt3meE,38
64
64
  naeural_client/ipfs/ifps_keygen,sha256=PcoYuo4c89_C9FWrKq9K_28ruhKqnxNn1s3nLHiF1tc,879
65
- naeural_client/ipfs/r1fs.py,sha256=ovBOG81tPdWv3M7bPGZwrJylDDNSzQ8K4t04HNe2EZ0,19328
65
+ naeural_client/ipfs/r1fs.py,sha256=voZSoWN07OB-AmSc0WVEngQqyxogmG5ERFOQLOovPhg,19391
66
66
  naeural_client/ipfs/ipfs_setup/ipfs.service,sha256=isTJQsktPy4i1yaDA9AC1OKdlTYvsCCRRAVX-EmGqAs,248
67
67
  naeural_client/ipfs/ipfs_setup/launch_service.sh,sha256=GWhZyNqtohLxJg8Q_c8YnNZduu1ddXDU-IFRRMaEyiY,141
68
68
  naeural_client/ipfs/ipfs_setup/restart.sh,sha256=9xHMgkUoAMI25jeaoDVFbCa_LjojYm3ubljW58RatKE,22
@@ -93,11 +93,11 @@ naeural_client/logging/tzlocal/win32.py,sha256=zBoj0vFVrGhnCm_f7xmYzGym4-fV-4Ij2
93
93
  naeural_client/logging/tzlocal/windows_tz.py,sha256=Sv9okktjZJfRGGUOOppsvQuX_eXyXUxkSKCAFmWT9Hw,34203
94
94
  naeural_client/utils/__init__.py,sha256=mAnke3-MeRzz3nhQvhuHqLnpaaCSmDxicd7Ck9uwpmI,77
95
95
  naeural_client/utils/comm_utils.py,sha256=4cS9llRr_pK_3rNgDcRMCQwYPO0kcNU7AdWy_LtMyCY,1072
96
- naeural_client/utils/config.py,sha256=lAbWe3UMi40BOdsAIZIb-fYtb4LwG3MIYg0EOA1ITr8,10340
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.4.dist-info/METADATA,sha256=XEDm_E4sQ-1V4izCTEIe__fQKMNLEmImtWQQkJvxn-Q,12353
100
- naeural_client-3.0.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
101
- naeural_client-3.0.4.dist-info/entry_points.txt,sha256=CTua17GUrRa4aXeafezGC9TiWKGKQzwTjQmB2jyj22g,91
102
- naeural_client-3.0.4.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
103
- naeural_client-3.0.4.dist-info/RECORD,,
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,,