File tree Expand file tree Collapse file tree 4 files changed +17
-20
lines changed
src/ansys/fluent/core/launcher Expand file tree Collapse file tree 4 files changed +17
-20
lines changed Original file line number Diff line number Diff line change @@ -123,15 +123,6 @@ def dict_to_str(dict: dict) -> str:
123
123
"""Converts the dict to string while hiding the 'environment' argument from the dictionary,
124
124
if the environment variable 'PYFLUENT_HIDE_LOG_SECRETS' is '1'.
125
125
This is useful for logging purposes, to avoid printing sensitive information such as license server details.
126
-
127
- Parameters
128
- ----------
129
- dict : dict
130
- The container dictionary to be converted to string.
131
- Returns
132
- -------
133
- string
134
- Nicely formatted string representation of the dictionary, with the 'environment' key removed if hiding secrets.
135
126
"""
136
127
137
128
if "environment" in dict and os .getenv ("PYFLUENT_HIDE_LOG_SECRETS" ) == "1" :
@@ -182,9 +173,12 @@ def configure_container_dict(
182
173
args : List[str]
183
174
List of Fluent launch arguments.
184
175
mount_source : str | Path, optional
185
- Existing path in the host operating system that will be mounted to ``mount_target``.
176
+ Path on the host system to mount into the container. This directory will serve as the working directory
177
+ for the Fluent process inside the container. If not specified, PyFluent's current working directory will
178
+ be used.
186
179
mount_target : str | Path, optional
187
- Path inside the container where ``mount_source`` will be mounted to.
180
+ Path inside the container where ``mount_source`` will be mounted. This will be the working directory path
181
+ visible to the Fluent process running inside the container.
188
182
timeout : int, optional
189
183
Time limit for the Fluent container to start, in seconds. By default, 60 seconds.
190
184
port : int, optional
Original file line number Diff line number Diff line change @@ -661,8 +661,8 @@ def test_builtin_settings(mixing_elbow_case_data_session):
661
661
else :
662
662
with pytest .raises (RuntimeError ):
663
663
CustomVectors (settings_source = solver )
664
- tmp_save_path = tempfile .mkdtemp (dir = pyfluent .EXAMPLES_PATH )
665
- project_file = Path (tmp_save_path ) / "mixing_elbow_param.flprj"
664
+ tmp_save_path = Path ( tempfile .mkdtemp (dir = pyfluent .EXAMPLES_PATH ) )
665
+ project_file = Path (tmp_save_path . parts [ - 1 ] ) / "mixing_elbow_param.flprj"
666
666
solver .settings .parametric_studies .initialize (project_filename = str (project_file ))
667
667
assert ParametricStudies (settings_source = solver ) == solver .parametric_studies
668
668
assert (
Original file line number Diff line number Diff line change @@ -554,10 +554,10 @@ def test_fluent_automatic_transcript(monkeypatch):
554
554
with monkeypatch .context () as m :
555
555
m .setattr (pyfluent , "FLUENT_AUTOMATIC_TRANSCRIPT" , True )
556
556
with TemporaryDirectory (dir = pyfluent .EXAMPLES_PATH ) as tmp_dir :
557
- with pyfluent .launch_fluent (container_dict = dict (working_dir = tmp_dir )):
557
+ with pyfluent .launch_fluent (container_dict = dict (mount_source = tmp_dir )):
558
558
assert list (Path (tmp_dir ).glob ("*.trn" ))
559
559
with TemporaryDirectory (dir = pyfluent .EXAMPLES_PATH ) as tmp_dir :
560
- with pyfluent .launch_fluent (container_dict = dict (working_dir = tmp_dir )):
560
+ with pyfluent .launch_fluent (container_dict = dict (mount_source = tmp_dir )):
561
561
assert not list (Path (tmp_dir ).glob ("*.trn" ))
562
562
563
563
Original file line number Diff line number Diff line change @@ -594,7 +594,6 @@ def test_general_exception_behaviour_in_session(new_solver_session):
594
594
case_file = examples .download_file (
595
595
"mixing_elbow.cas.h5" ,
596
596
"pyfluent/mixing_elbow" ,
597
- return_without_path = False ,
598
597
)
599
598
solver .settings .file .read (file_type = "case" , file_name = case_file )
600
599
solver .file .write (file_name = "sample.cas.h5" , file_type = "case" )
@@ -658,16 +657,20 @@ def test_app_utilities_new_and_old(mixing_elbow_settings_session):
658
657
659
658
assert not solver ._app_utilities .is_solution_data_available ()
660
659
661
- tmp_dir = tempfile .mkdtemp (dir = pyfluent .EXAMPLES_PATH )
660
+ tmp_path = tempfile .mkdtemp (dir = pyfluent .EXAMPLES_PATH )
662
661
663
- solver .chdir (tmp_dir )
662
+ # when running in a container, only the randomly generated folder name will be seen
663
+ # the full paths will be different between host and container
664
+ tmp_folder = Path (tmp_path ).parts [- 1 ]
665
+
666
+ solver .chdir (tmp_folder )
664
667
665
668
cortex_info = solver ._app_utilities .get_controller_process_info ()
666
669
solver_info = solver ._app_utilities .get_solver_process_info ()
667
670
668
- assert Path (cortex_info .working_directory ) == Path ( tmp_dir )
671
+ assert Path (cortex_info .working_directory ). parts [ - 1 ] == tmp_folder
669
672
670
- assert Path (solver_info .working_directory ) == Path ( tmp_dir )
673
+ assert Path (solver_info .working_directory ). parts [ - 1 ] == tmp_folder
671
674
672
675
673
676
@pytest .mark .standalone
You can’t perform that action at this time.
0 commit comments