Skip to content

Commit 4c26ef0

Browse files
authored
[Localhost] Potential fix for _copy_lithops_to_tmp (#1442)
1 parent a9d173b commit 4c26ef0

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lithops/localhost/v1/localhost.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,9 @@ def _copy_lithops_to_tmp(self):
213213
if is_lithops_worker() and os.path.isfile(RUNNER_FILE):
214214
return
215215
os.makedirs(LITHOPS_TEMP_DIR, exist_ok=True)
216-
shutil.rmtree(os.path.join(LITHOPS_TEMP_DIR, 'lithops'), ignore_errors=True)
217-
shutil.copytree(LITHOPS_LOCATION, os.path.join(LITHOPS_TEMP_DIR, 'lithops'))
216+
dst_path = os.path.join(LITHOPS_TEMP_DIR, 'lithops')
217+
shutil.rmtree(dst_path, ignore_errors=True)
218+
shutil.copytree(LITHOPS_LOCATION, dst_path, dirs_exist_ok=True)
218219
src_handler = os.path.join(LITHOPS_LOCATION, 'localhost', 'v1', 'runner.py')
219220
copyfile(src_handler, RUNNER_FILE)
220221

lithops/localhost/v2/localhost.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,9 @@ def _copy_lithops_to_tmp(self):
204204
if is_lithops_worker() and os.path.isfile(RUNNER_FILE):
205205
return
206206
os.makedirs(LITHOPS_TEMP_DIR, exist_ok=True)
207-
shutil.rmtree(os.path.join(LITHOPS_TEMP_DIR, 'lithops'), ignore_errors=True)
208-
shutil.copytree(LITHOPS_LOCATION, os.path.join(LITHOPS_TEMP_DIR, 'lithops'))
207+
dst_path = os.path.join(LITHOPS_TEMP_DIR, 'lithops')
208+
shutil.rmtree(dst_path, ignore_errors=True)
209+
shutil.copytree(LITHOPS_LOCATION, dst_path, dirs_exist_ok=True)
209210
src_handler = os.path.join(LITHOPS_LOCATION, 'localhost', 'v2', 'runner.py')
210211
copyfile(src_handler, RUNNER_FILE)
211212

0 commit comments

Comments
 (0)