naeural-client 2.5.22__tar.gz → 2.5.24__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {naeural_client-2.5.22 → naeural_client-2.5.24}/PKG-INFO +1 -1
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/_ver.py +1 -1
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/base/generic_session.py +14 -7
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/cli/cli.py +12 -11
- naeural_client-2.5.24/naeural_client/cli/nodes.py +103 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/const/__init__.py +1 -1
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/const/misc.py +10 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/utils/config.py +4 -2
- {naeural_client-2.5.22 → naeural_client-2.5.24}/pyproject.toml +1 -1
- naeural_client-2.5.24/xperimental/multi-enc-dec/multi_test2.py +44 -0
- naeural_client-2.5.22/naeural_client/cli/nodes.py +0 -76
- {naeural_client-2.5.22 → naeural_client-2.5.24}/.devcontainer/Dockerfile +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/.devcontainer/devcontainer.json +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/.gitattributes +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/.github/workflows/python-publish.yml +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/.gitignore +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/.vscode/launch.json +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/LICENSE +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/README.md +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/TODOs.md +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/__init__.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/__init__.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/base/__init__.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/base/distributed_custom_code_presets.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/base/instance.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/base/payload/__init__.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/base/payload/payload.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/base/pipeline.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/base/plugin_template.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/base/responses.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/base/transaction.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/base/webapp_pipeline.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/base_decentra_object.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/bc/__init__.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/bc/base.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/bc/chain.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/bc/ec.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/certs/__init__.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/certs/r9092118.ala.eu-central-1.emqxsl.com.crt +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/cli/README.md +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/cli/cli_commands.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/code_cheker/__init__.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/code_cheker/base.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/code_cheker/checker.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/comm/__init__.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/comm/amqp_wrapper.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/comm/mqtt_wrapper.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/const/README.md +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/const/apps.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/const/base.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/const/comms.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/const/environment.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/const/formatter.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/const/heartbeat.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/const/payload.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/default/__init__.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/default/instance/__init__.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/default/instance/chain_dist_custom_job_01_plugin.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/default/instance/custom_webapi_01_plugin.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/default/instance/net_mon_01_plugin.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/default/instance/telegram_basic_bot_01_plugin.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/default/instance/telegram_conversational_bot_01_plugin.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/default/instance/view_scene_01_plugin.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/default/session/mqtt_session.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/io_formatter/__init__.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/io_formatter/base/__init__.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/io_formatter/base/base_formatter.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/io_formatter/default/__init__.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/io_formatter/default/a_dummy.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/io_formatter/default/aixp1.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/io_formatter/default/default.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/io_formatter/io_formatter_manager.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/__init__.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/base_logger.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/logger_mixins/__init__.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/logger_mixins/class_instance_mixin.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/logger_mixins/computer_vision_mixin.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/logger_mixins/datetime_mixin.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/logger_mixins/download_mixin.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/logger_mixins/general_serialization_mixin.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/logger_mixins/json_serialization_mixin.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/logger_mixins/pickle_serialization_mixin.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/logger_mixins/process_mixin.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/logger_mixins/resource_size_mixin.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/logger_mixins/timers_mixin.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/logger_mixins/upload_mixin.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/logger_mixins/utils_mixin.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/small_logger.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/tzlocal/__init__.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/tzlocal/unix.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/tzlocal/utils.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/tzlocal/win32.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/tzlocal/windows_tz.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/plugins_manager_mixin.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/utils/__init__.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/utils/comm_utils.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/utils/dotenv.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/nepctl.MD +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/requirements.txt +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/.example_env +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/8. custom_code_fastapi_assets/index.html +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/9. code_sandbox_from_scratch_assets/index.html +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/_example_pk_sdk.pem +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/ex01_part1_connect.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/ex01_part2_filter.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/ex01_part3_adv_filter.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/ex02_first_deploy.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/ex03_custom_code_on_one_remote__example_1.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/ex04_custom_code_on_one_remote__example_2.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/ex05_custom_code_on_one_remote__example_3.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/ex06_custom_code_on_multiple_remotes__example_1.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/ex07_custom_code_on_multiple_remotes__example_2.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/ex08_custom_webapi.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/ex09_code_sandbox_from_scratch.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/ex10_telegram_echo_bot.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/ex11_telegram_blackjack_bot.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/ex12_telegram_smart_bot.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/ex13_launch_repo_based_webapp.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/video_presentation/1. hello_world.ipynb +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/winrun.bat +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/.example_env +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/_archive/test.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/_tutorials/3. simple_real_time_custom_code.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/_tutorials/4. real_time_custom_code_2.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/_tutorials/8. chatbot.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/decentralized/chain_dist_example.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/decentralized/chain_dist_example_initiator.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/decentralized/chain_dist_example_worker.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/enc_dec/enc_dec_test.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/eth/eth_sign.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/eth/info.md +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/eth/sign.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/multi-enc-dec/multi_test1.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/sign/test_sign1.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/utils/get_documentation.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/various/README.md +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/various/attach_example.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/various/ex1.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/various/hello.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/various/remote_exec.py +0 -0
- {naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/various/save_images.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: naeural_client
|
3
|
-
Version: 2.5.
|
3
|
+
Version: 2.5.24
|
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
|
@@ -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
|
@@ -2255,6 +2255,7 @@ class GenericSession(BaseDecentrAIObject):
|
|
2255
2255
|
min_supervisors=2,
|
2256
2256
|
allowed_only=False,
|
2257
2257
|
supervisor=None,
|
2258
|
+
df_only=False,
|
2258
2259
|
):
|
2259
2260
|
"""
|
2260
2261
|
This function will return a Pandas dataframe known nodes in the network based on
|
@@ -2282,6 +2283,9 @@ class GenericSession(BaseDecentrAIObject):
|
|
2282
2283
|
supervisor : str, optional
|
2283
2284
|
The supervisor to wait for. Defaults to None.
|
2284
2285
|
|
2286
|
+
df_only : bool, optional
|
2287
|
+
If True, will return only the Pandas dataframe. Defaults to False.
|
2288
|
+
|
2285
2289
|
Returns
|
2286
2290
|
-------
|
2287
2291
|
|
@@ -2324,10 +2328,11 @@ class GenericSession(BaseDecentrAIObject):
|
|
2324
2328
|
elapsed = tm() - start
|
2325
2329
|
# end while
|
2326
2330
|
# done waiting for supervisors
|
2331
|
+
best_super = 'ERROR'
|
2332
|
+
best_super_alias = 'ERROR'
|
2327
2333
|
|
2328
2334
|
if len(self.__current_network_statuses) > 0:
|
2329
2335
|
best_info = {}
|
2330
|
-
best_super = None
|
2331
2336
|
for supervisor, net_info in self.__current_network_statuses.items():
|
2332
2337
|
if len(net_info) > len(best_info):
|
2333
2338
|
best_info = net_info
|
@@ -2368,10 +2373,12 @@ class GenericSession(BaseDecentrAIObject):
|
|
2368
2373
|
# end if
|
2369
2374
|
pd.options.display.float_format = '{:.1f}'.format
|
2370
2375
|
dct_result = _DotDict({
|
2371
|
-
|
2372
|
-
|
2373
|
-
|
2374
|
-
|
2375
|
-
|
2376
|
+
SESSION_CT.NETSTATS_REPORT : pd.DataFrame(res),
|
2377
|
+
SESSION_CT.NETSTATS_REPORTER : best_super,
|
2378
|
+
SESSION_CT.NETSTATS_REPORTER_ALIAS : best_super_alias,
|
2379
|
+
SESSION_CT.NETSTATS_NR_SUPERVISORS : len(self.__current_network_statuses),
|
2380
|
+
SESSION_CT.NETSTATS_ELAPSED : elapsed,
|
2376
2381
|
})
|
2382
|
+
if df_only:
|
2383
|
+
return dct_result[SESSION_CT.NETSTATS_REPORT]
|
2377
2384
|
return dct_result
|
@@ -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
|
@@ -0,0 +1,103 @@
|
|
1
|
+
from time import time
|
2
|
+
from naeural_client.utils.config import log_with_color
|
3
|
+
from naeural_client.const import SESSION_CT
|
4
|
+
|
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
|
+
|
28
|
+
def get_nodes(args):
|
29
|
+
"""
|
30
|
+
This function is used to get the information about the nodes and it will perform the following:
|
31
|
+
|
32
|
+
1. Create a Session object.
|
33
|
+
2. Wait for the first net mon message via Session and show progress.
|
34
|
+
3. Wait for the second net mon message via Session and show progress.
|
35
|
+
4. Get the active nodes union via Session and display the nodes marking those peered vs non-peered.
|
36
|
+
"""
|
37
|
+
supervisor_addr = args.supervisor
|
38
|
+
if args.verbose:
|
39
|
+
log_with_color(f"Getting nodes from supervisor <{supervisor_addr}>...", color='b')
|
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,
|
46
|
+
)
|
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}")
|
55
|
+
return
|
56
|
+
|
57
|
+
|
58
|
+
def get_supervisors(args):
|
59
|
+
"""
|
60
|
+
This function is used to get the information about the supervisors.
|
61
|
+
"""
|
62
|
+
if args.verbose:
|
63
|
+
log_with_color("Getting supervisors...", color='b')
|
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}")
|
77
|
+
return
|
78
|
+
|
79
|
+
|
80
|
+
def restart_node(args):
|
81
|
+
"""
|
82
|
+
This function is used to restart the node.
|
83
|
+
|
84
|
+
Parameters
|
85
|
+
----------
|
86
|
+
args : argparse.Namespace
|
87
|
+
Arguments passed to the function.
|
88
|
+
"""
|
89
|
+
log_with_color(f"Restarting node {args.node} NOT IMPLEMENTED", color='r')
|
90
|
+
return
|
91
|
+
|
92
|
+
|
93
|
+
def shutdown_node(args):
|
94
|
+
"""
|
95
|
+
This function is used to shutdown the node.
|
96
|
+
|
97
|
+
Parameters
|
98
|
+
----------
|
99
|
+
args : argparse.Namespace
|
100
|
+
Arguments passed to the function.
|
101
|
+
"""
|
102
|
+
log_with_color(f"Shutting down node {args.node} NOT IMPLEMENTED", color='r')
|
103
|
+
return
|
@@ -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
|
+
|
@@ -181,10 +181,12 @@ def load_user_defined_config(verbose=False):
|
|
181
181
|
def maybe_init_config():
|
182
182
|
"""
|
183
183
|
Initializes the configuration if it doesn't exist yet.
|
184
|
+
|
185
|
+
TODO: in v3+ this will be migrated to a online authentication process.
|
184
186
|
"""
|
185
187
|
config_file = get_user_config_file()
|
186
|
-
|
187
188
|
if not config_file.exists():
|
188
189
|
log_with_color(f"No configuration file found at {config_file}. Initializing configuration...", color="y")
|
189
190
|
reset_config()
|
190
|
-
|
191
|
+
return False
|
192
|
+
return load_user_defined_config()
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import json
|
2
|
+
|
3
|
+
from naeural_client import Logger, const
|
4
|
+
from naeural_client.bc import DefaultBlockEngine
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
if __name__ == '__main__' :
|
9
|
+
l = Logger("ENC", base_folder=".", app_folder="_local_cache")
|
10
|
+
|
11
|
+
|
12
|
+
data = {
|
13
|
+
"EE_IS_ENCRYPTED": True,
|
14
|
+
"EE_ENCRYPTED_DATA": "fwcctxETcji64z/KAYFmyWE8RDrJwm2BToMMZD9uesGtWatmDA1nadqpaAwlQajJg9SYb6jeadwxeIqg15VlDmNO9X2dxSiu151Dos900kx2Y8dM3q/S7A==",
|
15
|
+
"EE_ID": "0xai_A9gulGoLPxo7hOo05GIeSvfld_IF_CucTnP00CznjmJN",
|
16
|
+
"SESSION_ID": "SolisClient_bf2d",
|
17
|
+
"INITIATOR_ID": "SolisClient_bf2d",
|
18
|
+
"EE_SENDER": "0xai_Ag28FO6Yg254w-RHsBtODc_WLq7jz4SwfUAW7S7zP0U1",
|
19
|
+
"TIME": "2025-01-07 00:37:16.291005",
|
20
|
+
"EE_SIGN": "MEQCIH9T4_zB4v8cgjhUAwOvELrthGCUZ4v87LR-5DnFetkuAiAm2nOoZIitma10skQbuf12Yp9l_M7zyAcG9mWScuPZGw==",
|
21
|
+
"EE_HASH": "7d7d49f39d1f870af74bece27262d9b050b5358a15c71b249150d04a712ce72c"
|
22
|
+
}
|
23
|
+
|
24
|
+
|
25
|
+
eng1 = DefaultBlockEngine(
|
26
|
+
log=l, name="test1",
|
27
|
+
config={
|
28
|
+
"PEM_FILE" : "stg-0.pem",
|
29
|
+
"PASSWORD" : None,
|
30
|
+
"PEM_LOCATION" : "data"
|
31
|
+
}
|
32
|
+
)
|
33
|
+
|
34
|
+
|
35
|
+
ver = eng1.verify(data)
|
36
|
+
|
37
|
+
eng1.P(f"Signature: {'OK' if ver.valid else 'ERROR'}, {ver}", color='g' if ver.valid else 'r')
|
38
|
+
|
39
|
+
decr = eng1.decrypt(
|
40
|
+
encrypted_data_b64=data["EE_ENCRYPTED_DATA"],
|
41
|
+
sender_address=data["EE_SENDER"],
|
42
|
+
debug=True,
|
43
|
+
)
|
44
|
+
eng1.P(f"Decrypted: {decr}")
|
@@ -1,76 +0,0 @@
|
|
1
|
-
from naeural_client.utils.config import log_with_color
|
2
|
-
|
3
|
-
|
4
|
-
def get_nodes(args):
|
5
|
-
"""
|
6
|
-
This function is used to get the information about the nodes and it will perform the following:
|
7
|
-
|
8
|
-
1. Create a Session object.
|
9
|
-
2. Wait for the first net mon message via Session and show progress.
|
10
|
-
3. Wait for the second net mon message via Session and show progress.
|
11
|
-
4. Get the active nodes union via Session and display the nodes marking those peered vs non-peered.
|
12
|
-
"""
|
13
|
-
supervisor_addr = args.supervisor
|
14
|
-
if args.verbose:
|
15
|
-
log_with_color(f"Getting nodes from supervisor <{supervisor_addr}>...", color='b')
|
16
|
-
from naeural_client import Session
|
17
|
-
sess = Session(silent=not args.verbose)
|
18
|
-
online_only = args.online or args.peered
|
19
|
-
allowed_only = args.peered
|
20
|
-
|
21
|
-
dct_info = sess.get_network_known_nodes(
|
22
|
-
online_only=online_only, allowed_only=allowed_only, supervisor=supervisor_addr
|
23
|
-
)
|
24
|
-
df = dct_info['report']
|
25
|
-
supervisor = dct_info['reporter']
|
26
|
-
super_alias = dct_info['reporter_alias']
|
27
|
-
nr_supers = dct_info['nr_super']
|
28
|
-
elapsed = dct_info['elapsed']
|
29
|
-
prefix = "Online n" if online_only else "N"
|
30
|
-
log_with_color(f"{prefix}odes reported by <{supervisor}> '{super_alias}' in {elapsed:.1f}s ({nr_supers} supervisors seen):", color='b')
|
31
|
-
log_with_color(f"{df}")
|
32
|
-
return
|
33
|
-
|
34
|
-
|
35
|
-
def get_supervisors(args):
|
36
|
-
"""
|
37
|
-
This function is used to get the information about the supervisors.
|
38
|
-
"""
|
39
|
-
if args.verbose:
|
40
|
-
log_with_color("Getting supervisors...", color='b')
|
41
|
-
from naeural_client import Session
|
42
|
-
sess = Session(silent=not args.verbose)
|
43
|
-
dct_info = sess.get_network_known_nodes(online_only=True, supervisors_only=True)
|
44
|
-
df = dct_info['report']
|
45
|
-
supervisor = dct_info['reporter']
|
46
|
-
super_alias = dct_info['reporter_alias']
|
47
|
-
elapsed = dct_info['elapsed']
|
48
|
-
log_with_color(f"Supervisors reported by <{supervisor}> '{super_alias}' in {elapsed:.1f}s", color='b')
|
49
|
-
log_with_color(f"{df}")
|
50
|
-
return
|
51
|
-
|
52
|
-
|
53
|
-
def restart_node(args):
|
54
|
-
"""
|
55
|
-
This function is used to restart the node.
|
56
|
-
|
57
|
-
Parameters
|
58
|
-
----------
|
59
|
-
args : argparse.Namespace
|
60
|
-
Arguments passed to the function.
|
61
|
-
"""
|
62
|
-
log_with_color(f"Restarting node {args.node} NOT IMPLEMENTED", color='r')
|
63
|
-
return
|
64
|
-
|
65
|
-
|
66
|
-
def shutdown_node(args):
|
67
|
-
"""
|
68
|
-
This function is used to shutdown the node.
|
69
|
-
|
70
|
-
Parameters
|
71
|
-
----------
|
72
|
-
args : argparse.Namespace
|
73
|
-
Arguments passed to the function.
|
74
|
-
"""
|
75
|
-
log_with_color(f"Shutting down node {args.node} NOT IMPLEMENTED", color='r')
|
76
|
-
return
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/default/instance/net_mon_01_plugin.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/default/session/mqtt_session.py
RENAMED
File without changes
|
File without changes
|
{naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/io_formatter/base/__init__.py
RENAMED
File without changes
|
{naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/io_formatter/base/base_formatter.py
RENAMED
File without changes
|
{naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/io_formatter/default/__init__.py
RENAMED
File without changes
|
{naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/io_formatter/default/a_dummy.py
RENAMED
File without changes
|
{naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/io_formatter/default/aixp1.py
RENAMED
File without changes
|
{naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/io_formatter/default/default.py
RENAMED
File without changes
|
{naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/io_formatter/io_formatter_manager.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/logger_mixins/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/logger_mixins/timers_mixin.py
RENAMED
File without changes
|
{naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/logger_mixins/upload_mixin.py
RENAMED
File without changes
|
{naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/logger_mixins/utils_mixin.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{naeural_client-2.5.22 → naeural_client-2.5.24}/naeural_client/logging/tzlocal/windows_tz.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/8. custom_code_fastapi_assets/index.html
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{naeural_client-2.5.22 → naeural_client-2.5.24}/tutorials/video_presentation/1. hello_world.ipynb
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/_tutorials/4. real_time_custom_code_2.py
RENAMED
File without changes
|
File without changes
|
{naeural_client-2.5.22 → naeural_client-2.5.24}/xperimental/decentralized/chain_dist_example.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|