This is an automated email from the ASF dual-hosted git repository.
yongzao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new aa79842ee0d finish
aa79842ee0d is described below
commit aa79842ee0ddcb03249c4fa87411b8689ea7a005
Author: Yongzao <[email protected]>
AuthorDate: Fri Jun 27 13:55:55 2025 +0800
finish
---
iotdb-core/ainode/ainode/core/config.py | 74 +++++++++++++++++++++-
iotdb-core/ainode/ainode/core/constant.py | 7 ++
iotdb-core/ainode/ainode/core/ingress/iotdb.py | 32 +++++++---
.../ainode/resources/conf/iotdb-ainode.properties | 32 ++++++++--
4 files changed, 127 insertions(+), 18 deletions(-)
diff --git a/iotdb-core/ainode/ainode/core/config.py
b/iotdb-core/ainode/ainode/core/config.py
index 678a7cc6d62..b7dbf3fc94c 100644
--- a/iotdb-core/ainode/ainode/core/config.py
+++ b/iotdb-core/ainode/ainode/core/config.py
@@ -20,6 +20,11 @@ import os
from ainode.core.constant import (
AINODE_BUILD_INFO,
AINODE_BUILTIN_MODELS_DIR,
+ AINODE_CLUSTER_INGRESS_ADDRESS,
+ AINODE_CLUSTER_INGRESS_PASSWORD,
+ AINODE_CLUSTER_INGRESS_PORT,
+ AINODE_CLUSTER_INGRESS_TIME_ZONE,
+ AINODE_CLUSTER_INGRESS_USERNAME,
AINODE_CLUSTER_NAME,
AINODE_CONF_DIRECTORY_NAME,
AINODE_CONF_FILE_NAME,
@@ -74,6 +79,13 @@ class AINodeConfig(object):
self._ainode_id = 0
self._cluster_name = AINODE_CLUSTER_NAME
+ # connect IoTDB cluster
+ self._ain_cluster_ingress_address = AINODE_CLUSTER_INGRESS_ADDRESS
+ self._ain_cluster_ingress_port = AINODE_CLUSTER_INGRESS_PORT
+ self._ain_cluster_ingress_username = AINODE_CLUSTER_INGRESS_USERNAME
+ self._ain_cluster_ingress_password = AINODE_CLUSTER_INGRESS_PASSWORD
+ self._ain_cluster_ingress_time_zone = AINODE_CLUSTER_INGRESS_TIME_ZONE
+
self._version_info = AINODE_VERSION_INFO
self._build_info = AINODE_BUILD_INFO
@@ -162,6 +174,42 @@ class AINodeConfig(object):
ain_target_config_node_list
)
+ def get_ain_cluster_ingress_address(self) -> str:
+ return self._ain_cluster_ingress_address
+
+ def set_ain_cluster_ingress_address(self, ain_cluster_ingress_address:
str) -> None:
+ self._ain_cluster_ingress_address = ain_cluster_ingress_address
+
+ def get_ain_cluster_ingress_port(self) -> int:
+ return self._ain_cluster_ingress_port
+
+ def set_ain_cluster_ingress_port(self, ain_cluster_ingress_port: int) ->
None:
+ self._ain_cluster_ingress_port = ain_cluster_ingress_port
+
+ def get_ain_cluster_ingress_username(self) -> str:
+ return self._ain_cluster_ingress_username
+
+ def set_ain_cluster_ingress_username(
+ self, ain_cluster_ingress_username: str
+ ) -> None:
+ self._ain_cluster_ingress_username = ain_cluster_ingress_username
+
+ def get_ain_cluster_ingress_password(self) -> str:
+ return self._ain_cluster_ingress_password
+
+ def set_ain_cluster_ingress_password(
+ self, ain_cluster_ingress_password: str
+ ) -> None:
+ self._ain_cluster_ingress_password = ain_cluster_ingress_password
+
+ def get_ain_cluster_ingress_time_zone(self) -> str:
+ return self._ain_cluster_ingress_time_zone
+
+ def set_ain_cluster_ingress_time_zone(
+ self, ain_cluster_ingress_time_zone: str
+ ) -> None:
+ self._ain_cluster_ingress_time_zone = ain_cluster_ingress_time_zone
+
@singleton
class AINodeDescriptor(object):
@@ -246,8 +294,30 @@ class AINodeDescriptor(object):
if "ain_logs_dir" in config_keys:
log_dir = file_configs["ain_logs_dir"]
self._config.set_ain_logs_dir(log_dir)
- Logger(log_dir=log_dir).info(
- f"Successfully load config from {conf_file}."
+
+ if "ain_cluster_ingress_address" in config_keys:
+ self._config.set_ain_cluster_ingress_address(
+ file_configs["ain_cluster_ingress_address"]
+ )
+
+ if "ain_cluster_ingress_port" in config_keys:
+ self._config.set_ain_cluster_ingress_port(
+ int(file_configs["ain_cluster_ingress_port"])
+ )
+
+ if "ain_cluster_ingress_username" in config_keys:
+ self._config.set_ain_cluster_ingress_username(
+ file_configs["ain_cluster_ingress_username"]
+ )
+
+ if "ain_cluster_ingress_password" in config_keys:
+ self._config.set_ain_cluster_ingress_password(
+ file_configs["ain_cluster_ingress_password"]
+ )
+
+ if "ain_cluster_ingress_time_zone" in config_keys:
+ self._config.set_ain_cluster_ingress_time_zone(
+ file_configs["ain_cluster_ingress_time_zone"]
)
except BadNodeUrlError:
diff --git a/iotdb-core/ainode/ainode/core/constant.py
b/iotdb-core/ainode/ainode/core/constant.py
index 41d0344e056..a2ce549ef2b 100644
--- a/iotdb-core/ainode/ainode/core/constant.py
+++ b/iotdb-core/ainode/ainode/core/constant.py
@@ -30,6 +30,7 @@ AINODE_SYSTEM_FILE_NAME = "system.properties"
# inference_rpc_address
AINODE_INFERENCE_RPC_ADDRESS = "127.0.0.1"
AINODE_INFERENCE_RPC_PORT = 10810
+# AINode folder structure
AINODE_MODELS_DIR = "data/ainode/models"
AINODE_BUILTIN_MODELS_DIR = "data/ainode/models/weights" # For built-in
models, we only need to store their weights and config.
AINODE_SYSTEM_DIR = "data/ainode/system"
@@ -42,6 +43,12 @@ AINODE_BUILD_INFO = "UNKNOWN"
AINODE_ROOT_DIR = os.path.dirname(
os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
)
+# connect IoTDB cluster
+AINODE_CLUSTER_INGRESS_ADDRESS = "127.0.0.1"
+AINODE_CLUSTER_INGRESS_PORT = 6667
+AINODE_CLUSTER_INGRESS_USERNAME = "root"
+AINODE_CLUSTER_INGRESS_PASSWORD = "root"
+AINODE_CLUSTER_INGRESS_TIME_ZONE = "UTC+8"
# AINode log
AINODE_LOG_FILE_NAMES = [
diff --git a/iotdb-core/ainode/ainode/core/ingress/iotdb.py
b/iotdb-core/ainode/ainode/core/ingress/iotdb.py
index 399036bca1d..b9e844d9193 100644
--- a/iotdb-core/ainode/ainode/core/ingress/iotdb.py
+++ b/iotdb-core/ainode/ainode/core/ingress/iotdb.py
@@ -60,11 +60,17 @@ class IoTDBTreeModelDataset(BasicDatabaseForecastDataset):
input_token_len: int,
output_token_len: int,
data_schema_list: list,
- ip: str = "127.0.0.1",
- port: int = 6667,
- username: str = "root",
- password: str = "root",
- time_zone: str = "UTC+8",
+ ip: str =
AINodeDescriptor().get_config().get_ain_cluster_ingress_address(),
+ port: int =
AINodeDescriptor().get_config().get_ain_cluster_ingress_port(),
+ username: str = AINodeDescriptor()
+ .get_config()
+ .get_ain_cluster_ingress_username(),
+ password: str = AINodeDescriptor()
+ .get_config()
+ .get_ain_cluster_ingress_password(),
+ time_zone: str = AINodeDescriptor()
+ .get_config()
+ .get_ain_cluster_ingress_time_zone(),
use_rate: float = 1.0,
offset_rate: float = 0.0,
):
@@ -225,11 +231,17 @@ class
IoTDBTableModelDataset(BasicDatabaseForecastDataset):
input_token_len: int,
output_token_len: int,
data_schema_list: list,
- ip: str = "127.0.0.1",
- port: int = 6667,
- username: str = "root",
- password: str = "root",
- time_zone: str = "UTC+8",
+ ip: str =
AINodeDescriptor().get_config().get_ain_cluster_ingress_address(),
+ port: int =
AINodeDescriptor().get_config().get_ain_cluster_ingress_port(),
+ username: str = AINodeDescriptor()
+ .get_config()
+ .get_ain_cluster_ingress_username(),
+ password: str = AINodeDescriptor()
+ .get_config()
+ .get_ain_cluster_ingress_password(),
+ time_zone: str = AINodeDescriptor()
+ .get_config()
+ .get_ain_cluster_ingress_time_zone(),
use_rate: float = 1.0,
offset_rate: float = 0.0,
):
diff --git a/iotdb-core/ainode/resources/conf/iotdb-ainode.properties
b/iotdb-core/ainode/resources/conf/iotdb-ainode.properties
index 2b208e72125..358567d82cf 100644
--- a/iotdb-core/ainode/resources/conf/iotdb-ainode.properties
+++ b/iotdb-core/ainode/resources/conf/iotdb-ainode.properties
@@ -19,22 +19,42 @@
# Used for indicate cluster name and distinguish different cluster.
# Datatype: string
-# cluster_name=defaultCluster
+cluster_name=defaultCluster
-# ConfigNode address registered at AINode startup
-# Allow modifications only before starting the service for the first time
+# ConfigNode address registered at AINode startup.
+# Allow modifications only before starting the service for the first time.
# Datatype: String
-# ain_seed_config_node=127.0.0.1:10710
+ain_seed_config_node=127.0.0.1:10710
+
+# The DataNode address for fetching IoTDB data
+# Datatype: String
+ain_cluster_ingress_address=127.0.0.1
+
+# The DataNode port for fetching IoTDB data
+# Datatype: Integer
+ain_cluster_ingress_port=6667
+
+# The username of IoTDB cluster.
+# Datatype: String
+ain_cluster_ingress_username=root
+
+# The password of IoTDB cluster.
+# Datatype: String
+ain_cluster_ingress_password=root
+
+# The time zone of the IoTDB cluster.
+# Datatype: String
+ain_cluster_ingress_time_zone=UTC+8
# Used for connection of DataNode/ConfigNode clients
# Could set 127.0.0.1(for local test) or ipv4 address
# Datatype: String
-# ain_inference_rpc_address=127.0.0.1
+ain_inference_rpc_address=127.0.0.1
# Used for connection of DataNode/ConfigNode clients
# Bind with MN_RPC_ADDRESS
# Datatype: String
-# ain_inference_rpc_port=10810
+ain_inference_rpc_port=10810
# The AINode metadata storage path.
# The starting directory of the relative path is related to the operating
system.