Skip to content

Commit 38bbcca

Browse files
HyukjinKwondongjoon-hyun
authored andcommitted
[SPARK-33869][PYTHON][SQL][TESTS] Have a separate metastore directory for each PySpark test job
### What changes were proposed in this pull request? This PR proposes to have its own metastore directory to avoid potential conflict in catalog operations. ### Why are the changes needed? To make PySpark tests less flaky. ### Does this PR introduce _any_ user-facing change? No, dev-only. ### How was this patch tested? Manually tested by trying some sleeps in #30873. Closes #30875 from HyukjinKwon/SPARK-33869. Authored-by: HyukjinKwon <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 1c77605 commit 38bbcca

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

python/run-tests.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,17 @@ def run_individual_python_test(target_dir, test_name, pyspark_python):
8383
tmp_dir = os.path.join(target_dir, str(uuid.uuid4()))
8484
os.mkdir(tmp_dir)
8585
env["TMPDIR"] = tmp_dir
86+
metastore_dir = os.path.join(tmp_dir, str(uuid.uuid4()))
87+
while os.path.isdir(metastore_dir):
88+
metastore_dir = os.path.join(metastore_dir, str(uuid.uuid4()))
89+
os.mkdir(metastore_dir)
8690

8791
# Also override the JVM's temp directory by setting driver and executor options.
8892
java_options = "-Djava.io.tmpdir={0} -Dio.netty.tryReflectionSetAccessible=true".format(tmp_dir)
8993
spark_args = [
9094
"--conf", "spark.driver.extraJavaOptions='{0}'".format(java_options),
9195
"--conf", "spark.executor.extraJavaOptions='{0}'".format(java_options),
96+
"--conf", "spark.sql.warehouse.dir='{0}'".format(metastore_dir),
9297
"pyspark-shell"
9398
]
9499
env["PYSPARK_SUBMIT_ARGS"] = " ".join(spark_args)

0 commit comments

Comments
 (0)