mirror of
https://github.com/vale981/ray
synced 2025-03-06 02:21:39 -05:00
[e2e] improve output dir handling (#21906)
Try to clear the result dir before running the e2e.py script, to avoid failures where the directory already exists, or a file cannot be overwritten due to permission issue.
This commit is contained in:
parent
bdf9fa337d
commit
634f897cb6
1 changed files with 10 additions and 4 deletions
|
@ -2125,16 +2125,22 @@ def run_test_config(
|
|||
f"{out_dir}")
|
||||
|
||||
try:
|
||||
shutil.rmtree(out_dir, ignore_errors=True)
|
||||
shutil.rmtree(out_dir)
|
||||
except Exception:
|
||||
logger.exception(
|
||||
f"Ran into error when clearing the destination dir: {out_dir}")
|
||||
|
||||
try:
|
||||
# Use distutils.dir_util.copy_tree() instead of shutil.cptree(),
|
||||
# which allows existing output directory.
|
||||
from distutils.dir_util import copy_tree
|
||||
copy_tree(temp_dir, out_dir)
|
||||
logger.info(f"Dir contents: {os.listdir(out_dir)}")
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
logger.exception(
|
||||
"Ran into error when copying results dir to persistent "
|
||||
f"location: {str(e)}")
|
||||
f"location: {out_dir}")
|
||||
|
||||
logger.info(f"Dir contents: {os.listdir(out_dir)}")
|
||||
|
||||
return result
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue