HyukjinKwon opened a new pull request, #45298:
URL: https://github.com/apache/spark/pull/45298

   ### What changes were proposed in this pull request?
   
   This PR proposes to set `prefix` for `TemporaryDirectory` to deflake the 
tests. Sometimes the test fail because the temporary directory names are same 
(https://github.com/apache/spark/actions/runs/8066850485/job/22036007390).
   
   ```
   File "/__w/spark/spark/python/pyspark/sql/dataframe.py", line ?, in 
pyspark.sql.dataframe.DataFrame.writeStream
   Failed example:
       with tempfile.TemporaryDirectory() as d:
           # Create a table with Rate source.
           df.writeStream.toTable(
               "my_table", checkpointLocation=d)
   Exception raised:
       Traceback (most recent call last):
         File "/usr/lib/python3.11/doctest.py", line 1353, in __run
           exec(compile(example.source, filename, "single",
         File "<doctest pyspark.sql.dataframe.DataFrame.writeStream[3]>", line 
1, in <module>
           with tempfile.TemporaryDirectory() as d:
         File "/usr/lib/python3.11/tempfile.py", line 1043, in __exit__
           self.cleanup()
         File "/usr/lib/python3.11/tempfile.py", line 1047, in cleanup
           self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
         File "/usr/lib/python3.11/tempfile.py", line 1029, in _rmtree
           _rmtree(name, onerror=onerror)
         File "/usr/lib/python3.11/shutil.py", line 738, in rmtree
           onerror(os.rmdir, path, sys.exc_info())
         File "/usr/lib/python3.11/shutil.py", line 736, in rmtree
           os.rmdir(path, dir_fd=dir_fd)
       OSError: [Errno 39] Directory not empty: 
'/__w/spark/spark/python/target/4f062b09-213f-4ac2-a10a-2d704990141b/tmp29irqweq'
   ```
   
   ### Why are the changes needed?
   
   To make the tests more robust.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No, test-only. There's a bit of user-facing documentation change but pretty 
trivial.
   
   ### How was this patch tested?
   
   Manually tested. CI in this PR should test them out as well.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   No.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to