Skip to content

Commit cc47ffa

Browse files
Added making a temp folder for cases where multiple instance are running on the same machine
1 parent 0a0f246 commit cc47ffa

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pyclowder/connectors.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@ def _prepare_dataset(self, host, secret_key, resource):
247247
tmp_files_created = []
248248
tmp_dirs_created = []
249249

250+
# Create a temporary folder to hold any links to local files we may need
251+
temp_link_dir = tempfile.mkdtemp()
252+
tmp_dirs_created.append(temp_link_dir)
253+
250254
# first check if any files in dataset accessible locally
251255
ds_file_list = pyclowder.datasets.get_file_list(self, host, secret_key, resource["id"])
252256
for ds_file in ds_file_list:
@@ -256,7 +260,7 @@ def _prepare_dataset(self, host, secret_key, resource):
256260
else:
257261
# Create a link to the original file if the "true" name of the file doesn't match what's on disk
258262
if not file_path.lower().endswith(ds_file['filename'].lower()):
259-
ln_name = io.join_paths(tempfile.gettempdir(), ds_file['filename'])
263+
ln_name = io.path.join(temp_link_dir, ds_file['filename'])
260264
os.symlink(file_path, ln_name)
261265
tmp_files_created.append(ln_name)
262266
file_path = ln_name

0 commit comments

Comments
 (0)