Skip to content

Commit fd16677

Browse files
committed
Fix CI bugs
1 parent 5cc12be commit fd16677

File tree

7 files changed

+25
-60
lines changed

7 files changed

+25
-60
lines changed

integration-test/src/test/java/org/apache/iotdb/ainode/it/AINodeCallInferenceIT.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public class AINodeCallInferenceIT {
5858

5959
private static final String CALL_INFERENCE_SQL_TEMPLATE =
6060
"CALL INFERENCE(%s, \"SELECT s%d FROM root.AI LIMIT %d\", generateTime=true, outputLength=%d)";
61+
private static final int DEFAULT_INPUT_LENGTH = 256;
6162
private static final int DEFAULT_OUTPUT_LENGTH = 48;
6263

6364
@BeforeClass
@@ -100,7 +101,7 @@ public void callInferenceTest(Statement statement, AINodeTestUtils.FakeModelInfo
100101
CALL_INFERENCE_SQL_TEMPLATE,
101102
modelInfo.getModelId(),
102103
i,
103-
DEFAULT_OUTPUT_LENGTH,
104+
DEFAULT_INPUT_LENGTH,
104105
DEFAULT_OUTPUT_LENGTH);
105106
try (ResultSet resultSet = statement.executeQuery(callInferenceSQL)) {
106107
ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
@@ -119,7 +120,7 @@ public void callInferenceTest(Statement statement, AINodeTestUtils.FakeModelInfo
119120
public void errorCallInferenceTestInTree() throws SQLException {
120121
try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TREE_SQL_DIALECT);
121122
Statement statement = connection.createStatement()) {
122-
String sql = "CALL INFERENCE(notFound404, \"select s0,s1,s2 from root.AI\", window=head(5))";
123+
String sql = "CALL INFERENCE(notFound404, \"select s0,s1,s2 from root.AI\")";
123124
errorTest(statement, sql, "1505: model [notFound404] has not been created.");
124125
}
125126
}

integration-test/src/test/java/org/apache/iotdb/ainode/it/AINodeConcurrentForecastIT.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ public void concurrentGPUForecastTest(AINodeTestUtils.FakeModelInfo modelInfo)
9797
final String devices = "0,1";
9898
statement.execute(
9999
String.format("LOAD MODEL %s TO DEVICES '%s'", modelInfo.getModelId(), devices));
100-
checkModelOnSpecifiedDevice(
101-
statement, modelInfo.getModelId(), modelInfo.getModelType(), devices);
100+
checkModelOnSpecifiedDevice(statement, modelInfo.getModelId(), devices);
102101
long startTime = System.currentTimeMillis();
103102
concurrentInference(statement, forecastSQL, threadCnt, loop, forecastLength);
104103
long endTime = System.currentTimeMillis();

integration-test/src/test/java/org/apache/iotdb/ainode/it/AINodeForecastIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ public class AINodeForecastIT {
4646

4747
private static final String[] WRITE_SQL_IN_TABLE =
4848
new String[] {
49-
"CREATE DATABASE root",
50-
"CREATE TABLE root.AI (s0 FLOAT FIELD, s1 DOUBLE FIELD, s2 INT32 FIELD, s3 INT64 FIELD)",
49+
"CREATE DATABASE db",
50+
"CREATE TABLE db.AI (s0 FLOAT FIELD, s1 DOUBLE FIELD, s2 INT32 FIELD, s3 INT64 FIELD)",
5151
};
5252

5353
private static final String FORECAST_TABLE_FUNCTION_SQL_TEMPLATE =
54-
"SELECT * FROM FORECAST(model_id=>'%s', input=>(SELECT time, s%d FROM root.AI) ORDER BY time)";
54+
"SELECT * FROM FORECAST(model_id=>'%s', input=>(SELECT time, s%d FROM db.AI) ORDER BY time)";
5555

5656
@BeforeClass
5757
public static void setUp() throws Exception {

integration-test/src/test/java/org/apache/iotdb/ainode/it/AINodeInstanceManagementIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ private void basicManagementTest(Statement statement) throws SQLException, Inter
8686

8787
// Load sundial to each device
8888
statement.execute(String.format("LOAD MODEL sundial TO DEVICES '%s'", TARGET_DEVICES));
89-
checkModelOnSpecifiedDevice(statement, "sundial", "sundial", TARGET_DEVICES.toString());
89+
checkModelOnSpecifiedDevice(statement, "sundial", TARGET_DEVICES.toString());
9090

9191
// Load timer_xl to each device
9292
statement.execute(String.format("LOAD MODEL timer_xl TO DEVICES '%s'", TARGET_DEVICES));
93-
checkModelOnSpecifiedDevice(statement, "timer_xl", "timer_xl", TARGET_DEVICES.toString());
93+
checkModelOnSpecifiedDevice(statement, "timer_xl", TARGET_DEVICES.toString());
9494

9595
// Clean every device
9696
statement.execute(String.format("UNLOAD MODEL sundial FROM DEVICES '%s'", TARGET_DEVICES));
@@ -107,7 +107,7 @@ public void repeatLoadAndUnloadTest() throws SQLException, InterruptedException
107107
Statement statement = connection.createStatement()) {
108108
for (int i = 0; i < LOOP_CNT; i++) {
109109
statement.execute("LOAD MODEL sundial TO DEVICES \"cpu,0,1\"");
110-
checkModelOnSpecifiedDevice(statement, "sundial", "sundial", TARGET_DEVICES.toString());
110+
checkModelOnSpecifiedDevice(statement, "sundial", TARGET_DEVICES.toString());
111111
statement.execute("UNLOAD MODEL sundial FROM DEVICES \"cpu,0,1\"");
112112
checkModelNotOnSpecifiedDevice(statement, "sundial", TARGET_DEVICES.toString());
113113
}

integration-test/src/test/java/org/apache/iotdb/ainode/it/AINodeModelManageIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,15 @@ private void userDefinedModelManagementTest(Statement statement)
131131
public void dropBuiltInModelErrorTestInTree() throws SQLException {
132132
try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TREE_SQL_DIALECT);
133133
Statement statement = connection.createStatement()) {
134-
errorTest(statement, "drop model sundial", "1501: Built-in model sundial can't be removed");
134+
errorTest(statement, "drop model sundial", "1510: Built-in model sundial can't be removed");
135135
}
136136
}
137137

138138
@Test
139139
public void dropBuiltInModelErrorTestInTable() throws SQLException {
140140
try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT);
141141
Statement statement = connection.createStatement()) {
142-
errorTest(statement, "drop model sundial", "1501: Built-in model sundial can't be removed");
142+
errorTest(statement, "drop model sundial", "1510: Built-in model sundial can't be removed");
143143
}
144144
}
145145

integration-test/src/test/java/org/apache/iotdb/ainode/utils/AINodeTestUtils.java

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ public class AINodeTestUtils {
4545
public static final Map<String, FakeModelInfo> BUILTIN_LTSM_MAP =
4646
Stream.of(
4747
new AbstractMap.SimpleEntry<>(
48-
"sundial", new FakeModelInfo("sundial", "sundial", "BUILT-IN", "ACTIVE")),
48+
"sundial", new FakeModelInfo("sundial", "sundial", "builtin", "active")),
4949
new AbstractMap.SimpleEntry<>(
50-
"timer_xl", new FakeModelInfo("timer_xl", "timer", "BUILT-IN", "ACTIVE")))
50+
"timer_xl", new FakeModelInfo("timer_xl", "timer", "builtin", "active")))
5151
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
5252

5353
public static final Map<String, FakeModelInfo> BUILTIN_MODEL_MAP;
@@ -56,27 +56,25 @@ public class AINodeTestUtils {
5656
Map<String, FakeModelInfo> tmp =
5757
Stream.of(
5858
new AbstractMap.SimpleEntry<>(
59-
"arima", new FakeModelInfo("arima", "Arima", "BUILT-IN", "ACTIVE")),
59+
"arima", new FakeModelInfo("arima", "sktime", "builtin", "active")),
6060
new AbstractMap.SimpleEntry<>(
61-
"holtwinters",
62-
new FakeModelInfo("holtwinters", "HoltWinters", "BUILT-IN", "ACTIVE")),
61+
"holtwinters", new FakeModelInfo("holtwinters", "sktime", "builtin", "active")),
6362
new AbstractMap.SimpleEntry<>(
6463
"exponential_smoothing",
65-
new FakeModelInfo(
66-
"exponential_smoothing", "ExponentialSmoothing", "BUILT-IN", "ACTIVE")),
64+
new FakeModelInfo("exponential_smoothing", "sktime", "builtin", "active")),
6765
new AbstractMap.SimpleEntry<>(
6866
"naive_forecaster",
69-
new FakeModelInfo("naive_forecaster", "NaiveForecaster", "BUILT-IN", "ACTIVE")),
67+
new FakeModelInfo("naive_forecaster", "sktime", "builtin", "active")),
7068
new AbstractMap.SimpleEntry<>(
7169
"stl_forecaster",
72-
new FakeModelInfo("stl_forecaster", "StlForecaster", "BUILT-IN", "ACTIVE")),
70+
new FakeModelInfo("stl_forecaster", "sktime", "builtin", "active")),
7371
new AbstractMap.SimpleEntry<>(
7472
"gaussian_hmm",
75-
new FakeModelInfo("gaussian_hmm", "GaussianHmm", "BUILT-IN", "ACTIVE")),
73+
new FakeModelInfo("gaussian_hmm", "sktime", "builtin", "active")),
7674
new AbstractMap.SimpleEntry<>(
77-
"gmm_hmm", new FakeModelInfo("gmm_hmm", "GmmHmm", "BUILT-IN", "ACTIVE")),
75+
"gmm_hmm", new FakeModelInfo("gmm_hmm", "sktime", "builtin", "active")),
7876
new AbstractMap.SimpleEntry<>(
79-
"stray", new FakeModelInfo("stray", "Stray", "BUILT-IN", "ACTIVE")))
77+
"stray", new FakeModelInfo("stray", "sktime", "builtin", "active")))
8078
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
8179
tmp.putAll(BUILTIN_LTSM_MAP);
8280
BUILTIN_MODEL_MAP = Collections.unmodifiableMap(tmp);
@@ -134,8 +132,7 @@ public static void concurrentInference(
134132
}
135133
}
136134

137-
public static void checkModelOnSpecifiedDevice(
138-
Statement statement, String modelId, String modelType, String device)
135+
public static void checkModelOnSpecifiedDevice(Statement statement, String modelId, String device)
139136
throws SQLException, InterruptedException {
140137
Set<String> targetDevices = ImmutableSet.copyOf(device.split(","));
141138
LOGGER.info("Checking model: {} on target devices: {}", modelId, targetDevices);
@@ -146,13 +143,9 @@ public static void checkModelOnSpecifiedDevice(
146143
while (resultSet.next()) {
147144
String deviceId = resultSet.getString("DeviceId");
148145
String loadedModelId = resultSet.getString("ModelId");
149-
String loadedModelType = resultSet.getString("ModelType");
150146
int count = resultSet.getInt("Count(instances)");
151147
LOGGER.info("Model {} found in device {}, count {}", loadedModelId, deviceId, count);
152-
if (loadedModelId.equals(modelId)
153-
&& loadedModelType.equals(modelType)
154-
&& targetDevices.contains(deviceId)
155-
&& count > 0) {
148+
if (loadedModelId.equals(modelId) && targetDevices.contains(deviceId) && count > 0) {
156149
foundDevices.add(deviceId);
157150
LOGGER.info("Model {} is loaded to device {}", modelId, device);
158151
}

iotdb-core/ainode/iotdb/ainode/core/constant.py

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
AINODE_MODELS_DIR = os.path.join(IOTDB_AINODE_HOME, "data/ainode/models")
6565
AINODE_MODELS_BUILTIN_DIR = "iotdb.ainode.core.model"
6666
AINODE_SYSTEM_DIR = os.path.join(IOTDB_AINODE_HOME, "data/ainode/system")
67-
AINODE_LOG_DIR = "logs"
67+
AINODE_LOG_DIR = os.path.join(IOTDB_AINODE_HOME, "logs")
6868

6969
# AINode log
7070
LOG_FILE_TYPE = ["all", "info", "warn", "error"]
@@ -93,27 +93,6 @@ def get_status_code(self) -> int:
9393
return self.value
9494

9595

96-
class TaskType(Enum):
97-
FORECAST = "forecast"
98-
99-
100-
class OptionsKey(Enum):
101-
# common
102-
TASK_TYPE = "task_type"
103-
MODEL_TYPE = "model_type"
104-
AUTO_TUNING = "auto_tuning"
105-
INPUT_VARS = "input_vars"
106-
107-
# forecast
108-
INPUT_LENGTH = "input_length"
109-
PREDICT_LENGTH = "predict_length"
110-
PREDICT_INDEX_LIST = "predict_index_list"
111-
INPUT_TYPE_LIST = "input_type_list"
112-
113-
def name(self) -> str:
114-
return self.value
115-
116-
11796
class HyperparameterName(Enum):
11897
# Training hyperparameter
11998
LEARNING_RATE = "learning_rate"
@@ -132,10 +111,3 @@ class HyperparameterName(Enum):
132111

133112
def name(self):
134113
return self.value
135-
136-
137-
class ModelInputName(Enum):
138-
DATA_X = "data_x"
139-
TIME_STAMP_X = "time_stamp_x"
140-
TIME_STAMP_Y = "time_stamp_y"
141-
DEC_INP = "dec_inp"

0 commit comments

Comments
 (0)