You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by yo...@apache.org on 2025/08/17 03:49:45 UTC
(iotdb) 01/01: trigger CU
This is an automated email from the ASF dual-hosted git repository.
yongzao pushed a commit to branch try-test-timer
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit b59fe68ce96383fa31af2049b1a3dd9eaa648dcb
Author: Yongzao <53...@qq.com>
AuthorDate: Sun Aug 17 11:49:32 2025 +0800
trigger CU
---
.../iotdb/it/env/cluster/node/AINodeWrapper.java | 42 ++++++++++++++++++++++
.../iotdb/ainode/it/AINodeModelManageIT.java | 37 +++++++++----------
2 files changed, 58 insertions(+), 21 deletions(-)
diff --git a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/node/AINodeWrapper.java b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/node/AINodeWrapper.java
index 64c2bbec2c0..b9eba67c6e1 100644
--- a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/node/AINodeWrapper.java
+++ b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/node/AINodeWrapper.java
@@ -22,15 +22,22 @@ package org.apache.iotdb.it.env.cluster.node;
import org.apache.iotdb.it.env.cluster.config.MppJVMConfig;
import org.apache.iotdb.it.framework.IoTDBTestLogger;
+import org.apache.commons.io.file.PathUtils;
import org.slf4j.Logger;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.LinkOption;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.Path;
import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Stream;
import static org.apache.iotdb.it.env.cluster.ClusterConstant.AI_NODE_NAME;
import static org.apache.iotdb.it.env.cluster.ClusterConstant.TARGET;
@@ -51,6 +58,8 @@ public class AINodeWrapper extends AbstractNodeWrapper {
private static final String PROPERTIES_FILE = "iotdb-ainode.properties";
public static final String CONFIG_PATH = "conf";
public static final String SCRIPT_PATH = "sbin";
+ public static final String BUILT_IN_MODEL_PATH = "data/ainode/models/weights";
+ public static final String CACHE_BUILT_IN_MODEL_PATH = "/tmp/data/ainode/models/weights";
private void replaceAttribute(String[] keys, String[] values, String filePath) {
try (BufferedWriter writer = new BufferedWriter(new FileWriter(filePath, true))) {
@@ -115,6 +124,39 @@ public class AINodeWrapper extends AbstractNodeWrapper {
},
propertiesFile);
+ // copy built-in LTSM
+ String builtInModelPath = filePrefix + File.separator + BUILT_IN_MODEL_PATH;
+ new File(builtInModelPath).mkdirs();
+ try {
+ if (new File(builtInModelPath).exists()) {
+ PathUtils.deleteDirectory(Paths.get(builtInModelPath));
+ }
+ } catch (NoSuchFileException e) {
+ // ignored
+ }
+ try (Stream<Path> s = Files.walk(Paths.get(CACHE_BUILT_IN_MODEL_PATH))) {
+ s.forEach(
+ source -> {
+ Path destination =
+ Paths.get(
+ builtInModelPath,
+ source.toString().substring(CACHE_BUILT_IN_MODEL_PATH.length()));
+ logger.info("AINode copying model weights from {} to {}", source, destination);
+ try {
+ Files.copy(
+ source,
+ destination,
+ LinkOption.NOFOLLOW_LINKS,
+ StandardCopyOption.COPY_ATTRIBUTES);
+ } catch (IOException e) {
+ logger.error("AINode got error copying model weights", e);
+ throw new RuntimeException(e);
+ }
+ });
+ } catch (Exception e) {
+ logger.error("AINode got error copying model weights", e);
+ }
+
// start AINode
List<String> startCommand = new ArrayList<>();
startCommand.add(SHELL_COMMAND);
diff --git a/integration-test/src/test/java/org/apache/iotdb/ainode/it/AINodeModelManageIT.java b/integration-test/src/test/java/org/apache/iotdb/ainode/it/AINodeModelManageIT.java
index af6681fc9b8..2a1461e4a15 100644
--- a/integration-test/src/test/java/org/apache/iotdb/ainode/it/AINodeModelManageIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/ainode/it/AINodeModelManageIT.java
@@ -54,7 +54,7 @@ import static org.junit.Assert.fail;
@Category({AIClusterIT.class})
public class AINodeModelManageIT {
- private static final Map<String, FakeModelInfo> BUILT_IN_MACHINE_LEARNING_MODEL_MAP =
+ private static final Map<String, FakeModelInfo> BUILT_IN_MODEL_MAP =
Stream.of(
new AbstractMap.SimpleEntry<>(
"arima", new FakeModelInfo("arima", "Arima", "BUILT-IN", "ACTIVE")),
@@ -77,13 +77,11 @@ public class AINodeModelManageIT {
new AbstractMap.SimpleEntry<>(
"gmm_hmm", new FakeModelInfo("gmm_hmm", "GmmHmm", "BUILT-IN", "ACTIVE")),
new AbstractMap.SimpleEntry<>(
- "stray", new FakeModelInfo("stray", "Stray", "BUILT-IN", "ACTIVE")))
- // new AbstractMap.SimpleEntry<>(
- // "sundial", new FakeModelInfo("sundial", "Timer-Sundial", "BUILT-IN",
- // "ACTIVE")),
- // new AbstractMap.SimpleEntry<>(
- // "timer_xl", new FakeModelInfo("timer_xl", "Timer-XL", "BUILT-IN",
- // "ACTIVE")))
+ "stray", new FakeModelInfo("stray", "Stray", "BUILT-IN", "ACTIVE")),
+ new AbstractMap.SimpleEntry<>(
+ "sundial", new FakeModelInfo("sundial", "Timer-Sundial", "BUILT-IN", "ACTIVE")),
+ new AbstractMap.SimpleEntry<>(
+ "timer_xl", new FakeModelInfo("timer_xl", "Timer-XL", "BUILT-IN", "ACTIVE")))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
@BeforeClass
@@ -203,20 +201,17 @@ public class AINodeModelManageIT {
ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
checkHeader(resultSetMetaData, "ModelId,ModelType,Category,State");
while (resultSet.next()) {
- String modelId = resultSet.getString(1);
- if (!modelId.equals("sundial") && !modelId.equals("timer_xl")) {
- built_in_model_count++;
- FakeModelInfo modelInfo =
- new FakeModelInfo(
- resultSet.getString(1),
- resultSet.getString(2),
- resultSet.getString(3),
- resultSet.getString(4));
- assertTrue(BUILT_IN_MACHINE_LEARNING_MODEL_MAP.containsKey(modelInfo.getModelId()));
- assertEquals(BUILT_IN_MACHINE_LEARNING_MODEL_MAP.get(modelInfo.getModelId()), modelInfo);
- }
+ built_in_model_count++;
+ FakeModelInfo modelInfo =
+ new FakeModelInfo(
+ resultSet.getString(1),
+ resultSet.getString(2),
+ resultSet.getString(3),
+ resultSet.getString(4));
+ assertTrue(BUILT_IN_MODEL_MAP.containsKey(modelInfo.getModelId()));
+ assertEquals(BUILT_IN_MODEL_MAP.get(modelInfo.getModelId()), modelInfo);
}
}
- assertEquals(BUILT_IN_MACHINE_LEARNING_MODEL_MAP.size(), built_in_model_count);
+ assertEquals(BUILT_IN_MODEL_MAP.size(), built_in_model_count);
}
}