From 941ab1359c18e20e5354d91f6dddaaa38cf85a43 Mon Sep 17 00:00:00 2001 From: "paul.profizi" Date: Fri, 5 May 2023 13:32:27 +0200 Subject: [PATCH 1/2] Test if core.make_tmp_dir_server now works --- examples/05-file-IO/00-hdf5_double_float_comparison.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/examples/05-file-IO/00-hdf5_double_float_comparison.py b/examples/05-file-IO/00-hdf5_double_float_comparison.py index 96bc24e1ab..1df96bf3e3 100644 --- a/examples/05-file-IO/00-hdf5_double_float_comparison.py +++ b/examples/05-file-IO/00-hdf5_double_float_comparison.py @@ -15,7 +15,6 @@ # temporary directory. import os -import tempfile from ansys.dpf import core as dpf from ansys.dpf.core import examples @@ -42,7 +41,6 @@ # and displacement). timeIds = list(range(1, model.metadata.time_freq_support.n_sets + 1)) -timeIds stress.inputs.time_scoping.connect(timeIds) displacement.inputs.time_scoping.connect(timeIds) @@ -56,10 +54,7 @@ ############################################################################### # Define a temporary folder for outputs -if dpf.SERVER.local_server: - tmpdir = tempfile.mkdtemp() -else: - tmpdir = "/tmp" +tmpdir = dpf.core.make_tmp_dir_server(dpf.SERVER) files = [ dpf.path_utilities.join(tmpdir, "dpf_float.h5"), dpf.path_utilities.join(tmpdir, "dpf_double.h5"), From 3198fcbab5739b248c454c9e33d1e1d440013eb3 Mon Sep 17 00:00:00 2001 From: "paul.profizi" Date: Fri, 5 May 2023 15:17:09 +0200 Subject: [PATCH 2/2] Test if core.make_tmp_dir_server now works --- examples/05-file-IO/01-reduced_matrices_export.py | 7 +------ examples/05-file-IO/04-basic-load-file.py | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/examples/05-file-IO/01-reduced_matrices_export.py b/examples/05-file-IO/01-reduced_matrices_export.py index 1a1cb99ff4..bb56862c88 100644 --- a/examples/05-file-IO/01-reduced_matrices_export.py +++ b/examples/05-file-IO/01-reduced_matrices_export.py @@ -13,8 +13,6 @@ # Import the ``dpf-core`` module and its examples files, and then create a # temporary directory. -import tempfile - from ansys.dpf import core as dpf from ansys.dpf.core import examples from ansys.dpf.core import operators as ops @@ -38,10 +36,7 @@ ############################################################################### # Define a temporary folder for outputs -if dpf.SERVER.local_server: - tmpdir = tempfile.mkdtemp() -else: - tmpdir = "/tmp/" +tmpdir = dpf.core.make_tmp_dir_server(dpf.SERVER) ############################################################################### # Export the result fields container to an HDF5 file. diff --git a/examples/05-file-IO/04-basic-load-file.py b/examples/05-file-IO/04-basic-load-file.py index 69f479270e..f9aa6db143 100644 --- a/examples/05-file-IO/04-basic-load-file.py +++ b/examples/05-file-IO/04-basic-load-file.py @@ -42,7 +42,7 @@ # Define an output path for the resulting .csv file if not dpf.SERVER.local_server: # Define it server-side if using a remote server - tmp_dir_path = "/tmp/" + tmp_dir_path = dpf.core.make_tmp_dir_server(dpf.SERVER) server_file_path = dpf.path_utilities.join(tmp_dir_path, csv_file_name) else: server_file_path = os.path.join(os.getcwd(), csv_file_name)