Skip to content

Commit

Permalink
Add README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
oh2024 committed Aug 6, 2024
1 parent ba71730 commit 6638491
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions tools/validation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The idea of this solution is to run the same query in both online and offline modes in OpenMLDB and compare their results to ensure they produce the same outcome.

Run the test_consistency.sh script in /tmp/ and ensure that the paths for OPENMLDB_BIN_PATH, zk_cluster, and zk_root_path are set correctly.
6 changes: 4 additions & 2 deletions tools/validation/test.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import subprocess
import os
import csv
import sys

openmldb_binary_path = sys.argv[1]
# Execute the offline SQL command
subprocess.run("/work/openmldb/bin/openmldb --zk_cluster=127.0.0.1:2181 --zk_root_path=/openmldb --role=sql_client < offline.sql",
subprocess.run(f"{openmldb_binary_path} --zk_cluster=127.0.0.1:2181 --zk_root_path=/openmldb --role=sql_client < offline.sql",
shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)

# Define the directory containing the CSV files
Expand All @@ -26,7 +28,7 @@
combined_data.append(row)

# Define the command to be executed
command = "/work/openmldb/bin/openmldb --zk_cluster=127.0.0.1:2181 --zk_root_path=/openmldb --role=sql_client < online.sql"
command = f"{openmldb_binary_path} --zk_cluster=127.0.0.1:2181 --zk_root_path=/openmldb --role=sql_client < online.sql"

# Execute the command
try:
Expand Down
5 changes: 3 additions & 2 deletions tools/validation/test_consistency.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/work/openmldb/bin/openmldb --zk_cluster=127.0.0.1:2181 --zk_root_path=/openmldb --role=sql_client < /tmp/prepare_data.sql
python3 test.py
OPENMLDB_BIN_PATH=/work/openmldb/bin/openmldb
$OPENMLDB_BIN_PATH --zk_cluster=127.0.0.1:2181 --zk_root_path=/openmldb --role=sql_client < /tmp/prepare_data.sql
python3 test.py $OPENMLDB_BIN_PATH

0 comments on commit 6638491

Please sign in to comment.