Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 96 additions & 5 deletions extensions/business/deeploy/deeploy_const.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,18 @@ class DEEPLOY_KEYS:
PROJECT_ID = "project_id" # this is the SHA256(UUID) generated by UI
PROJECT_NAME = "project_name"
JOB_TAGS = "job_tags"
JOB_APP_TYPE = "job_app_type"
CHAINSTORE_RESPONSE = "chainstore_response"
PIPELINE_INPUT_TYPE = "pipeline_input_type"
PIPELINE_INPUT_URI = "pipeline_input_uri"
# App params keys
APP_PARAMS = "app_params"
APP_PARAMS_IMAGE = "IMAGE"
APP_PARAMS_CR = "CR"
# Multi-plugin keys
PLUGINS = "plugins"
PLUGIN_INSTANCES = "instances"
PLUGIN_INSTANCE_ID = "instance_id"
# Auth result keys
SENDER = "sender"
SENDER_ORACLES = "sender_oracles"
Expand Down Expand Up @@ -89,6 +94,12 @@ class DEEPLOY_ERRORS:
NODETAGS1 = "ERR19_NODETAGS1"
NODETAGS2 = "ERR20_NODETAGS2"
NODETAGS3 = "ERR21_NODETAGS3"
JOB_RESOURCES1 = "ERR22_JOB_RESOURCES1"
JOB_RESOURCES2 = "ERR23_JOB_RESOURCES2"
JOB_RESOURCES3 = "ERR24_JOB_RESOURCES3"
PLUGINS1 = "ERR25_DEEPLOY_PLUGINS1" # Invalid plugins array structure
PLUGINS2 = "ERR26_DEEPLOY_PLUGINS2" # Plugin missing required field
PLUGINS3 = "ERR27_DEEPLOY_PLUGINS3" # Instance validation failed

class DEEPLOY_RESOURCES:
# Result dictionary keys
Expand Down Expand Up @@ -185,13 +196,28 @@ class DEEPLOY_PLUGIN_DATA:
CHAINSTORE_RESPONSE_KEY = "CHAINSTORE_RESPONSE_KEY"

CONTAINER_APP_RUNNER_SIGNATURE = 'CONTAINER_APP_RUNNER'
WORKER_APP_RUNNER_SIGNATURE = 'WORKER_APP_RUNNER'


class JOB_APP_TYPES:
GENERIC = "generic"
NATIVE = "native"
SERVICE = "service"


JOB_APP_TYPES_ALL = (
JOB_APP_TYPES.GENERIC,
JOB_APP_TYPES.NATIVE,
JOB_APP_TYPES.SERVICE,
)
DEEPLOY_FORBIDDEN_SIGNATURES = ['ADMIN_CONTAINER_APP_RUNNER']

DEEPLOY_CREATE_REQUEST = {
"app_alias" : "some_app_name",
"project_id" : "DELIVERD_BY_UI = SHA256(UUID)",
"project_name": "human-readable-project-name",
"job_id" : "DELIVERED_BY_UI_FROM_SC",
"job_app_type": "generic",
"plugin_signature" : "SOME_PLUGIN_01",
"nonce" : hex(int(time() * 1000)), # recoverable via int(nonce, 16)
"target_nodes" : [
Expand Down Expand Up @@ -446,7 +472,7 @@ class DEEPLOY_PLUGIN_DATA:
}

DEEPLOY_CREATE_REQUES_NATIVE_APPS = {
"app_alias" : "some_app_name",
"app_alias" : "some_app_name",
"project_id" : "DELIVERD_BY_UI = SHA256(UUID)",
"project_name": "human-readable-project-name",
"job_id" : "DELIVERED_BY_UI_FROM_SC",
Expand All @@ -470,12 +496,12 @@ class DEEPLOY_PLUGIN_DATA:
# - if NGROK_EDGE_LABEL is not None and NGROK_ENABLED is True => normal use
# - if NGROK_EDGE_LABEL is None and NGROK_ENABLED is True => create/use dynamic url
# - if NGROK_EDGE_LABEL is not None and NGROK_ENABLED is False => consider NGROK_ENABLED=True
"NGROK_USE_API": True, # use API or shell for ngrok tunnel creation

"NGROK_USE_API": True, # use API or shell for ngrok tunnel creation

# TODO: in v2 we need to have for each native plugin a set of default params and their values
# thus the below params will be pre-completed with these default key-values

"OTHER_PARAM1" : "value1",
"OTHER_PARAM2" : "value2",
"OTHER_PARAM3" : "value3",
Expand All @@ -491,6 +517,71 @@ class DEEPLOY_PLUGIN_DATA:
"chainstore_response" : False,
}

###################################################################################################################
# Multi-plugin request format (NEW - recommended for multiple plugins)
DEEPLOY_CREATE_REQUEST_MULTI_PLUGIN = {
# Pipeline-level configuration
"app_alias" : "EdgeNodeApiTest",
"project_id" : "DELIVERD_BY_UI = SHA256(UUID)",
"project_name": "human-readable-project-name",
"job_id" : "DELIVERED_BY_UI_FROM_SC",
"job_app_type": "native",
"nonce" : hex(int(time() * 1000)),

# Node selection
"target_nodes" : [
"0xai_node_1",
],
"target_nodes_count" : 0, # Use this OR target_nodes
"spare_nodes" : [],
"job_tags": ["KYB", "REG:EU"],
"node_res_req" : {
"cpu" : 4,
"memory" : "16GiB"
},

# Pipeline data source
"pipeline_input_type" : "void", # Pipeline TYPE
"pipeline_input_uri" : None,
"chainstore_response" : True,

# Plugins array (NEW FORMAT - each object is a plugin instance)
"plugins": [
{
# Plugin instance 1: EDGE_NODE_API_TEST
"plugin_signature": "EDGE_NODE_API_TEST"
},
{
# Plugin instance 2: CONTAINER_APP_RUNNER
"plugin_signature": "CONTAINER_APP_RUNNER",
"IMAGE": "tvitalii/ratio1-drive:latest",
"CONTAINER_RESOURCES": {
"cpu": 2,
"memory": "4096m",
"ports": {}
},
"CR": "docker.io",
"ENV": {
"INSTANCE_NAME": "R1TEST_INSTANCE"
},
"DYNAMIC_ENV": {
"RATIO1_AGENT_ENDPOINT": [
{"type": "static", "value": "http://"},
{"type": "host_ip", "value": ""},
{"type": "static", "value": ":15033/query"}
]
},
"VOLUMES": {
"ks_data": "/keysoft/storage"
},
"PORT": None,
"RESTART_POLICY": "always",
"IMAGE_PULL_POLICY": "always",
"TUNNEL_ENGINE_ENABLED": False
}
]
}

###################################################################################################################
DEEPLOY_SCALE_UP_JOB_WORKERS_REQUEST = {
"job_id" : 1, # The job ID to extend the workers for
Expand Down
Loading