Fluent container launcher#
Provides a module for launching and configuring local Fluent Docker container runs.
Notes#
For configuration details, see configure_container_dict()
, and for a list of additional Docker container run
configuration options that can also be specified through the
container_dict
argument for launch_fluent()
,
see documentation for Docker run.
For the Fluent Docker container to be able to find license information, the license file or server needs to be specified
through the ANSYSLMD_LICENSE_FILE
environment variable,
or the license_server
argument for the container_dict
(see configure_container_dict()
).
Examples#
Launching a Fluent Docker container with system default configuration:
>>> import ansys.fluent.core as pyfluent
>>> session = pyfluent.launch_fluent(start_container=True)
Launching with custom configuration, using host_mount_path
and fluent_image
which are arguments for configure_container_dict()
, and auto_remove
which is an argument for Docker run:
>>> import ansys.fluent.core as pyfluent
>>> custom_config = {}
>>> custom_config.update(fluent_image='custom_fluent:v23.1.0', host_mount_path='/testing', auto_remove=False)
>>> session = pyfluent.launch_fluent(container_dict=custom_config)
Getting default Fluent Docker container configuration, then launching with customized configuration:
>>> import ansys.fluent.core as pyfluent
>>> config_dict = pyfluent.launch_fluent(start_container=True, dry_run=True)
Docker container run configuration information:
config_dict =
{'auto_remove': True,
'command': ['-gu', '-sifile=/mnt/pyfluent/serverinfo-lpqsdldw.txt', '3ddp'],
'detach': True,
'environment': {'ANSYSLMD_LICENSE_FILE': '2048@licenseserver.com',
'REMOTING_PORTS': '54000/portspan=2'},
'fluent_image': 'ghcr.io/ansys/pyfluent:v23.2.0',
'labels': {'test_name': 'none'},
'ports': {'54000': 54000},
'volumes': ['/home/user/.local/share/ansys_fluent_core/examples:/mnt/pyfluent'],
'working_dir': '/mnt/pyfluent'}
>>> config_dict.update(image_name='custom_fluent', image_tag='v23.1.0', mem_limit='1g')
>>> session = pyfluent.launch_fluent(container_dict=config_dict)
Functions:
|
Parses the parameters listed below, and sets up the container configuration file. |
|
Start a Fluent container. |
- ansys.fluent.core.launcher.fluent_container.configure_container_dict(args, host_mount_path=None, container_mount_path=None, timeout=60, port=None, license_server=None, container_server_info_file=None, remove_server_info_file=True, fluent_image=None, image_name=None, image_tag=None, **container_dict)#
Parses the parameters listed below, and sets up the container configuration file.
- Parameters:
- args
List
[str
] List of Fluent launch arguments.
- host_mount_path
Union
[str
,Path
],optional
Existing path in the host operating system that will be available inside the container.
- container_mount_path
Union
[str
,Path
],optional
Path inside the container where host mount path will be mounted to.
- timeout
int
,optional
Time limit for the Fluent container to start, in seconds. By default, 30 seconds.
- port
int
,optional
Port for Fluent container to use.
- license_server
str
,optional
License server for Ansys Fluent to use.
- container_server_info_file
Union
[str
,Path
],optional
Name of the server information file for Fluent to write on the
host_mount_path
.- remove_server_info_filebool,
optional
Defaults to True, and automatically deletes the server information file after PyFluent has finished using it.
- fluent_image
str
,optional
Specifies full image name for Docker container run, with the format
"image_name:image_tag"
.image_tag
andimage_name
are ignored iffluent_image
has been specified.- image_name
str
,optional
Ignored if
fluent_image
has been specified.- image_tag
str
,optional
Ignored if
fluent_image
has been specified.- **container_dict
Additional keyword arguments can be specified, they will be treated as Docker container run options to be passed directly to the Docker run execution. See examples below and Docker run documentation.
- args
- Returns:
Notes
This function should usually not be called directly, it is automatically used by
launch_fluent()
.For a list of additional Docker container run configuration options that can also be specified using
container_dict
, see Docker run documentation.See also
start_fluent_container()
.
- ansys.fluent.core.launcher.fluent_container.start_fluent_container(args, container_dict=None)#
Start a Fluent container.
- Parameters:
- Returns:
Notes
Uses
configure_container_dict()
to parse the optionalcontainer_dict
configuration.This function should usually not be called directly, it is automatically used by
launch_fluent()
.