ratio1 3.4.35__py3-none-any.whl → 3.4.37__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.
- ratio1/_ver.py +1 -1
- ratio1/base/generic_session.py +264 -57
- ratio1/bc/evm.py +17 -1
- ratio1/cli/cli_commands.py +20 -6
- ratio1/cli/nodes.py +145 -4
- ratio1/cli/oracles.py +35 -14
- ratio1/const/apps.py +1 -0
- ratio1/const/plugins/deeploy_const.py +14 -0
- {ratio1-3.4.35.dist-info → ratio1-3.4.37.dist-info}/METADATA +1 -1
- {ratio1-3.4.35.dist-info → ratio1-3.4.37.dist-info}/RECORD +13 -13
- {ratio1-3.4.35.dist-info → ratio1-3.4.37.dist-info}/WHEEL +0 -0
- {ratio1-3.4.35.dist-info → ratio1-3.4.37.dist-info}/entry_points.txt +0 -0
- {ratio1-3.4.35.dist-info → ratio1-3.4.37.dist-info}/licenses/LICENSE +0 -0
ratio1/_ver.py
CHANGED
ratio1/base/generic_session.py
CHANGED
|
@@ -27,7 +27,6 @@ from ..const import (
|
|
|
27
27
|
BLOCKCHAIN_CONFIG, SESSION_CT, NET_CONFIG
|
|
28
28
|
)
|
|
29
29
|
from ..const import comms as comm_ct
|
|
30
|
-
from ..const.evm_net import EVM_NET_DATA, EvmNetData
|
|
31
30
|
from ..const import DEEPLOY_CT
|
|
32
31
|
from ..io_formatter import IOFormatterWrapper
|
|
33
32
|
from ..logging import Logger
|
|
@@ -1548,7 +1547,7 @@ class GenericSession(BaseDecentrAIObject):
|
|
|
1548
1547
|
If no oracles are found for the wallet on the current network
|
|
1549
1548
|
"""
|
|
1550
1549
|
current_network = block_engine.current_evm_network
|
|
1551
|
-
api_base_url =
|
|
1550
|
+
api_base_url = block_engine.get_deeploy_url()
|
|
1552
1551
|
|
|
1553
1552
|
wallet_nodes = block_engine.web3_get_wallet_nodes(block_engine.eth_address)
|
|
1554
1553
|
oracles_on_the_network = block_engine.web3_get_oracles(current_network)
|
|
@@ -1750,6 +1749,13 @@ class GenericSession(BaseDecentrAIObject):
|
|
|
1750
1749
|
dct_aliases = {v: k for k, v in self.__dct_node_address_to_alias.items()}
|
|
1751
1750
|
return dct_aliases
|
|
1752
1751
|
|
|
1752
|
+
def get_node_address(self, node):
|
|
1753
|
+
"""
|
|
1754
|
+
A public wrapper for __get_node_address.
|
|
1755
|
+
"""
|
|
1756
|
+
return self.__get_node_address(node)
|
|
1757
|
+
|
|
1758
|
+
|
|
1753
1759
|
def __get_node_address(self, node):
|
|
1754
1760
|
"""
|
|
1755
1761
|
Get the address of a node. If node is an address, return it. Else, return the address of the node.
|
|
@@ -2317,6 +2323,19 @@ class GenericSession(BaseDecentrAIObject):
|
|
|
2317
2323
|
|
|
2318
2324
|
return active_supervisors
|
|
2319
2325
|
|
|
2326
|
+
def get_last_hb(self):
|
|
2327
|
+
"""
|
|
2328
|
+
Get the last heartbeat of all nodes.
|
|
2329
|
+
|
|
2330
|
+
Returns
|
|
2331
|
+
-------
|
|
2332
|
+
dict
|
|
2333
|
+
A dictionary with the last heartbeat of all nodes.
|
|
2334
|
+
Where the key is the node address and the value is the last heartbeat.
|
|
2335
|
+
"""
|
|
2336
|
+
return self._dct_online_nodes_last_heartbeat
|
|
2337
|
+
|
|
2338
|
+
|
|
2320
2339
|
def attach_to_pipeline(self, *,
|
|
2321
2340
|
node,
|
|
2322
2341
|
name,
|
|
@@ -3307,21 +3326,6 @@ class GenericSession(BaseDecentrAIObject):
|
|
|
3307
3326
|
if target_nodes_count == 0 and len(target_nodes) == 0:
|
|
3308
3327
|
raise ValueError("You must specify at least one target node to deploy the container app.")
|
|
3309
3328
|
|
|
3310
|
-
# Check if PK exists
|
|
3311
|
-
if not os.path.isfile(signer_private_key_path):
|
|
3312
|
-
raise ValueError("Private key path is not valid.")
|
|
3313
|
-
|
|
3314
|
-
# Create a block engine instance with the private key
|
|
3315
|
-
block_engine = DefaultBlockEngine(
|
|
3316
|
-
log=logger,
|
|
3317
|
-
name="deeploy_launch_container_app",
|
|
3318
|
-
config={
|
|
3319
|
-
BCct.K_PEM_FILE: signer_private_key_path,
|
|
3320
|
-
BCct.K_PASSWORD: signer_private_key_password,
|
|
3321
|
-
}
|
|
3322
|
-
)
|
|
3323
|
-
|
|
3324
|
-
current_network, api_base_url = self.__validate_deeploy_network_and_get_api_url(block_engine)
|
|
3325
3329
|
#####################################################
|
|
3326
3330
|
|
|
3327
3331
|
assert callable(message_handler), "The `message_handler` method parameter must be provided."
|
|
@@ -3354,43 +3358,126 @@ class GenericSession(BaseDecentrAIObject):
|
|
|
3354
3358
|
|
|
3355
3359
|
|
|
3356
3360
|
#####################################################
|
|
3357
|
-
|
|
3358
|
-
DEEPLOY_CT.DEEPLOY_KEYS.
|
|
3359
|
-
DEEPLOY_CT.DEEPLOY_KEYS.
|
|
3360
|
-
DEEPLOY_CT.DEEPLOY_KEYS.
|
|
3361
|
-
DEEPLOY_CT.DEEPLOY_KEYS.
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
'TELEGRAM_BOT_TOKEN': telegram_bot_token,
|
|
3366
|
-
'TELEGRAM_BOT_NAME': telegram_bot_name,
|
|
3367
|
-
'MESSAGE_HANDLER': func_base64_code,
|
|
3368
|
-
'MESSAGE_HANDLER_ARGS': func_args, # mandatory message and user
|
|
3369
|
-
'MESSAGE_HANDLER_NAME': func_name, # not mandatory
|
|
3370
|
-
'PROCESSING_HANDLER': proc_func_base64_code, # not mandatory
|
|
3371
|
-
'PROCESSING_HANDLER_ARGS': proc_func_args, # not mandatory
|
|
3361
|
+
app_params = {
|
|
3362
|
+
DEEPLOY_CT.DEEPLOY_KEYS.APP_PARAMS_TELEGRAM_BOT_TOKEN: telegram_bot_token,
|
|
3363
|
+
DEEPLOY_CT.DEEPLOY_KEYS.APP_PARAMS_TELEGRAM_BOT_NAME: telegram_bot_name,
|
|
3364
|
+
DEEPLOY_CT.DEEPLOY_KEYS.APP_PARAMS_MESSAGE_HANDLER: func_base64_code,
|
|
3365
|
+
DEEPLOY_CT.DEEPLOY_KEYS.APP_PARAMS_MESSAGE_HANDLER_ARGS: func_args, # mandatory message and user
|
|
3366
|
+
DEEPLOY_CT.DEEPLOY_KEYS.APP_PARAMS_MESSAGE_HANDLER_NAME: func_name, # not mandatory
|
|
3367
|
+
DEEPLOY_CT.DEEPLOY_KEYS.APP_PARAMS_PROCESSING_HANDLER: proc_func_base64_code, # not mandatory
|
|
3368
|
+
DEEPLOY_CT.DEEPLOY_KEYS.APP_PARAMS_PROCESSING_HANDLER_ARGS: proc_func_args, # not mandatory
|
|
3372
3369
|
}
|
|
3373
3370
|
|
|
3371
|
+
api_base_url, request_body = self.__generate_deeploy_request(
|
|
3372
|
+
logger=logger,
|
|
3373
|
+
signer_private_key_path=signer_private_key_path,
|
|
3374
|
+
signer_private_key_password=signer_private_key_password,
|
|
3375
|
+
app_alias=name,
|
|
3376
|
+
signature=signature,
|
|
3377
|
+
target_nodes=target_nodes,
|
|
3378
|
+
target_nodes_count=target_nodes_count,
|
|
3379
|
+
app_params=app_params
|
|
3380
|
+
)
|
|
3381
|
+
|
|
3382
|
+
|
|
3374
3383
|
try:
|
|
3375
|
-
#
|
|
3376
|
-
|
|
3377
|
-
|
|
3384
|
+
# Send request
|
|
3385
|
+
response = requests.post(f"{api_base_url}/{DEEPLOY_CT.DEEPLOY_REQUEST_PATHS.CREATE_PIPELINE}", json=request_body)
|
|
3386
|
+
return response.json()
|
|
3387
|
+
except Exception as e:
|
|
3388
|
+
logger.P(f"Error during deeploy_simple_telegram_bot: {e}", color='r', show=True)
|
|
3389
|
+
raise e
|
|
3378
3390
|
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3391
|
+
def deeploy_custom_code(self,
|
|
3392
|
+
signer_private_key_path: str,
|
|
3393
|
+
logger,
|
|
3394
|
+
custom_code=None,
|
|
3395
|
+
target_nodes=[],
|
|
3396
|
+
target_nodes_count=0,
|
|
3397
|
+
signer_private_key_password='',
|
|
3398
|
+
name="deeploy_custom_code",
|
|
3399
|
+
signature=PLUGIN_SIGNATURES.CUSTOM_EXEC_01,
|
|
3400
|
+
config={},
|
|
3401
|
+
):
|
|
3402
|
+
"""
|
|
3403
|
+
Deploy custom Python code on the Ratio1 Edge Protocol network using the Deeploy API.
|
|
3404
|
+
Parameters
|
|
3405
|
+
----------
|
|
3406
|
+
signer_private_key_path : str
|
|
3407
|
+
Path to the PEM file containing the private key used for signing the deployment request
|
|
3408
|
+
|
|
3409
|
+
logger : Logger
|
|
3410
|
+
Logger instance for recording deployment activities and errors
|
|
3411
|
+
|
|
3412
|
+
custom_code : callable
|
|
3413
|
+
Python function to deploy. Must be a callable function that will be serialized and deployed to edge nodes.
|
|
3414
|
+
The function will be validated for syntax errors before deployment.
|
|
3415
|
+
|
|
3416
|
+
target_nodes : list, optional
|
|
3417
|
+
List of specific node addresses to deploy the custom code to.
|
|
3418
|
+
If empty, uses target_nodes_count instead. Defaults to []
|
|
3419
|
+
|
|
3420
|
+
target_nodes_count : int, optional
|
|
3421
|
+
Number of nodes to deploy to when target_nodes is not specified. Defaults to 0
|
|
3422
|
+
|
|
3423
|
+
signer_private_key_password : str, optional
|
|
3424
|
+
Password for the private key file if it's encrypted. Defaults to ''
|
|
3425
|
+
|
|
3426
|
+
name : str, optional
|
|
3427
|
+
Application alias/name for identification. Defaults to "deeploy_custom_code"
|
|
3428
|
+
|
|
3429
|
+
signature : str, optional
|
|
3430
|
+
The signature of the plugin that will be used. Defaults to PLUGIN_SIGNATURES.CUSTOM_EXEC_01
|
|
3431
|
+
|
|
3432
|
+
config : dict, optional
|
|
3433
|
+
Additional configuration parameters to pass to the deployed custom code.
|
|
3434
|
+
These parameters will be available to the custom code at runtime. Defaults to {}
|
|
3435
|
+
|
|
3436
|
+
Returns
|
|
3437
|
+
-------
|
|
3438
|
+
dict
|
|
3439
|
+
JSON response from the Deeploy API containing deployment status and details
|
|
3386
3440
|
|
|
3441
|
+
"""
|
|
3442
|
+
if target_nodes_count == 0 and len(target_nodes) == 0:
|
|
3443
|
+
raise ValueError("You must specify at least one target node to deploy the container app.")
|
|
3444
|
+
|
|
3445
|
+
#####################################################
|
|
3446
|
+
|
|
3447
|
+
assert callable(custom_code), "The `custom_code` method parameter must be provided."
|
|
3448
|
+
|
|
3449
|
+
base_code_checker_inst = BaseCodeChecker()
|
|
3450
|
+
|
|
3451
|
+
plain_code = base_code_checker_inst.get_function_source_code(custom_code)
|
|
3452
|
+
custom_code_base64, error_messages = base_code_checker_inst.code_to_base64(plain_code, return_errors=True)
|
|
3453
|
+
if error_messages:
|
|
3454
|
+
raise ValueError(f"Custom code has errors: {error_messages}")
|
|
3455
|
+
#####################################################
|
|
3456
|
+
app_params = {
|
|
3457
|
+
DEEPLOY_CT.DEEPLOY_KEYS.APP_PARAMS_CODE: custom_code_base64,
|
|
3458
|
+
**config
|
|
3459
|
+
}
|
|
3460
|
+
|
|
3461
|
+
api_base_url, request_body = self.__generate_deeploy_request(
|
|
3462
|
+
logger=logger,
|
|
3463
|
+
signer_private_key_path=signer_private_key_path,
|
|
3464
|
+
signer_private_key_password=signer_private_key_password,
|
|
3465
|
+
app_alias=name,
|
|
3466
|
+
signature=signature,
|
|
3467
|
+
target_nodes=target_nodes,
|
|
3468
|
+
target_nodes_count=target_nodes_count,
|
|
3469
|
+
app_params=app_params
|
|
3470
|
+
)
|
|
3471
|
+
|
|
3472
|
+
try:
|
|
3387
3473
|
# Send request
|
|
3388
|
-
response = requests.post(f"{api_base_url}/{DEEPLOY_CT.DEEPLOY_REQUEST_PATHS.CREATE_PIPELINE}", json=
|
|
3474
|
+
response = requests.post(f"{api_base_url}/{DEEPLOY_CT.DEEPLOY_REQUEST_PATHS.CREATE_PIPELINE}", json=request_body)
|
|
3389
3475
|
return response.json()
|
|
3390
3476
|
except Exception as e:
|
|
3391
|
-
logger.P(f"Error during
|
|
3477
|
+
logger.P(f"Error during deeploy_custom_code: {e}", color='r', show=True)
|
|
3392
3478
|
raise e
|
|
3393
3479
|
|
|
3480
|
+
|
|
3394
3481
|
def deeploy_close(self, logger,
|
|
3395
3482
|
signer_private_key_path: str,
|
|
3396
3483
|
app_id: str,
|
|
@@ -3471,37 +3558,157 @@ class GenericSession(BaseDecentrAIObject):
|
|
|
3471
3558
|
--------
|
|
3472
3559
|
deeploy_launch_container_app : Deploy a new containerized application
|
|
3473
3560
|
"""
|
|
3561
|
+
|
|
3562
|
+
|
|
3563
|
+
api_base_url, request_body = self.__generate_deeploy_request(
|
|
3564
|
+
logger=logger,
|
|
3565
|
+
signer_private_key_path=signer_private_key_path,
|
|
3566
|
+
signer_private_key_password=signer_private_key_password,
|
|
3567
|
+
request_params={
|
|
3568
|
+
DEEPLOY_CT.DEEPLOY_KEYS.APP_ID: app_id,
|
|
3569
|
+
DEEPLOY_CT.DEEPLOY_KEYS.TARGET_NODES: target_nodes,
|
|
3570
|
+
}
|
|
3571
|
+
)
|
|
3572
|
+
|
|
3573
|
+
endpoint = DEEPLOY_CT.DEEPLOY_REQUEST_PATHS.DELETE_PIPELINE
|
|
3574
|
+
response = requests.post(f"{api_base_url}/{endpoint}", json=request_body)
|
|
3575
|
+
return response.json()
|
|
3576
|
+
|
|
3577
|
+
def __generate_deeploy_request(self,
|
|
3578
|
+
logger,
|
|
3579
|
+
signer_private_key_path,
|
|
3580
|
+
signer_private_key_password,
|
|
3581
|
+
app_alias=None,
|
|
3582
|
+
signature=None,
|
|
3583
|
+
target_nodes=None,
|
|
3584
|
+
target_nodes_count=0,
|
|
3585
|
+
app_params={},
|
|
3586
|
+
request_params={}):
|
|
3587
|
+
"""
|
|
3588
|
+
Generate a signed Deeploy API request for deploying applications to edge nodes.
|
|
3589
|
+
|
|
3590
|
+
This method creates a properly formatted and cryptographically signed request
|
|
3591
|
+
that can be sent to the Deeploy API for deploying various types of applications
|
|
3592
|
+
(containers, custom code, Telegram bots, etc.) to the Ratio1 Edge Protocol network.
|
|
3593
|
+
|
|
3594
|
+
Parameters
|
|
3595
|
+
----------
|
|
3596
|
+
logger : Logger
|
|
3597
|
+
Logger instance for recording request generation activities and errors
|
|
3598
|
+
|
|
3599
|
+
signer_private_key_path : str
|
|
3600
|
+
Path to the PEM file containing the private key used for signing the request
|
|
3601
|
+
|
|
3602
|
+
signer_private_key_password : str
|
|
3603
|
+
Password for the private key file if it's encrypted
|
|
3604
|
+
|
|
3605
|
+
app_alias : str, optional
|
|
3606
|
+
Application alias/name for identification in the Deeploy system.
|
|
3607
|
+
Required for creation requests, not needed for deletion or query operations.
|
|
3608
|
+
Defaults to None
|
|
3609
|
+
|
|
3610
|
+
signature : str, optional
|
|
3611
|
+
The plugin signature that identifies the type of application to deploy
|
|
3612
|
+
(e.g., CONTAINER_APP_RUNNER, TELEGRAM_BASIC_BOT_01, CUSTOM_EXEC_01).
|
|
3613
|
+
Required for creation requests, not needed for deletion or query operations.
|
|
3614
|
+
Defaults to None
|
|
3615
|
+
|
|
3616
|
+
target_nodes : list, optional
|
|
3617
|
+
List of specific node addresses to deploy the application to.
|
|
3618
|
+
If empty, uses target_nodes_count instead.
|
|
3619
|
+
Required for creation requests, optional for other operations.
|
|
3620
|
+
Defaults to None
|
|
3621
|
+
|
|
3622
|
+
target_nodes_count : int, optional
|
|
3623
|
+
Number of nodes to deploy to when target_nodes is not specified.
|
|
3624
|
+
Used when you want Deeploy to automatically select nodes.
|
|
3625
|
+
Defaults to 0
|
|
3626
|
+
|
|
3627
|
+
app_params : dict, optional
|
|
3628
|
+
Application-specific parameters that will be passed to the deployed application.
|
|
3629
|
+
These parameters vary depending on the application type and signature.
|
|
3630
|
+
Defaults to {}
|
|
3631
|
+
|
|
3632
|
+
request_params : dict, optional
|
|
3633
|
+
Additional parameters to include in the request payload.
|
|
3634
|
+
These are typically metadata or configuration options for the deployment process.
|
|
3635
|
+
Defaults to {}
|
|
3636
|
+
|
|
3637
|
+
Returns
|
|
3638
|
+
-------
|
|
3639
|
+
tuple
|
|
3640
|
+
A tuple containing (api_base_url, request_body) where:
|
|
3641
|
+
- api_base_url (str): The base URL for the Deeploy API endpoint
|
|
3642
|
+
- request_body (dict): The complete signed request payload ready for HTTP transmission
|
|
3643
|
+
|
|
3644
|
+
Examples
|
|
3645
|
+
--------
|
|
3646
|
+
Generate a request for deploying a container application:
|
|
3647
|
+
|
|
3648
|
+
>>> api_url, request = session.__generate_deeploy_request(
|
|
3649
|
+
... logger=my_logger,
|
|
3650
|
+
... signer_private_key_path="/path/to/private_key.pem",
|
|
3651
|
+
... signer_private_key_password="",
|
|
3652
|
+
... app_alias="my_web_app",
|
|
3653
|
+
... signature="CONTAINER_APP_RUNNER",
|
|
3654
|
+
... target_nodes=["node1_address", "node2_address"],
|
|
3655
|
+
... target_nodes_count=0,
|
|
3656
|
+
... app_params={"image": "nginx:latest", "port": 80}
|
|
3657
|
+
... )
|
|
3658
|
+
|
|
3659
|
+
Generate a request for deleting an application (no signature/app_alias needed):
|
|
3660
|
+
|
|
3661
|
+
>>> api_url, request = session.__generate_deeploy_request(
|
|
3662
|
+
... logger=my_logger,
|
|
3663
|
+
... signer_private_key_path="/path/to/private_key.pem",
|
|
3664
|
+
... signer_private_key_password="",
|
|
3665
|
+
... request_params={"app_id": "my_app_12345", "target_nodes": ["node1_address"]}
|
|
3666
|
+
... )
|
|
3667
|
+
"""
|
|
3668
|
+
|
|
3669
|
+
request_body = {DEEPLOY_CT.DEEPLOY_KEYS.REQUEST: {
|
|
3670
|
+
DEEPLOY_CT.DEEPLOY_KEYS.TARGET_NODES_COUNT: target_nodes_count,
|
|
3671
|
+
**request_params
|
|
3672
|
+
}}
|
|
3673
|
+
|
|
3674
|
+
# Add creation-specific fields only if provided
|
|
3675
|
+
if app_alias is not None:
|
|
3676
|
+
request_body[DEEPLOY_CT.DEEPLOY_KEYS.REQUEST][DEEPLOY_CT.DEEPLOY_KEYS.APP_ALIAS] = app_alias
|
|
3677
|
+
if signature is not None:
|
|
3678
|
+
request_body[DEEPLOY_CT.DEEPLOY_KEYS.REQUEST][DEEPLOY_CT.DEEPLOY_KEYS.PLUGIN_SIGNATURE] = signature
|
|
3679
|
+
if target_nodes is not None:
|
|
3680
|
+
request_body[DEEPLOY_CT.DEEPLOY_KEYS.REQUEST][DEEPLOY_CT.DEEPLOY_KEYS.TARGET_NODES] = target_nodes
|
|
3681
|
+
if app_params:
|
|
3682
|
+
request_body[DEEPLOY_CT.DEEPLOY_KEYS.REQUEST][DEEPLOY_CT.DEEPLOY_KEYS.APP_PARAMS] = app_params
|
|
3683
|
+
|
|
3684
|
+
# Check if PK exists
|
|
3685
|
+
if not os.path.isfile(signer_private_key_path):
|
|
3686
|
+
raise ValueError("Private key path is not valid.")
|
|
3687
|
+
|
|
3474
3688
|
# Create a block engine instance with the private key
|
|
3475
3689
|
block_engine = DefaultBlockEngine(
|
|
3476
3690
|
log=logger,
|
|
3477
|
-
name="
|
|
3691
|
+
name="deeploy_request_block_engine",
|
|
3478
3692
|
config={
|
|
3479
3693
|
BCct.K_PEM_FILE: signer_private_key_path,
|
|
3480
3694
|
BCct.K_PASSWORD: signer_private_key_password,
|
|
3481
3695
|
}
|
|
3482
3696
|
)
|
|
3483
3697
|
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
endpoint = DEEPLOY_CT.DEEPLOY_REQUEST_PATHS.DELETE_PIPELINE
|
|
3487
|
-
request_data = {DEEPLOY_CT.DEEPLOY_KEYS.REQUEST: {}}
|
|
3488
|
-
request_data[DEEPLOY_CT.DEEPLOY_KEYS.REQUEST][DEEPLOY_CT.DEEPLOY_KEYS.APP_ID] = app_id
|
|
3489
|
-
request_data[DEEPLOY_CT.DEEPLOY_KEYS.REQUEST][DEEPLOY_CT.DEEPLOY_KEYS.TARGET_NODES] = target_nodes
|
|
3490
|
-
|
|
3698
|
+
# Set the nonce for the request
|
|
3491
3699
|
nonce = f"0x{int(time.time() * 1000):x}"
|
|
3492
|
-
|
|
3700
|
+
request_body[DEEPLOY_CT.DEEPLOY_KEYS.REQUEST][DEEPLOY_CT.DEEPLOY_KEYS.NONCE] = nonce
|
|
3493
3701
|
|
|
3494
3702
|
# Sign the payload using eth_sign_payload
|
|
3495
3703
|
block_engine.eth_sign_payload(
|
|
3496
|
-
payload=
|
|
3704
|
+
payload=request_body[DEEPLOY_CT.DEEPLOY_KEYS.REQUEST],
|
|
3497
3705
|
indent=1,
|
|
3498
3706
|
no_hash=True,
|
|
3499
3707
|
message_prefix="Please sign this message for Deeploy: "
|
|
3500
3708
|
)
|
|
3501
3709
|
|
|
3502
|
-
|
|
3503
|
-
return
|
|
3504
|
-
|
|
3710
|
+
_, api_base_url = self.__validate_deeploy_network_and_get_api_url(block_engine)
|
|
3711
|
+
return api_base_url, request_body
|
|
3505
3712
|
|
|
3506
3713
|
def __is_assets_valid(self, assets, mandatory=True, raise_exception=True, default_field_values=None):
|
|
3507
3714
|
if assets is None:
|
ratio1/bc/evm.py
CHANGED
|
@@ -11,6 +11,7 @@ from eth_utils import keccak, to_checksum_address
|
|
|
11
11
|
from eth_account.messages import encode_defunct
|
|
12
12
|
|
|
13
13
|
from ..const.base import EE_VPN_IMPL_ENV_KEY, dAuth, BCctbase, ETHVarTypes, EVM_ABI_DATA
|
|
14
|
+
from ..const.evm_net import EVM_NET_DATA, EvmNetData
|
|
14
15
|
|
|
15
16
|
EE_VPN_IMPL = str(os.environ.get(EE_VPN_IMPL_ENV_KEY, False)).lower() in [
|
|
16
17
|
'true', '1', 'yes', 'y', 't', 'on'
|
|
@@ -1291,4 +1292,19 @@ class _EVMMixin:
|
|
|
1291
1292
|
"r1Balance": float(r1_balance),
|
|
1292
1293
|
}
|
|
1293
1294
|
|
|
1294
|
-
return balances
|
|
1295
|
+
return balances
|
|
1296
|
+
|
|
1297
|
+
|
|
1298
|
+
def get_deeploy_url(self):
|
|
1299
|
+
"""
|
|
1300
|
+
Returns the deeploy URL from the environment or the network data
|
|
1301
|
+
|
|
1302
|
+
Returns
|
|
1303
|
+
-------
|
|
1304
|
+
str
|
|
1305
|
+
the deeploy URL.
|
|
1306
|
+
|
|
1307
|
+
"""
|
|
1308
|
+
current_network = self.current_evm_network
|
|
1309
|
+
deeploy_api_base_url = EVM_NET_DATA[current_network][EvmNetData.EE_DEEPLOY_API_URL_KEY]
|
|
1310
|
+
return deeploy_api_base_url
|
ratio1/cli/cli_commands.py
CHANGED
|
@@ -10,9 +10,9 @@ and it is used by cli.py
|
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
12
|
from ratio1.cli.nodes import (
|
|
13
|
-
get_nodes, get_supervisors,
|
|
13
|
+
get_nodes, get_supervisors,
|
|
14
14
|
restart_node, shutdown_node,
|
|
15
|
-
get_apps
|
|
15
|
+
get_apps, inspect_node
|
|
16
16
|
)
|
|
17
17
|
from ratio1.cli.oracles import get_availability, oracle_rollout
|
|
18
18
|
from ratio1.utils.config import (
|
|
@@ -42,6 +42,10 @@ CLI_COMMANDS = {
|
|
|
42
42
|
"supervisors": {
|
|
43
43
|
"func": get_supervisors, # DONE
|
|
44
44
|
"description": "Get the list of available supervisor oracles",
|
|
45
|
+
"params": {
|
|
46
|
+
"--eth" : "Use a specific node (flag)",
|
|
47
|
+
"--wide" : "Display all available information (flag)",
|
|
48
|
+
}
|
|
45
49
|
},
|
|
46
50
|
"eth" : {
|
|
47
51
|
"func": get_eth_addr,
|
|
@@ -118,14 +122,16 @@ CLI_COMMANDS = {
|
|
|
118
122
|
"func": restart_node,
|
|
119
123
|
"description": "Restart a node",
|
|
120
124
|
"params": {
|
|
121
|
-
"node": "The node to restart"
|
|
125
|
+
"node": "The node to restart",
|
|
126
|
+
"--ignore-peering": "Ignore peering when running the command (flag)",
|
|
122
127
|
}
|
|
123
128
|
},
|
|
124
129
|
"shutdown": {
|
|
125
130
|
"func": shutdown_node,
|
|
126
131
|
"description": "Shutdown a node",
|
|
127
132
|
"params": {
|
|
128
|
-
"node": "The node to shutdown"
|
|
133
|
+
"node": "The node to shutdown",
|
|
134
|
+
"--ignore-peering": "Ignore peering when running the command (flag)",
|
|
129
135
|
}
|
|
130
136
|
},
|
|
131
137
|
"update": {
|
|
@@ -137,6 +143,14 @@ CLI_COMMANDS = {
|
|
|
137
143
|
},
|
|
138
144
|
"oracle-rollout": {
|
|
139
145
|
"func": oracle_rollout,
|
|
140
|
-
"description": "Rollout update on all nodes in the network. The rollout order is seed nodes -> oracle nodes -> all other edge nodes. This command is needed when defining new environment variables in seed nodes, in order to make it available to all nodes in the network."
|
|
141
|
-
}
|
|
146
|
+
"description": "Rollout update on all nodes in the network. The rollout order is seed nodes -> oracle nodes -> all other edge nodes. This command is needed when defining new environment variables in seed nodes, in order to make it available to all nodes in the network."
|
|
147
|
+
},
|
|
148
|
+
"inspect": {
|
|
149
|
+
"func": inspect_node,
|
|
150
|
+
"description": "Inspect a node by address or alias.",
|
|
151
|
+
"params": {
|
|
152
|
+
"node": "The node address or alias to inspect",
|
|
153
|
+
"--wide": "Display all available information (flag)"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
142
156
|
}
|
ratio1/cli/nodes.py
CHANGED
|
@@ -115,10 +115,15 @@ def get_supervisors(args):
|
|
|
115
115
|
online_only=True,
|
|
116
116
|
supervisors_only=True,
|
|
117
117
|
return_session=True,
|
|
118
|
+
eth=args.eth,
|
|
119
|
+
all_info=args.wide,
|
|
118
120
|
)
|
|
119
121
|
df, supervisor, super_alias, nr_supers, elapsed, sess = res
|
|
120
122
|
FILTERED = ['Oracle', 'State']
|
|
121
123
|
df = df[[c for c in df.columns if c not in FILTERED]]
|
|
124
|
+
|
|
125
|
+
import pandas as pd
|
|
126
|
+
pd.set_option('display.float_format', '{:.4f}'.format)
|
|
122
127
|
|
|
123
128
|
if supervisor == "ERROR":
|
|
124
129
|
log_with_color(f"No supervisors or no comms available in {elapsed:.1f}s. Please check your settings.", color='r')
|
|
@@ -206,8 +211,8 @@ def get_apps(args):
|
|
|
206
211
|
def _send_command_to_node(args, command, ignore_not_found=False):
|
|
207
212
|
node = args.node
|
|
208
213
|
silent = not args.verbose
|
|
214
|
+
ignore_peering = args.ignore_peering
|
|
209
215
|
|
|
210
|
-
|
|
211
216
|
t1 = time()
|
|
212
217
|
df, _, _, _, _, sess = _get_netstats(
|
|
213
218
|
silent=silent, online_only=True, return_session=True, all_info=True,
|
|
@@ -228,17 +233,21 @@ def _send_command_to_node(args, command, ignore_not_found=False):
|
|
|
228
233
|
node_addr = df_found.Address.values[0]
|
|
229
234
|
log_with_color(f"{df_found}")
|
|
230
235
|
else:
|
|
231
|
-
log_with_color("Node '{}' <{}> not found in network (
|
|
236
|
+
log_with_color("Node '{}' <{}> not found in network (total {} nodes, {} peered).".format(
|
|
232
237
|
node, node_addr, df.shape[0], df.Peered.sum()), color='r'
|
|
233
238
|
)
|
|
234
239
|
node_addr = node
|
|
235
|
-
|
|
240
|
+
|
|
241
|
+
if not peered and not ignore_peering:
|
|
242
|
+
log_with_color(f"Node '{node}' <{node_addr}> not peered, exiting...", color='r')
|
|
243
|
+
return
|
|
244
|
+
|
|
236
245
|
if not peered:
|
|
237
246
|
if found:
|
|
238
247
|
log_with_color(f"Node '{node}' <{node_addr}> is not peered.", color='r')
|
|
239
248
|
else:
|
|
240
249
|
log_with_color(f"Node '{node}' <{node_addr}> may not accept this command.", color='r')
|
|
241
|
-
|
|
250
|
+
|
|
242
251
|
# TODO: currently this is based on node alias, but we should be based on node address
|
|
243
252
|
# and maybe even node alias
|
|
244
253
|
if (found and peered) or ignore_not_found:
|
|
@@ -266,6 +275,7 @@ def restart_node(args):
|
|
|
266
275
|
Arguments passed to the function.
|
|
267
276
|
"""
|
|
268
277
|
node = args.node
|
|
278
|
+
|
|
269
279
|
log_with_color(f"Attempting to restart node <{node}>", color='b')
|
|
270
280
|
_send_command_to_node(args, COMMANDS.RESTART, ignore_not_found=True)
|
|
271
281
|
return
|
|
@@ -281,7 +291,138 @@ def shutdown_node(args):
|
|
|
281
291
|
Arguments passed to the function.
|
|
282
292
|
"""
|
|
283
293
|
node = args.node
|
|
294
|
+
|
|
284
295
|
log_with_color(f"Attempting to shutdown node <{node}>", color='b')
|
|
285
296
|
_send_command_to_node(args, COMMANDS.STOP, ignore_not_found=True)
|
|
286
297
|
return
|
|
287
298
|
|
|
299
|
+
|
|
300
|
+
def inspect_node(args):
|
|
301
|
+
"""
|
|
302
|
+
This function is used to inspect the node info.
|
|
303
|
+
|
|
304
|
+
Parameters
|
|
305
|
+
----------
|
|
306
|
+
args : argparse.Namespace
|
|
307
|
+
Arguments passed to the function.
|
|
308
|
+
"""
|
|
309
|
+
node = args.node
|
|
310
|
+
wide = args.wide
|
|
311
|
+
silent = not args.verbose
|
|
312
|
+
|
|
313
|
+
if not silent:
|
|
314
|
+
log_with_color(f"Inspecting node <{node}>", color='b')
|
|
315
|
+
|
|
316
|
+
from ratio1 import Session
|
|
317
|
+
session = Session(
|
|
318
|
+
silent=silent
|
|
319
|
+
)
|
|
320
|
+
try:
|
|
321
|
+
node_address = session.get_node_address(node)
|
|
322
|
+
last_hb = session.get_last_hb()
|
|
323
|
+
node_last_hb = last_hb.get(node_address)
|
|
324
|
+
|
|
325
|
+
if not node_last_hb:
|
|
326
|
+
# No last HB was found for specified Address, ETH Address or alias.
|
|
327
|
+
raise ValueError("Could not find a node by provided address/alias.")
|
|
328
|
+
|
|
329
|
+
# Display node stats from HB:
|
|
330
|
+
_display_node_stats_for_hb(node_last_hb, wide)
|
|
331
|
+
|
|
332
|
+
except Exception as e:
|
|
333
|
+
log_with_color(f"An error occurred while trying to get node info: {e}", color='r')
|
|
334
|
+
finally:
|
|
335
|
+
session.close()
|
|
336
|
+
return
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
def _display_node_stats_for_hb(node_hb, wide=False):
|
|
340
|
+
"""
|
|
341
|
+
Display main system information from node heartbeat data.
|
|
342
|
+
|
|
343
|
+
Parameters
|
|
344
|
+
----------
|
|
345
|
+
node_hb : dict
|
|
346
|
+
Node heartbeat data containing system information
|
|
347
|
+
wide: bool
|
|
348
|
+
If True, display all plugins.
|
|
349
|
+
"""
|
|
350
|
+
from ratio1 import HEARTBEAT_DATA
|
|
351
|
+
from ratio1.utils.config import log_with_color
|
|
352
|
+
from ratio1.const.base import BCctbase
|
|
353
|
+
from ratio1 import PAYLOAD_DATA
|
|
354
|
+
|
|
355
|
+
# Extract basic node info
|
|
356
|
+
ee_id = node_hb.get(HEARTBEAT_DATA.EE_ID, 'Unknown')
|
|
357
|
+
node_addr = node_hb.get(HEARTBEAT_DATA.EE_ADDR, 'Unknown')
|
|
358
|
+
eth_addr = node_hb.get(BCctbase.ETH_SENDER, 'Unknown')
|
|
359
|
+
ee_version = node_hb.get(PAYLOAD_DATA.EE_VERSION, 'Unknown')
|
|
360
|
+
uptime = node_hb.get(HEARTBEAT_DATA.UPTIME, 0)
|
|
361
|
+
|
|
362
|
+
# Display node header
|
|
363
|
+
log_with_color(f"\n=== Node Information ===", color='b')
|
|
364
|
+
log_with_color(f"Node alias: {ee_id}", color='g')
|
|
365
|
+
log_with_color(f"Address: {node_addr}", color='g')
|
|
366
|
+
log_with_color(f"ETH Address: {eth_addr}", color='g')
|
|
367
|
+
log_with_color(f"Edge Node Version: {ee_version}", color='g')
|
|
368
|
+
log_with_color(f"Uptime: {uptime:.1f} seconds ({uptime/3600:.1f} hours)", color='g')
|
|
369
|
+
|
|
370
|
+
# CPU Information
|
|
371
|
+
cpu_info = node_hb.get(HEARTBEAT_DATA.CPU, 'Unknown')
|
|
372
|
+
cpu_cores = node_hb.get(HEARTBEAT_DATA.CPU_NR_CORES, 0)
|
|
373
|
+
cpu_used = node_hb.get(HEARTBEAT_DATA.CPU_USED, 0)
|
|
374
|
+
|
|
375
|
+
log_with_color(f"\n=== CPU Information ===", color='b')
|
|
376
|
+
log_with_color(f"Processor: {cpu_info}", color='y')
|
|
377
|
+
log_with_color(f"Cores: {cpu_cores}", color='y')
|
|
378
|
+
log_with_color(f"Usage: {cpu_used:.1f}%", color='y')
|
|
379
|
+
|
|
380
|
+
# Memory Information
|
|
381
|
+
total_memory = node_hb.get(HEARTBEAT_DATA.MACHINE_MEMORY, 0)
|
|
382
|
+
available_memory = node_hb.get(HEARTBEAT_DATA.AVAILABLE_MEMORY, 0)
|
|
383
|
+
process_memory = node_hb.get(HEARTBEAT_DATA.PROCESS_MEMORY, 0)
|
|
384
|
+
is_alert_ram = node_hb.get(HEARTBEAT_DATA.IS_ALERT_RAM, False)
|
|
385
|
+
|
|
386
|
+
used_memory = total_memory - available_memory if total_memory and available_memory else 0
|
|
387
|
+
memory_usage_pct = (used_memory / total_memory * 100) if total_memory > 0 else 0
|
|
388
|
+
|
|
389
|
+
log_with_color(f"\n=== Memory Information ===", color='b')
|
|
390
|
+
log_with_color(f"Total Memory: {total_memory:.2f} GB", color='y')
|
|
391
|
+
log_with_color(f"Available Memory: {available_memory:.2f} GB", color='y')
|
|
392
|
+
log_with_color(f"Used Memory: {used_memory:.2f} GB ({memory_usage_pct:.1f}%)", color='y')
|
|
393
|
+
log_with_color(f"Process Memory: {process_memory:.2f} GB", color='y')
|
|
394
|
+
if is_alert_ram:
|
|
395
|
+
log_with_color(f"RAM Alert: True", color='r')
|
|
396
|
+
|
|
397
|
+
# Disk Information
|
|
398
|
+
total_disk = node_hb.get(HEARTBEAT_DATA.TOTAL_DISK, 0)
|
|
399
|
+
available_disk = node_hb.get(HEARTBEAT_DATA.AVAILABLE_DISK, 0)
|
|
400
|
+
|
|
401
|
+
used_disk = total_disk - available_disk if total_disk and available_disk else 0
|
|
402
|
+
disk_usage_pct = (used_disk / total_disk * 100) if total_disk > 0 else 0
|
|
403
|
+
|
|
404
|
+
log_with_color(f"\n=== Disk Information ===", color='b')
|
|
405
|
+
log_with_color(f"Total Disk: {total_disk:.2f} GB", color='y')
|
|
406
|
+
log_with_color(f"Available Disk: {available_disk:.2f} GB", color='y')
|
|
407
|
+
log_with_color(f"Used Disk: {used_disk:.2f} GB ({disk_usage_pct:.1f}%)", color='y')
|
|
408
|
+
|
|
409
|
+
# Active Plugins
|
|
410
|
+
active_plugins = node_hb.get(HEARTBEAT_DATA.ACTIVE_PLUGINS, [])
|
|
411
|
+
log_with_color(f"\n=== Active Plugins ===", color='b')
|
|
412
|
+
log_with_color(f"Number of Active Plugins: {len(active_plugins)}", color='y')
|
|
413
|
+
|
|
414
|
+
if active_plugins:
|
|
415
|
+
plugins_to_display = 99999 if wide else 5
|
|
416
|
+
for i, plugin in enumerate(active_plugins[:plugins_to_display]): # Show first 5 plugins
|
|
417
|
+
stream_id = plugin.get(HEARTBEAT_DATA.ACTIVE_PLUGINS_INFO.STREAM_ID, 'Unknown')
|
|
418
|
+
signature = plugin.get(HEARTBEAT_DATA.ACTIVE_PLUGINS_INFO.SIGNATURE, 'Unknown')
|
|
419
|
+
instance_id = plugin.get(HEARTBEAT_DATA.ACTIVE_PLUGINS_INFO.INSTANCE_ID, 'Unknown')
|
|
420
|
+
total_payload = plugin.get(HEARTBEAT_DATA.ACTIVE_PLUGINS_INFO.TOTAL_PAYLOAD_COUNT, 0)
|
|
421
|
+
log_with_color(f" {i+1}. {stream_id} {signature} ({instance_id}) - {total_payload} payloads", color='w')
|
|
422
|
+
|
|
423
|
+
if len(active_plugins) > plugins_to_display:
|
|
424
|
+
log_with_color(f" ... and {len(active_plugins) - plugins_to_display} more plugins", color='w')
|
|
425
|
+
|
|
426
|
+
log_with_color(f"\n", color='w') # Add final newline for spacing
|
|
427
|
+
|
|
428
|
+
return
|
ratio1/cli/oracles.py
CHANGED
|
@@ -188,11 +188,12 @@ if True:
|
|
|
188
188
|
return all_online_nodes
|
|
189
189
|
|
|
190
190
|
|
|
191
|
-
def _send_restart_command(nodes, timeout_min=0, timeout_max=0, verbose=True):
|
|
191
|
+
def _send_restart_command(session, nodes, timeout_min=0, timeout_max=0, verbose=True):
|
|
192
192
|
"""
|
|
193
193
|
Send a restart command to the specified nodes.
|
|
194
194
|
|
|
195
195
|
Parameters:
|
|
196
|
+
session (Session): Session object.
|
|
196
197
|
nodes (list): List of node addresses to send the restart command to.
|
|
197
198
|
timeout_min (int): Minimum timeout in seconds for the command to complete.
|
|
198
199
|
timeout_max (int): Maximum timeout in seconds for the command to complete.
|
|
@@ -200,15 +201,16 @@ if True:
|
|
|
200
201
|
"""
|
|
201
202
|
for node in nodes:
|
|
202
203
|
# Create an args object that restart_node expects
|
|
203
|
-
|
|
204
|
-
restart_node(args)
|
|
204
|
+
session._send_command_restart_node(node)
|
|
205
205
|
timeout = randint(timeout_min, timeout_max)
|
|
206
|
-
log_with_color(f"
|
|
206
|
+
log_with_color("".join([f"Restarting {node} | ",
|
|
207
|
+
f"Waiting {timeout} seconds before next restart..."]),
|
|
208
|
+
color='y')
|
|
207
209
|
sleep(timeout)
|
|
208
210
|
return
|
|
209
211
|
|
|
210
212
|
|
|
211
|
-
def oracle_rollout():
|
|
213
|
+
def oracle_rollout(args):
|
|
212
214
|
"""
|
|
213
215
|
This function performs an oracle rollout by restarting seed nodes, oracle nodes, and edge nodes in sequence.
|
|
214
216
|
It first restarts the seed nodes, waits for a specified time, then restarts all oracle nodes except the seed nodes,
|
|
@@ -216,17 +218,25 @@ if True:
|
|
|
216
218
|
|
|
217
219
|
This function is needed in order to ensure that all nodes in the network receive the new configuration defined on the seed nodes.
|
|
218
220
|
"""
|
|
219
|
-
|
|
221
|
+
silent = not args.verbose
|
|
222
|
+
session = Session(
|
|
223
|
+
silent=True
|
|
224
|
+
)
|
|
220
225
|
current_network = session.bc_engine.current_evm_network
|
|
221
226
|
session.close()
|
|
227
|
+
|
|
222
228
|
log_with_color(f"ATTENTION! Current network: {current_network}", color='y')
|
|
223
|
-
log_with_color(f"Are you sure you want to restart
|
|
224
|
-
user_confirmation = input(f"Write down 'RESTART ALL on {current_network}' in order to proceed
|
|
229
|
+
log_with_color(f"Are you sure you want to restart ALL nodes on the network {current_network}?", color='b')
|
|
230
|
+
user_confirmation = input(f"Write down 'RESTART ALL on {current_network}' in order to proceed...\n >")
|
|
225
231
|
|
|
226
232
|
if user_confirmation != f"RESTART ALL on {current_network}":
|
|
227
233
|
log_with_color("Aborted by user...", color='y')
|
|
228
234
|
return
|
|
229
235
|
|
|
236
|
+
session = Session(
|
|
237
|
+
silent=silent
|
|
238
|
+
)
|
|
239
|
+
|
|
230
240
|
seed_nodes_addresses = _get_seed_nodes(current_network)
|
|
231
241
|
|
|
232
242
|
all_online_nodes = _get_all_online_nodes()
|
|
@@ -237,8 +247,8 @@ if True:
|
|
|
237
247
|
]
|
|
238
248
|
|
|
239
249
|
# 1. Send restart command to Seed Nodes.
|
|
240
|
-
log_with_color(f"Sending restart commands to seed nodes: {seed_nodes_addresses}", color='b')
|
|
241
|
-
_send_restart_command(seed_nodes_addresses)
|
|
250
|
+
log_with_color(f"Sending restart commands to {len(seed_nodes_addresses)} seed nodes: {seed_nodes_addresses}", color='b')
|
|
251
|
+
_send_restart_command(session=session, nodes=seed_nodes_addresses)
|
|
242
252
|
|
|
243
253
|
# Remove seed node addresses from all_nodes_addresses
|
|
244
254
|
log_with_color(
|
|
@@ -247,14 +257,15 @@ if True:
|
|
|
247
257
|
sleep(30)
|
|
248
258
|
|
|
249
259
|
# 2. Send restart commands to all Oracle nodes, except seed nodes.
|
|
250
|
-
log_with_color(f"Sending restart commands to all Oracle nodes, except seed nodes: {remaining_nodes}", color='b')
|
|
251
260
|
oracle_nodes_addresses = [
|
|
252
261
|
node['address']
|
|
253
262
|
for node in remaining_nodes
|
|
254
263
|
if node['oracle'] == True
|
|
255
264
|
]
|
|
256
265
|
|
|
257
|
-
|
|
266
|
+
log_with_color(f"Sending restart commands to {len(oracle_nodes_addresses)} Non-Seed Oracle nodes, except seed nodes: {remaining_nodes}", color='b')
|
|
267
|
+
|
|
268
|
+
_send_restart_command(session=session, nodes=oracle_nodes_addresses)
|
|
258
269
|
|
|
259
270
|
# Remove oracle node addresses from all_nodes_addresses
|
|
260
271
|
remaining_nodes_addresses = [
|
|
@@ -269,12 +280,22 @@ if True:
|
|
|
269
280
|
sleep(30)
|
|
270
281
|
|
|
271
282
|
# 3. Send restart command to all remaining edge nodes.
|
|
272
|
-
log_with_color(f"Sending restart commands to
|
|
283
|
+
log_with_color(f"Sending restart commands to {len(remaining_nodes_addresses)} remaining edge nodes: {remaining_nodes_addresses}", color='b')
|
|
273
284
|
|
|
274
|
-
_send_restart_command(nodes=remaining_nodes_addresses, timeout_min=5, timeout_max=25)
|
|
285
|
+
_send_restart_command(session=session, nodes=remaining_nodes_addresses, timeout_min=5, timeout_max=25)
|
|
275
286
|
|
|
287
|
+
restarted_seed_nodes_count = len(seed_nodes_addresses)
|
|
288
|
+
restarted_oracle_nodes_count = len(oracle_nodes_addresses)
|
|
289
|
+
restarted_edge_nodes_count = len(remaining_nodes_addresses)
|
|
290
|
+
total_restarted_nodes_count = restarted_seed_nodes_count + restarted_oracle_nodes_count + restarted_edge_nodes_count
|
|
276
291
|
log_with_color(f"All nodes restarted successfully.", color='g')
|
|
292
|
+
log_with_color("======================================================", color='b')
|
|
293
|
+
log_with_color(f"Total restarted {total_restarted_nodes_count} Nodes", color='b')
|
|
294
|
+
log_with_color(f"Restarted {restarted_seed_nodes_count} Seed Oracle Nodes", color='b')
|
|
295
|
+
log_with_color(f"Restarted {restarted_oracle_nodes_count} Non-Seed Oracle Nodes", color='b')
|
|
296
|
+
log_with_color(f"Restarted {restarted_edge_nodes_count} Edge Nodes", color='b')
|
|
277
297
|
|
|
298
|
+
session.close()
|
|
278
299
|
return
|
|
279
300
|
|
|
280
301
|
|
ratio1/const/apps.py
CHANGED
|
@@ -8,6 +8,7 @@ class PLUGIN_SIGNATURES:
|
|
|
8
8
|
CUSTOM_WEBAPI_01 = 'CUSTOM_CODE_FASTAPI_01'
|
|
9
9
|
GENERIC_WEB_APP = 'GENERIC_WEB_APP'
|
|
10
10
|
GENERIC_HTTP_SERVER = 'GENERIC_HTTP_SERVER'
|
|
11
|
+
CUSTOM_EXEC_01 = 'CUSTOM_EXEC_01'
|
|
11
12
|
CHAIN_DIST_CUSTOM_JOB_01 = 'PROCESS_REAL_TIME_COLLECTED_DATA_CUSTOM_EXEC_CHAIN_DIST'
|
|
12
13
|
TELEGRAM_BASIC_BOT_01 = 'TELEGRAM_BASIC_BOT_01'
|
|
13
14
|
TELEGRAM_CONVERSATIONAL_BOT_01 = 'TELEGRAM_CONVERSATIONAL_BOT_01'
|
|
@@ -40,6 +40,20 @@ class DEEPLOY_KEYS:
|
|
|
40
40
|
APP_PARAMS_ENV = "ENV"
|
|
41
41
|
APP_PARAMS_DYNAMIC_ENV = "DYNAMIC_ENV"
|
|
42
42
|
APP_PARAMS_PORT = "PORT"
|
|
43
|
+
|
|
44
|
+
# Telegram Bot App Params:
|
|
45
|
+
APP_PARAMS_TELEGRAM_BOT_TOKEN="TELEGRAM_BOT_TOKEN"
|
|
46
|
+
APP_PARAMS_TELEGRAM_BOT_NAME="TELEGRAM_BOT_NAME"
|
|
47
|
+
APP_PARAMS_MESSAGE_HANDLER="MESSAGE_HANDLER"
|
|
48
|
+
APP_PARAMS_MESSAGE_HANDLER_ARGS="MESSAGE_HANDLER_ARGS"
|
|
49
|
+
APP_PARAMS_MESSAGE_HANDLER_NAME="MESSAGE_HANDLER_NAME"
|
|
50
|
+
APP_PARAMS_PROCESSING_HANDLER="PROCESSING_HANDLER"
|
|
51
|
+
APP_PARAMS_PROCESSING_HANDLER_ARGS="PROCESSING_HANDLER_ARGS"
|
|
52
|
+
|
|
53
|
+
# Custom Code App Params:
|
|
54
|
+
APP_PARAMS_CODE="CODE"
|
|
55
|
+
|
|
56
|
+
#########################
|
|
43
57
|
# Auth result keys
|
|
44
58
|
SENDER = "sender"
|
|
45
59
|
SENDER_ORACLES = "sender_oracles"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ratio1
|
|
3
|
-
Version: 3.4.
|
|
3
|
+
Version: 3.4.37
|
|
4
4
|
Summary: `ratio1` or Ration1 SDK is the Python SDK required for client app development for the Ratio1 ecosystem
|
|
5
5
|
Project-URL: Homepage, https://github.com/Ratio1/ratio1_sdk
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/Ratio1/ratio1_sdk/issues
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
ratio1/__init__.py,sha256=YimqgDbjLuywsf8zCWE0EaUXH4MBUrqLxt0TDV558hQ,632
|
|
2
|
-
ratio1/_ver.py,sha256=
|
|
2
|
+
ratio1/_ver.py,sha256=jOqTWk2eCBYGGmkIbQvD17_xFaS8OOkly_YtMQztOZ4,331
|
|
3
3
|
ratio1/base_decentra_object.py,sha256=iXvAAf6wPnGWzeeiRfwLojVoan-m1e_VsyPzjUQuENo,4492
|
|
4
4
|
ratio1/plugins_manager_mixin.py,sha256=X1JdGLDz0gN1rPnTN_5mJXR8JmqoBFQISJXmPR9yvCo,11106
|
|
5
5
|
ratio1/base/__init__.py,sha256=hACh83_cIv7-PwYMM3bQm2IBmNqiHw-3PAfDfAEKz9A,259
|
|
6
6
|
ratio1/base/distributed_custom_code_presets.py,sha256=cvz5R88P6Z5V61Ce1vHVVh8bOkgXd6gve_vdESDNAsg,2544
|
|
7
|
-
ratio1/base/generic_session.py,sha256=
|
|
7
|
+
ratio1/base/generic_session.py,sha256=fzpAIqRJbwiBrpFqHXCHxvakAves7cbXRrHURLelffI,179566
|
|
8
8
|
ratio1/base/instance.py,sha256=oQvwzzRvir7851wyhDx_BwN6y_VgsNWwYo53vN33QI4,21914
|
|
9
9
|
ratio1/base/pipeline.py,sha256=szoHrk1qBdY6NKPUk3tUTsJx3XzYp5C2GTOlzRiQi48,62489
|
|
10
10
|
ratio1/base/plugin_template.py,sha256=Gs438cSkhvxPujE4CRH_32pcuZaVwI9kia8E4VDRpSU,138794
|
|
@@ -17,7 +17,7 @@ ratio1/bc/__init__.py,sha256=BI5pcqHdhwnMdbWTYDLW1cVP_844VtLra-lz7xprgsk,171
|
|
|
17
17
|
ratio1/bc/base.py,sha256=g7tARNgi_0N1p9HpvqRDWDVYxuqU7W6S0q3ARC6oxKk,45870
|
|
18
18
|
ratio1/bc/chain.py,sha256=HCTQGnmuKqTvUo95OKdg8rL2jhKfSMwrich2e_7Nyms,2336
|
|
19
19
|
ratio1/bc/ec.py,sha256=FwlkWmJvQ9aHuf_BZX1CWSUAxw6OZ9jBparLIWcs_e4,18933
|
|
20
|
-
ratio1/bc/evm.py,sha256=
|
|
20
|
+
ratio1/bc/evm.py,sha256=t0nYCyeGCotzfEKHVDtbtID8pATqofb-uPaPfz6t3lU,41074
|
|
21
21
|
ratio1/certs/51.15.142.167.crt,sha256=rLxkwDIQm-u6Kw570NmdSFgjSChcdSJvXPxr4Mj-EU8,1167
|
|
22
22
|
ratio1/certs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
23
|
ratio1/certs/a0d9818f.ala.eu-central-1.emqxsl.com.crt,sha256=y-6io0tseyx9-a4Pmde1z1gPULtJNSYUpG_YFkYaMKU,1337
|
|
@@ -25,9 +25,9 @@ ratio1/certs/r9092118.ala.eu-central-1.emqxsl.com.crt,sha256=y-6io0tseyx9-a4Pmde
|
|
|
25
25
|
ratio1/certs/s624dbd4.ala.us-east-1.emqxsl.com.crt,sha256=y-6io0tseyx9-a4Pmde1z1gPULtJNSYUpG_YFkYaMKU,1337
|
|
26
26
|
ratio1/cli/README.md,sha256=YsT23YcZBRyTKReNZPxD762YqstSWKWz4iZe_UJELPc,73
|
|
27
27
|
ratio1/cli/cli.py,sha256=D8UCtdTQKi1IqB_PAi3k2FfaM-rnfxmlrOzM4OJBOsA,4352
|
|
28
|
-
ratio1/cli/cli_commands.py,sha256=
|
|
29
|
-
ratio1/cli/nodes.py,sha256=
|
|
30
|
-
ratio1/cli/oracles.py,sha256=
|
|
28
|
+
ratio1/cli/cli_commands.py,sha256=aoPnASJ3uPHWqABLCL-E6J3U0npK7kxX8U07s_aR9qA,6290
|
|
29
|
+
ratio1/cli/nodes.py,sha256=0QjAbAhn_KrrjiGUXQ0GhnxCM-Zvxhx32FNcQd9hhHI,14237
|
|
30
|
+
ratio1/cli/oracles.py,sha256=HTQAKEwe-j0E00JKKPCH1GXjelyy0IAjzLZIx8qtimU,11141
|
|
31
31
|
ratio1/cli/package_update.py,sha256=uRMPW5XV3fBdB_eZfoQDA1SKnJzTJvyfpRJA6T3ZZlQ,4000
|
|
32
32
|
ratio1/code_cheker/__init__.py,sha256=pwkdeZGVL16ZA4Qf2mRahEhoOvKhL7FyuQbMFLr1E5M,33
|
|
33
33
|
ratio1/code_cheker/base.py,sha256=hMnM94xro_r0Kze2KLwr00TKZ1HgshlxXmwql_SEz5I,19066
|
|
@@ -38,7 +38,7 @@ ratio1/comm/base_comm_wrapper.py,sha256=oJwMtQYGumxZz1lKvDEgFwLhC1LzZFsGTP9hxBH7
|
|
|
38
38
|
ratio1/comm/mqtt_wrapper.py,sha256=QQ6IXcurchjY8Pp48t4SF1ZpE_GXaZTrgILzoMewefI,14397
|
|
39
39
|
ratio1/const/README.md,sha256=6OHesr-f5NBuuJGryEoi_TCu2XdlhfQYlDKx_IJoXeg,177
|
|
40
40
|
ratio1/const/__init__.py,sha256=mcSaDgSYV2xbOS8Api72dDPO6kPBRjnYjBPAh9cAgaU,558
|
|
41
|
-
ratio1/const/apps.py,sha256=
|
|
41
|
+
ratio1/const/apps.py,sha256=0NiuoAPak0HjEULF3fs3xaUH8IRSZ0i4fZw7T2fEd_g,785
|
|
42
42
|
ratio1/const/base.py,sha256=0K1zhAkU_LmZosnz1UMmBhmYpVt5QVBPy9FkeLQlAFY,5955
|
|
43
43
|
ratio1/const/comms.py,sha256=qEYX4ciYg8SYWSDZZTUYxzpR1--2a7UusrWzAq0hxo8,2259
|
|
44
44
|
ratio1/const/environment.py,sha256=632L5GrcNqF3-JhvrC6kXzXwLMcihRgMlOkLurnOwGY,1031
|
|
@@ -47,7 +47,7 @@ ratio1/const/formatter.py,sha256=AW3bWlqf39uaqV4BBUuW95qKYfF2OkkU4f9hy3kSVhM,200
|
|
|
47
47
|
ratio1/const/heartbeat.py,sha256=diQcAUZDNL2oJpWgh4JORhfBB6dvLa8ZW7Ce-xM-IcU,2655
|
|
48
48
|
ratio1/const/misc.py,sha256=VDCwwpf5bl9ltx9rzT2WPVP8B3mZFRufU1tSS5MO240,413
|
|
49
49
|
ratio1/const/payload.py,sha256=0rzfC__amwAIeTA8WIVteohMDN5zbBg4txis57Qh0PM,6844
|
|
50
|
-
ratio1/const/plugins/deeploy_const.py,sha256=
|
|
50
|
+
ratio1/const/plugins/deeploy_const.py,sha256=8QcIf7zo_gSC6SdHqQVecn4yOUKCPMXzHC9zgGW5-3E,13314
|
|
51
51
|
ratio1/default/__init__.py,sha256=ozU6CMMuWl0LhG8Ae3LrZ65a6tLrptfscVYGf83zjxM,46
|
|
52
52
|
ratio1/default/instance/__init__.py,sha256=JQiqTFm_U5__z4bTlvT033hUOSIDCtrQ-evMrhT6JdA,741
|
|
53
53
|
ratio1/default/instance/chain_dist_custom_job_01_plugin.py,sha256=QtHi3uXKsVs9eyMgbnvBVbMylErhV1Du4X2-7zDL7Y0,1915
|
|
@@ -103,8 +103,8 @@ ratio1/utils/comm_utils.py,sha256=4cS9llRr_pK_3rNgDcRMCQwYPO0kcNU7AdWy_LtMyCY,10
|
|
|
103
103
|
ratio1/utils/config.py,sha256=IMXAN9bpHePKEuTFGRRqFJXz_vBa-wi7s9gLhFEheRY,9953
|
|
104
104
|
ratio1/utils/dotenv.py,sha256=_AgSo35n7EnQv5yDyu7C7i0kHragLJoCGydHjvOkrYY,2008
|
|
105
105
|
ratio1/utils/oracle_sync/oracle_tester.py,sha256=aJOPcZhtbw1XPqsFG4qYpfv2Taj5-qRXbwJzrPyeXDE,27465
|
|
106
|
-
ratio1-3.4.
|
|
107
|
-
ratio1-3.4.
|
|
108
|
-
ratio1-3.4.
|
|
109
|
-
ratio1-3.4.
|
|
110
|
-
ratio1-3.4.
|
|
106
|
+
ratio1-3.4.37.dist-info/METADATA,sha256=MucFLKDGwWBSuCwv4mRGLP5dYZT30PMK7IclS32gauc,12248
|
|
107
|
+
ratio1-3.4.37.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
108
|
+
ratio1-3.4.37.dist-info/entry_points.txt,sha256=DR_olREzU1egwmgek3s4GfQslBi-KR7lXsd4ap0TFxE,46
|
|
109
|
+
ratio1-3.4.37.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
|
|
110
|
+
ratio1-3.4.37.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|