Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class AINodeConcurrentForecastIT {
private static final Logger LOGGER = LoggerFactory.getLogger(AINodeConcurrentForecastIT.class);

private static final String FORECAST_TABLE_FUNCTION_SQL_TEMPLATE =
"SELECT * FROM FORECAST(model_id=>'%s', input=>(SELECT time,s FROM root.AI) ORDER BY time, forecast_length=>%d)";
"SELECT * FROM FORECAST(model_id=>'%s', input=>(SELECT time,s FROM root.AI) ORDER BY time, output_length=>%d)";

@BeforeClass
public static void setUp() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package org.apache.iotdb.ainode.utils;

import com.google.common.collect.ImmutableSet;
import org.junit.Assert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -34,6 +35,7 @@
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
import java.util.stream.Stream;

Expand Down Expand Up @@ -101,6 +103,7 @@ public static void errorTest(Statement statement, String sql, String errorMessag
public static void concurrentInference(
Statement statement, String sql, int threadCnt, int loop, int expectedOutputLength)
throws InterruptedException {
AtomicBoolean allPass = new AtomicBoolean(true);
Thread[] threads = new Thread[threadCnt];
for (int i = 0; i < threadCnt; i++) {
threads[i] =
Expand All @@ -113,13 +116,17 @@ public static void concurrentInference(
while (resultSet.next()) {
outputCnt++;
}
assertEquals(expectedOutputLength, outputCnt);
if (expectedOutputLength != outputCnt) {
allPass.set(false);
}
} catch (SQLException e) {
fail(e.getMessage());
allPass.set(false);
}
}
} catch (Exception e) {
fail(e.getMessage());
allPass.set(false);
}
});
threads[i].start();
Expand All @@ -129,6 +136,7 @@ public static void concurrentInference(
if (thread.isAlive()) {
fail("Thread timeout after 10 minutes");
}
Assert.assertTrue(allPass.get());
}
}

Expand Down
Loading