Skip to content

Commit c9fe712

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]> (cherry picked from commit 38bbcca) Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 78dbb4a commit c9fe712

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
@@ -87,12 +87,17 @@ def run_individual_python_test(target_dir, test_name, pyspark_python):
8787
tmp_dir = os.path.join(target_dir, str(uuid.uuid4()))
8888
os.mkdir(tmp_dir)
8989
env["TMPDIR"] = tmp_dir
90+
metastore_dir = os.path.join(tmp_dir, str(uuid.uuid4()))
91+
while os.path.isdir(metastore_dir):
92+
metastore_dir = os.path.join(metastore_dir, str(uuid.uuid4()))
93+
os.mkdir(metastore_dir)
9094

9195
# Also override the JVM's temp directory by setting driver and executor options.
9296
java_options = "-Djava.io.tmpdir={0} -Dio.netty.tryReflectionSetAccessible=true".format(tmp_dir)
9397
spark_args = [
9498
"--conf", "spark.driver.extraJavaOptions='{0}'".format(java_options),
9599
"--conf", "spark.executor.extraJavaOptions='{0}'".format(java_options),
100+
"--conf", "spark.sql.warehouse.dir='{0}'".format(metastore_dir),
96101
"pyspark-shell"
97102
]
98103
env["PYSPARK_SUBMIT_ARGS"] = " ".join(spark_args)

0 commit comments

Comments
 (0)