naeural-client 2.7.10__tar.gz → 2.7.11__tar.gz

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.
Files changed (156) hide show
  1. {naeural_client-2.7.10 → naeural_client-2.7.11}/PKG-INFO +1 -1
  2. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/_ver.py +1 -1
  3. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/base/generic_session.py +34 -2
  4. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/cli/nodes.py +35 -16
  5. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/utils/config.py +6 -6
  6. {naeural_client-2.7.10 → naeural_client-2.7.11}/pyproject.toml +1 -1
  7. {naeural_client-2.7.10 → naeural_client-2.7.11}/tutorials/ex10_telegram_echo_bot.py +4 -4
  8. naeural_client-2.7.11/xperimental/pipelines/start.py +30 -0
  9. naeural_client-2.7.11/xperimental/pipelines/stop.py +12 -0
  10. {naeural_client-2.7.10 → naeural_client-2.7.11}/.devcontainer/Dockerfile +0 -0
  11. {naeural_client-2.7.10 → naeural_client-2.7.11}/.devcontainer/devcontainer.json +0 -0
  12. {naeural_client-2.7.10 → naeural_client-2.7.11}/.gitattributes +0 -0
  13. {naeural_client-2.7.10 → naeural_client-2.7.11}/.github/workflows/python-publish.yml +0 -0
  14. {naeural_client-2.7.10 → naeural_client-2.7.11}/.gitignore +0 -0
  15. {naeural_client-2.7.10 → naeural_client-2.7.11}/.vscode/launch.json +0 -0
  16. {naeural_client-2.7.10 → naeural_client-2.7.11}/LICENSE +0 -0
  17. {naeural_client-2.7.10 → naeural_client-2.7.11}/README.md +0 -0
  18. {naeural_client-2.7.10 → naeural_client-2.7.11}/TODOs.md +0 -0
  19. {naeural_client-2.7.10 → naeural_client-2.7.11}/__init__.py +0 -0
  20. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/__init__.py +0 -0
  21. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/base/__init__.py +0 -0
  22. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/base/distributed_custom_code_presets.py +0 -0
  23. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/base/instance.py +0 -0
  24. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/base/payload/__init__.py +0 -0
  25. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/base/payload/payload.py +0 -0
  26. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/base/pipeline.py +0 -0
  27. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/base/plugin_template.py +0 -0
  28. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/base/responses.py +0 -0
  29. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/base/transaction.py +0 -0
  30. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/base/webapp_pipeline.py +0 -0
  31. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/base_decentra_object.py +0 -0
  32. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/bc/__init__.py +0 -0
  33. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/bc/base.py +0 -0
  34. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/bc/chain.py +0 -0
  35. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/bc/ec.py +0 -0
  36. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/certs/__init__.py +0 -0
  37. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/certs/r9092118.ala.eu-central-1.emqxsl.com.crt +0 -0
  38. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/certs/s624dbd4.ala.us-east-1.emqxsl.com.crt +0 -0
  39. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/cli/README.md +0 -0
  40. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/cli/cli.py +0 -0
  41. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/cli/cli_commands.py +0 -0
  42. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/cli/oracles.py +0 -0
  43. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/code_cheker/__init__.py +0 -0
  44. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/code_cheker/base.py +0 -0
  45. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/code_cheker/checker.py +0 -0
  46. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/comm/__init__.py +0 -0
  47. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/comm/amqp_wrapper.py +0 -0
  48. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/comm/mqtt_wrapper.py +0 -0
  49. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/const/README.md +0 -0
  50. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/const/__init__.py +0 -0
  51. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/const/apps.py +0 -0
  52. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/const/base.py +0 -0
  53. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/const/comms.py +0 -0
  54. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/const/environment.py +0 -0
  55. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/const/evm_net.py +0 -0
  56. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/const/formatter.py +0 -0
  57. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/const/heartbeat.py +0 -0
  58. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/const/misc.py +0 -0
  59. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/const/payload.py +0 -0
  60. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/default/__init__.py +0 -0
  61. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/default/instance/__init__.py +0 -0
  62. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/default/instance/chain_dist_custom_job_01_plugin.py +0 -0
  63. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/default/instance/custom_webapi_01_plugin.py +0 -0
  64. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/default/instance/net_mon_01_plugin.py +0 -0
  65. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/default/instance/telegram_basic_bot_01_plugin.py +0 -0
  66. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/default/instance/telegram_conversational_bot_01_plugin.py +0 -0
  67. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/default/instance/view_scene_01_plugin.py +0 -0
  68. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/default/session/mqtt_session.py +0 -0
  69. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/io_formatter/__init__.py +0 -0
  70. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/io_formatter/base/__init__.py +0 -0
  71. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/io_formatter/base/base_formatter.py +0 -0
  72. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/io_formatter/default/__init__.py +0 -0
  73. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/io_formatter/default/a_dummy.py +0 -0
  74. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/io_formatter/default/aixp1.py +0 -0
  75. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/io_formatter/default/default.py +0 -0
  76. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/io_formatter/io_formatter_manager.py +0 -0
  77. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/logging/__init__.py +0 -0
  78. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/logging/base_logger.py +0 -0
  79. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/logging/logger_mixins/__init__.py +0 -0
  80. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/logging/logger_mixins/class_instance_mixin.py +0 -0
  81. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/logging/logger_mixins/computer_vision_mixin.py +0 -0
  82. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/logging/logger_mixins/datetime_mixin.py +0 -0
  83. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/logging/logger_mixins/download_mixin.py +0 -0
  84. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/logging/logger_mixins/general_serialization_mixin.py +0 -0
  85. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/logging/logger_mixins/json_serialization_mixin.py +0 -0
  86. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/logging/logger_mixins/pickle_serialization_mixin.py +0 -0
  87. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/logging/logger_mixins/process_mixin.py +0 -0
  88. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/logging/logger_mixins/resource_size_mixin.py +0 -0
  89. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/logging/logger_mixins/timers_mixin.py +0 -0
  90. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/logging/logger_mixins/upload_mixin.py +0 -0
  91. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/logging/logger_mixins/utils_mixin.py +0 -0
  92. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/logging/small_logger.py +0 -0
  93. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/logging/tzlocal/__init__.py +0 -0
  94. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/logging/tzlocal/unix.py +0 -0
  95. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/logging/tzlocal/utils.py +0 -0
  96. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/logging/tzlocal/win32.py +0 -0
  97. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/logging/tzlocal/windows_tz.py +0 -0
  98. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/plugins_manager_mixin.py +0 -0
  99. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/utils/__init__.py +0 -0
  100. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/utils/comm_utils.py +0 -0
  101. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/utils/dotenv.py +0 -0
  102. {naeural_client-2.7.10 → naeural_client-2.7.11}/naeural_client/utils/oracle_sync/oracle_tester.py +0 -0
  103. {naeural_client-2.7.10 → naeural_client-2.7.11}/nepctl.MD +0 -0
  104. {naeural_client-2.7.10 → naeural_client-2.7.11}/requirements.txt +0 -0
  105. {naeural_client-2.7.10 → naeural_client-2.7.11}/tutorials/.example_env +0 -0
  106. {naeural_client-2.7.10 → naeural_client-2.7.11}/tutorials/8. custom_code_fastapi_assets/index.html +0 -0
  107. {naeural_client-2.7.10 → naeural_client-2.7.11}/tutorials/9. code_sandbox_from_scratch_assets/index.html +0 -0
  108. {naeural_client-2.7.10 → naeural_client-2.7.11}/tutorials/_example_pk_sdk.pem +0 -0
  109. {naeural_client-2.7.10 → naeural_client-2.7.11}/tutorials/ex01_part1_connect.py +0 -0
  110. {naeural_client-2.7.10 → naeural_client-2.7.11}/tutorials/ex01_part2_filter.py +0 -0
  111. {naeural_client-2.7.10 → naeural_client-2.7.11}/tutorials/ex01_part3_adv_filter.py +0 -0
  112. {naeural_client-2.7.10 → naeural_client-2.7.11}/tutorials/ex02_part1_deploy_webapi.py +0 -0
  113. {naeural_client-2.7.10 → naeural_client-2.7.11}/tutorials/ex02_part2_deploy_plugin.py +0 -0
  114. {naeural_client-2.7.10 → naeural_client-2.7.11}/tutorials/ex03_custom_code_on_one_remote__example_1.py +0 -0
  115. {naeural_client-2.7.10 → naeural_client-2.7.11}/tutorials/ex04_custom_code_on_one_remote__example_2.py +0 -0
  116. {naeural_client-2.7.10 → naeural_client-2.7.11}/tutorials/ex05_custom_code_on_one_remote__example_3.py +0 -0
  117. {naeural_client-2.7.10 → naeural_client-2.7.11}/tutorials/ex06_custom_code_on_multiple_remotes__example_1.py +0 -0
  118. {naeural_client-2.7.10 → naeural_client-2.7.11}/tutorials/ex07_custom_code_on_multiple_remotes__example_2.py +0 -0
  119. {naeural_client-2.7.10 → naeural_client-2.7.11}/tutorials/ex08_custom_webapi.py +0 -0
  120. {naeural_client-2.7.10 → naeural_client-2.7.11}/tutorials/ex09_code_sandbox_from_scratch.py +0 -0
  121. {naeural_client-2.7.10 → naeural_client-2.7.11}/tutorials/ex11_telegram_blackjack_bot.py +0 -0
  122. {naeural_client-2.7.10 → naeural_client-2.7.11}/tutorials/ex12_telegram_smart_bot.py +0 -0
  123. {naeural_client-2.7.10 → naeural_client-2.7.11}/tutorials/ex13_launch_repo_based_webapp.py +0 -0
  124. {naeural_client-2.7.10 → naeural_client-2.7.11}/tutorials/video_presentation/1. hello_world.ipynb +0 -0
  125. {naeural_client-2.7.10 → naeural_client-2.7.11}/winrun.bat +0 -0
  126. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/README.md +0 -0
  127. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/_checks/auth_check.py +0 -0
  128. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/_checks/cstore_check.py +0 -0
  129. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/_checks/keys_check.py +0 -0
  130. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/_checks/ora_check.py +0 -0
  131. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/_checks/payload_check.py +0 -0
  132. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/_checks/session_check.py +0 -0
  133. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/_checks/web3_check.py +0 -0
  134. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/decentralized/chain_dist_example.py +0 -0
  135. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/decentralized/chain_dist_example_initiator.py +0 -0
  136. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/decentralized/chain_dist_example_worker.py +0 -0
  137. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/enc_dec/enc_dec_test.py +0 -0
  138. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/eth/eth_sign.py +0 -0
  139. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/eth/info.md +0 -0
  140. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/eth/sign.py +0 -0
  141. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/multi-enc-dec/multi_test1.py +0 -0
  142. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/multi-enc-dec/multi_test2.py +0 -0
  143. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/sign/simple_payload_checker.py +0 -0
  144. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/sign/test_sign1.py +0 -0
  145. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/sign/test_sign2.py +0 -0
  146. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/utils/get_documentation.py +0 -0
  147. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/various/attach_example.py +0 -0
  148. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/various/ex1.py +0 -0
  149. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/various/hello.py +0 -0
  150. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/various/remote_exec.py +0 -0
  151. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/various/save_images.py +0 -0
  152. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/wl/wl_add.py +0 -0
  153. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/xarchive/_tutorials/3. simple_real_time_custom_code.py +0 -0
  154. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/xarchive/_tutorials/4. real_time_custom_code_2.py +0 -0
  155. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/xarchive/_tutorials/8. chatbot.py +0 -0
  156. {naeural_client-2.7.10 → naeural_client-2.7.11}/xperimental/xarchive/test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: naeural_client
3
- Version: 2.7.10
3
+ Version: 2.7.11
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,4 +1,4 @@
1
- __VER__ = "2.7.10"
1
+ __VER__ = "2.7.11"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  with open("pyproject.toml", "rt") as fd:
@@ -1063,6 +1063,37 @@ class GenericSession(BaseDecentrAIObject):
1063
1063
 
1064
1064
  return
1065
1065
 
1066
+
1067
+ def close_pipeline(self, node_addr : str, pipeline_name : str):
1068
+ """
1069
+ Close a pipeline created by this session.
1070
+
1071
+ Parameters
1072
+ ----------
1073
+ node_addr : str
1074
+ The address of the edge node that owns the pipeline.
1075
+
1076
+ pipeline_name : str
1077
+ The name of the pipeline to close.
1078
+ """
1079
+ pipeline : Pipeline = self._dct_online_nodes_pipelines.get(node_addr, {}).get(pipeline_name, None)
1080
+ if pipeline is not None:
1081
+ self.P(
1082
+ f"Closing known pipeline <{pipeline_name}> from <{node_addr}>",
1083
+ color='y'
1084
+ )
1085
+ pipeline.close()
1086
+ else:
1087
+ self.P(
1088
+ "No known pipeline found. Sending close to <{}> for <{}>".format(
1089
+ node_addr, pipeline_name
1090
+ ),
1091
+ color='y'
1092
+ )
1093
+ self._send_command_archive_pipeline(node_addr, pipeline_name)
1094
+ return
1095
+
1096
+
1066
1097
  def _connect(self) -> None:
1067
1098
  """
1068
1099
  Connect to the communication server using the credentials provided when creating this instance.
@@ -1504,11 +1535,12 @@ class GenericSession(BaseDecentrAIObject):
1504
1535
  ----------
1505
1536
  command : str
1506
1537
  The command to send.
1538
+
1507
1539
  worker : str
1508
1540
  The name of the Naeural Edge Protocol edge node that will receive the command.
1509
1541
 
1510
- Observation: this approach will be deprecated soon in favor of the direct use of the address that
1511
- will not require the node to be already "seend" by the session.
1542
+ Observation: this approach will be deprecated soon in favor of the direct use of
1543
+ the address that will not require the node to be already "seen" by the session.
1512
1544
 
1513
1545
  payload : dict
1514
1546
  The payload to send.
@@ -12,11 +12,19 @@ def _get_netstats(
12
12
  supervisors_only=False,
13
13
  return_session=False,
14
14
  eth=False,
15
- all_info=False
15
+ all_info=False,
16
+ wait_for_node=None
16
17
  ):
17
18
  t1 = time()
18
19
  from naeural_client import Session
19
20
  sess = Session(silent=silent)
21
+ found = None
22
+ if wait_for_node:
23
+ sess.P("Waiting for node '{}' to appear...".format(wait_for_node), color='y')
24
+ found = sess.wait_for_node(wait_for_node, timeout=30)
25
+ if not found:
26
+ sess.P("Node '{}' not found.".format(wait_for_node), color='r')
27
+
20
28
  dct_info = sess.get_network_known_nodes(
21
29
  online_only=online_only, allowed_only=allowed_only, supervisor=supervisor,
22
30
  supervisors_only=supervisors_only,
@@ -95,14 +103,17 @@ def get_supervisors(args):
95
103
  log_with_color(f"{df}")
96
104
  return
97
105
 
98
- def _send_command_to_node(args, command):
106
+ def _send_command_to_node(args, command, ignore_not_found=False):
99
107
  node = args.node
100
108
  silent = not args.verbose
109
+
101
110
 
102
111
  t1 = time()
103
112
  df, _, _, _, _, sess = _get_netstats(
104
- silent=silent, online_only=True, return_session=True
113
+ silent=silent, online_only=True, return_session=True,
114
+ wait_for_node=node
105
115
  )
116
+
106
117
  peered = None
107
118
  selection = df.Alias == node
108
119
  found = selection.any()
@@ -113,20 +124,28 @@ def _send_command_to_node(args, command):
113
124
  node_addr = df_found.Address.values[0]
114
125
  log_with_color(f"{df_found}")
115
126
  if not found:
116
- log_with_color(f"Node '{node}' <{node_addr}> not found in network.", color='r')
117
- return
127
+ log_with_color("Node '{}' <{}> not found in network (toal {} nodes, {} peered).".format(
128
+ node, node_addr, df.shape[0], df.Peered.sum()), color='r'
129
+ )
130
+
118
131
  if not peered:
119
- log_with_color(f"Node '{node}' <{node_addr}> does not accept commands from this SDK.", color='r')
120
- return
132
+ if found:
133
+ log_with_color(f"Node '{node}' <{node_addr}> is not peered.", color='r')
134
+ else:
135
+ log_with_color(f"Node '{node}' <{node_addr}> may not accept this command.", color='r')
136
+
121
137
  # TODO: currently this is based on node alias, but we should be based on node address
122
138
  # and maybe even node alias
123
- if command == COMMANDS.RESTART:
124
- sess._send_command_restart_node(node)
125
- elif command == COMMANDS.SHUTDOWN:
126
- sess._send_command_stop_node(node)
127
- else:
128
- log_with_color(f"Command '{command}' not supported.", color='r')
129
- return
139
+ if (found and peered) or ignore_not_found:
140
+ if ignore_not_found:
141
+ log_with_color(f"Sending blind '{command}' to node <{node}>", color='b')
142
+ if command == COMMANDS.RESTART:
143
+ sess._send_command_restart_node(node)
144
+ elif command == COMMANDS.STOP:
145
+ sess._send_command_stop_node(node)
146
+ else:
147
+ log_with_color(f"Command '{command}' not supported.", color='r')
148
+ return
130
149
  elapsed = time() - t1
131
150
  return
132
151
 
@@ -141,7 +160,7 @@ def restart_node(args):
141
160
  """
142
161
  node = args.node
143
162
  log_with_color(f"Attempting to restart node <{node}>", color='b')
144
- _send_command_to_node(args, COMMANDS.RESTART)
163
+ _send_command_to_node(args, COMMANDS.RESTART, ignore_not_found=True)
145
164
  return
146
165
 
147
166
 
@@ -156,6 +175,6 @@ def shutdown_node(args):
156
175
  """
157
176
  node = args.node
158
177
  log_with_color(f"Attempting to shutdown node <{node}>", color='b')
159
- _send_command_to_node(args, COMMANDS.SHUTDOWN)
178
+ _send_command_to_node(args, COMMANDS.STOP, ignore_not_found=True)
160
179
  return
161
180
 
@@ -187,11 +187,11 @@ def show_version(silent=True):
187
187
 
188
188
  user_folder = get_user_folder()
189
189
 
190
- log_with_color(f"SDK folder: {user_folder}", color='b')
191
- log_with_color(f"SDK version: {version}", color='b')
192
- log_with_color(f"Ratio1 selected network: {get_network()}", color='b')
193
- log_with_color(f"SDK Client address: {sess.get_client_address()}", color='b')
194
- log_with_color(f"SDK Client ETH address: {sess.bc_engine.eth_address}", color='b')
190
+ log_with_color(f"SDK folder: {user_folder}", color='b')
191
+ log_with_color(f"SDK version: {version}", color='b')
192
+ log_with_color(f"Ratio1 network: {get_network()}", color='b')
193
+ log_with_color(f"SDK addr: {sess.get_client_address()}", color='b')
194
+ log_with_color(f"SDK ETH addr: {sess.bc_engine.eth_address}", color='b')
195
195
  return
196
196
 
197
197
 
@@ -206,7 +206,7 @@ def show_config(args):
206
206
  with config_file.open("r") as file:
207
207
  lines = file.readlines()
208
208
  keys = [line.strip().split("=")[0] for line in lines if "=" in line]
209
- log_with_color(f"Current configuration ({config_file}) has {keys}", color='d')
209
+ log_with_color(f"Current config {config_file} has {len(keys)} keys: {keys}", color='d')
210
210
  else:
211
211
  log_with_color(f"No configuration found at {config_file}. Please run `reset_config` first.", color="r")
212
212
  return
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "naeural_client"
7
- version = "2.7.10"
7
+ version = "2.7.11"
8
8
  authors = [
9
9
  { name="Andrei Ionut Damian", email="andrei.damian@me.com" },
10
10
  { name="Cristan Bleotiu", email="cristibleotiu@gmail.com" },
@@ -15,6 +15,8 @@ def reply(plugin: CustomPluginTemplate, message: str, user: str):
15
15
 
16
16
 
17
17
  if __name__ == "__main__":
18
+ # Note: in order correctly setup the deployment you have to create the Session
19
+ # object that will configure the execution environment
18
20
  session = Session()
19
21
 
20
22
  # NOTE: When working with SDK please use the nodes internal addresses. While the EVM address of the node
@@ -24,8 +26,6 @@ if __name__ == "__main__":
24
26
 
25
27
  # this tutorial assumes you have started your own local node for dev-testing purposes
26
28
  # you can either supply the node address via env or directly here
27
- # Note: in order to get the environment variable first you have to create the Session
28
- # object that will load the environment variables
29
29
  my_node = os.getenv("EE_TARGET_NODE", "0xai_my_own_node_address")
30
30
 
31
31
  session.wait_for_node(my_node)
@@ -38,7 +38,7 @@ if __name__ == "__main__":
38
38
  pipeline, _ = session.create_telegram_simple_bot(
39
39
  node=my_node,
40
40
  name="telegram_bot_echo",
41
- telegram_bot_token="your_token_goes_here", # we use the token directly
41
+ # telegram_bot_token="your_token_goes_here", # we use the token directly
42
42
  message_handler=reply,
43
43
  )
44
44
 
@@ -51,7 +51,7 @@ if __name__ == "__main__":
51
51
  # in production, you would not need this code as the script can close
52
52
  # after the pipeline will be sent
53
53
  session.wait(
54
- seconds=120, # we wait the session for 120 seconds
54
+ seconds=60, # we wait the session for 120 seconds
55
55
  close_pipelines=True, # we close the pipelines after the session
56
56
  close_session=True, # we close the session after the session
57
57
  )
@@ -0,0 +1,30 @@
1
+ import os
2
+ import time
3
+
4
+ from naeural_client import Session, CustomPluginTemplate, PLUGIN_TYPES
5
+
6
+ def reply(plugin: CustomPluginTemplate, message: str, user: str):
7
+ """
8
+ This function is used to reply to a message. The given parameters are mandatory
9
+ """
10
+ plugin.obj_cache["users"][user] = self.time()
11
+ plugin.int_cache[user] += 1 # int_cache is a default dict that allows persistence in the plugin
12
+ plugin.P(f"Replying to the {plugin.int_cache[user]} msg of '{user}' on message '{message}'")
13
+ result = f"The answer to your {plugin.int_cache[user]} question is in the question itself: {message}"
14
+ return result
15
+
16
+
17
+ if __name__ == "__main__":
18
+ session = Session()
19
+ my_node = os.getenv("EE_TARGET_NODE")
20
+ assert my_node
21
+
22
+ session.wait_for_node(my_node)
23
+ pipeline, _ = session.create_telegram_simple_bot(
24
+ node=my_node,
25
+ name="telegram_bot_echo",
26
+ message_handler=reply,
27
+ )
28
+
29
+ pipeline.deploy() # we deploy the pipeline
30
+ session.close() # close the session, leave the pipeline on
@@ -0,0 +1,12 @@
1
+ import os
2
+ from naeural_client import Session
3
+
4
+
5
+ if __name__ == "__main__":
6
+ session = Session()
7
+
8
+ my_node = os.getenv("EE_TARGET_NODE", "0xai_my_own_node_address")
9
+ my_pipeline = "telegram_bot_echo"
10
+
11
+ session.close_pipeline(my_node, my_pipeline)
12
+ session.close()
File without changes