DockerConfig
#
- class ansys.dpf.core.server_factory.DockerConfig(use_docker: bool = False, docker_name: str = '', mounted_volumes: dict = None, extra_args: str = '')#
Manage DPF Docker configuration and communication.
Intermediate class encapsulating all the configuration options needed to run a docker image of DPF and holding tools to communicate with Docker.
- Parameters:
use_docker (bool, optional) – Whether the DPF server should be started in a Docker Container by default.
docker_name (str, optional) – Name of Docker Image to run.
mounted_volumes (dict, optional) – Dictionary of key = local path and value = path of mounted volumes in the Docker Image. To prevent from uploading result files on the Docker Image
ansys.dpc.core.server_factory.RunningDockerConfig.replace_with_mounted_volumes()
iterates through this dictionary to replace local path instances by their mapped value.extra_args (str, optional) – Extra arguments to add to the docker run command.
Overview#
Build the Docker run command using DockerConfig attributes and specified ports. |
Whether the DPF server should be started in a Docker Container by default. |
|
Name of Docker Image to run. |
|
Dictionary of key = local path and value = path of mounted volumes in the Docker Image. |
|
Generate licensing-related environment variables for the Docker container. |
|
Extra arguments to add to the docker run command. |
Check available internal docker_server_port from the stdout of running Docker containers. |
Return a string representation of the DockerConfig object. |
Import detail#
from ansys.dpf.core.server_factory import DockerConfig
Property detail#
- property DockerConfig.use_docker: bool#
Whether the DPF server should be started in a Docker Container by default.
- Return type:
bool
- property DockerConfig.docker_name: str#
Name of Docker Image to run.
- Return type:
str
- property DockerConfig.mounted_volumes: dict#
Dictionary of key = local path and value = path of mounted volumes in the Docker Image.
To prevent from uploading result files on the Docker Image
ansys.dpc.core.server_factory.RunningDockerConfig.replace_with_mounted_volumes()
iterates through this dictionary to replace local path instances by their mapped value.- Return type:
dict
- property DockerConfig.licensing_args: str#
Generate licensing-related environment variables for the Docker container.
- Returns:
String containing Docker environment variable settings for licensing, including acceptance of license agreements and licensing file path.
- Return type:
str
- property DockerConfig.extra_args: str#
Extra arguments to add to the docker run command.
- Return type:
str
Method detail#
- DockerConfig.docker_run_cmd_command(docker_server_port: int, local_port: int) str #
Build the Docker run command using DockerConfig attributes and specified ports.
Creates the docker run command with the
DockerConfig
attributes as well as thedocker_server_port
andlocal_port
passed in as parameters.- Parameters:
docker_server_port (int) – Port used inside the Docker Container to run the gRPC server.
local_port (int) – Port exposed outside the Docker container bounded to the internal
docker_server_port
.
- Return type:
str
- DockerConfig.__str__()#
Return a string representation of the DockerConfig object.
Includes information about whether Docker is used, the Docker image name, mounted volumes, and any extra arguments.
- Returns:
Formatted string representation of the DockerConfig instance.
- Return type:
str
- static DockerConfig.find_port_available_for_docker_bind(port: int) int #
Check available internal docker_server_port from the stdout of running Docker containers.
- Parameters:
port (int)
- Returns:
port
- Return type:
int