Skip to content

Commit 0907bac

Browse files
add hudi to generate_ctest and run_ctest
1 parent eb61ecb commit 0907bac

File tree

8 files changed

+63
-12
lines changed

8 files changed

+63
-12
lines changed

core/add_project.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ function setup_alluxio() {
4848
mvn clean install -DskipTests -Dcheckstyle.skip -Dlicense.skip -Dfindbugs.skip -Dmaven.javadoc.skip=true
4949
}
5050

51+
function setup_hudi() {
52+
[ ! -d "app/ctest-hudi" ] && git clone https://github.com/jessicahuang523/hudi app/ctest-hudi
53+
cd app/ctest-hudi
54+
git fetch && git checkout ctest-injection
55+
cd hudi-common
56+
mvn clean install -DskipTests -Dcheckstyle.skip
57+
}
58+
5159
function usage() {
5260
echo "Usage: add_project.sh <main project>"
5361
exit 1
@@ -64,7 +72,8 @@ function main() {
6472
hbase) setup_hbase ;;
6573
zookeeper) setup_zookeeper ;;
6674
alluxio) setup_alluxio ;;
67-
*) echo "Unexpected project: $project - only support hadoop, hbase, zookeeper and alluxio." ;;
75+
hudi) setup_hudi ;;
76+
*) echo "Unexpected project: $project - only support hadoop, hbase, zookeeper, alluxio and hudi." ;;
6877
esac
6978
fi
7079
}

core/ctest_const.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,22 @@
1212
HBASE = "hbase-server"
1313
ZOOKEEPER = "zookeeper-server"
1414
ALLUXIO = "alluxio-core"
15+
HUDI = "hudi-common"
1516

1617
CTEST_HADOOP_DIR = os.path.join(APP_DIR, "ctest-hadoop")
1718
CTEST_HBASE_DIR = os.path.join(APP_DIR, "ctest-hbase")
1819
CTEST_ZK_DIR = os.path.join(APP_DIR, "ctest-zookeeper")
1920
CTEST_ALLUXIO_DIR = os.path.join(APP_DIR, "ctest-alluxio")
21+
CTEST_HUDI_DIR = os.path.join(APP_DIR, "ctest-hudi")
22+
2023

2124
PROJECT_DIR = {
2225
HCOMMON: CTEST_HADOOP_DIR,
2326
HDFS: CTEST_HADOOP_DIR,
2427
HBASE: CTEST_HBASE_DIR,
2528
ZOOKEEPER: CTEST_ZK_DIR,
2629
ALLUXIO: CTEST_ALLUXIO_DIR,
30+
HUDI: CTEST_HUDI_DIR
2731
}
2832

2933

@@ -34,6 +38,7 @@
3438
HBASE: "hbase-server",
3539
ZOOKEEPER: "zookeeper-server",
3640
ALLUXIO: "core",
41+
HUDI: "hudi-common"
3742
}
3843

3944

@@ -58,6 +63,7 @@
5863
os.path.join(CTEST_ALLUXIO_DIR, MODULE_SUBDIR[ALLUXIO], "server/worker", SUREFIRE_SUBDIR),
5964
os.path.join(CTEST_ALLUXIO_DIR, MODULE_SUBDIR[ALLUXIO], "server/master", SUREFIRE_SUBDIR),
6065
],
66+
HUDI: [os.path.join(CTEST_HUDI_DIR, MODULE_SUBDIR[HUDI], SUREFIRE_SUBDIR)]
6167
}
6268

6369
# default or deprecate conf path
@@ -74,7 +80,8 @@
7480
HDFS: os.path.join(DEFAULT_CONF_DIR, HDFS + "-default.tsv"),
7581
HBASE: os.path.join(DEFAULT_CONF_DIR, HBASE + "-default.tsv"),
7682
ALLUXIO: os.path.join(DEFAULT_CONF_DIR, ALLUXIO + "-default.tsv"),
77-
ZOOKEEPER: os.path.join(DEFAULT_CONF_DIR, ZOOKEEPER + "-default.tsv")
83+
ZOOKEEPER: os.path.join(DEFAULT_CONF_DIR, ZOOKEEPER + "-default.tsv"),
84+
HUDI: os.path.join(DEFAULT_CONF_DIR, HUDI + "-default.tsv")
7885
}
7986

8087

@@ -96,7 +103,10 @@
96103
],
97104
ALLUXIO: [
98105
os.path.join(CTEST_ALLUXIO_DIR, "core/alluxio-ctest.properties")
99-
]
106+
],
107+
HUDI: [
108+
os.path.join(CTEST_HUDI_DIR, "hudi-common/core-ctest.yaml")
109+
],
100110
}
101111

102112

core/generate_ctest/inject.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ def inject_config(param_value_pairs):
2121
for p, v in param_value_pairs.items():
2222
file.write(p + "=" + v + "\n")
2323
file.close()
24+
elif project in [HUDI]:
25+
for inject_path in INJECTION_PATH[project]:
26+
print(">>>>[ctest_core] injecting into file: {}".format(inject_path))
27+
file = open(inject_path, "w")
28+
for p, v in param_value_pairs.items():
29+
file.write(p + ": " + v + "\n")
30+
file.close()
2431
elif project in [HCOMMON, HDFS, HBASE]:
2532
conf = ET.Element("configuration")
2633
for p, v in param_value_pairs.items():
@@ -41,7 +48,7 @@ def inject_config(param_value_pairs):
4148

4249
def clean_conf_file(project):
4350
print(">>>> cleaning injected configuration from file")
44-
if project in [ZOOKEEPER, ALLUXIO]:
51+
if project in [ZOOKEEPER, ALLUXIO, HUDI]:
4552
for inject_path in INJECTION_PATH[project]:
4653
file = open(inject_path, "w")
4754
file.write("\n")

core/generate_ctest/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_value_pair(test_input):
3333
mt_file = open(os.path.join(GENCTEST_TR_DIR, project, MT_FILE.format(id=param)), "w")
3434

3535
associated_tests = mapping[param] if param in mapping else []
36-
if len(mapping[param]) != 0:
36+
if len(associated_tests) != 0:
3737
for value in values:
3838
tr = run_test_seperate(param, value, associated_tests)
3939

core/generate_ctest/program_input.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
# run mode
55
"run_mode": "generate_ctest", # string
66
# name of the project, i.e. hadoop-common, hadoop-hdfs, see constant.py
7-
"project": "hadoop-common", # string
7+
"project": "hudi-common", # string
88
# path to param -> tests json mapping
9-
"mapping_path": "../../data/ctest_mapping/opensource-hadoop-common.json", # string
9+
"mapping_path": "../../data/ctest_mapping/opensource-hudi-common.json", # string
1010
# good values of params tests will be run against
11-
"param_value_tsv": "sample-hadoop-common.tsv", # string
11+
"param_value_tsv": "hudi-common-generated-values.tsv", # string
1212
# display the terminal output live, without saving any results
1313
"display_mode": False, # bool
1414
# whether to use mvn test or mvn surefire:test

core/run_ctest/inject.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ def inject_config(param_value_pairs):
2121
for p, v in param_value_pairs.items():
2222
file.write(p + "=" + v + "\n")
2323
file.close()
24+
elif project in [HUDI]:
25+
for inject_path in INJECTION_PATH[project]:
26+
print(">>>>[ctest_core] injecting into file: {}".format(inject_path))
27+
file = open(inject_path, "w")
28+
for p, v in param_value_pairs.items():
29+
file.write(p + ": " + v + "\n")
30+
file.close()
2431
elif project in [HCOMMON, HDFS, HBASE]:
2532
conf = ET.Element("configuration")
2633
for p, v in param_value_pairs.items():
@@ -41,7 +48,7 @@ def inject_config(param_value_pairs):
4148

4249
def clean_conf_file(project):
4350
print(">>>> cleaning injected configuration from file")
44-
if project in [ZOOKEEPER, ALLUXIO]:
51+
if project in [ZOOKEEPER, ALLUXIO, HUDI]:
4552
for inject_path in INJECTION_PATH[project]:
4653
file = open(inject_path, "w")
4754
file.write("\n")

core/run_ctest/parse_input.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ def parse_conf_file(path):
4545
# parsing for alluxio and zookeeper conf file format
4646
if "no default configuration file" in path:
4747
return {}
48+
if project in [HUDI]:
49+
return parse_conf_file_yaml(path)
4850
return parse_conf_file_properties(path)
4951

5052

@@ -89,6 +91,22 @@ def parse_conf_file_properties(path):
8991
conf_map[cur_key] = cur_value
9092
return conf_map
9193

94+
def parse_conf_file_yaml(path):
95+
deprecate_conf = load_deprecate_config_map()
96+
conf_map = {}
97+
for line in open(path):
98+
if line.startswith("#"):
99+
continue
100+
seg = line.strip("\n").split(": ")
101+
if len(seg) == 2:
102+
cur_key, cur_value = [x.strip() for x in seg]
103+
if cur_key not in conf_map:
104+
if cur_key in deprecate_conf:
105+
print(">>>>[ctest_core] {} in your input conf file is deprecated in the project,".format(cur_key)
106+
+ " replaced with {}".format(deprecate_conf[cur_key]))
107+
cur_key = deprecate_conf[cur_key]
108+
conf_map[cur_key] = cur_value
109+
return conf_map
92110

93111
def extract_conf_diff(path):
94112
"""get the config diff"""

core/run_ctest/program_input.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
# run mode
55
"run_mode": "run_ctest", # string
66
# name of the project, i.e. hadoop-common, hadoop-hdfs
7-
"project": "hadoop-common", # string
7+
"project": "hudi-common", # string
88
# path to param -> tests json mapping
9-
"mapping_path": "../../data/ctest_mapping/opensource-hadoop-common.json", # string
9+
"mapping_path": "../../data/ctest_mapping/opensource-hudi-common.json", # string
1010
# input directory hosting configuration files to be test, target-project-format specific
11-
"conf_file_dir": "sample-hadoop-common", # string
11+
"conf_file_dir": "hudi-common", # string
1212
# display the terminal output live, without saving any results
1313
"display_mode": False, # bool
1414
# whether to use mvn test or mvn surefire:test

0 commit comments

Comments
 (0)