RunningDockerConfig
#
- class ansys.dpf.core.server_factory.RunningDockerConfig(docker_config: DockerConfig = None, server_id: int = None, docker_server_port: int = None)#
Holds all the configuration options and the process information of a running Docker image of a DPF server.
- Parameters:
docker_config (DockerConfig, optional) –
DockerConfig
used to start the docker.server_id (int, optional) – Running Docker Container id.
docker_server_port (int, optional) – Local port exposed to the docker image.
Overview#
Replace local path found in the list of mounted volumes by their mounted path in the docker. |
|
Stop and Removes the Docker image with its id==server_id. |
|
Search inside the Docker Container stdout log to fill in this instance’s attributes. |
|
Return a docker run command using DockerConfig attributes and specified ports. |
Whether the DPF server should be started in a Docker Container by default. |
|
Port used inside the Docker Container to run the gRPC server. |
|
Running Docker Container id. |
|
Name of Docker running Image. |
|
Dictionary of local path to docker path of volumes mounted in the Docker Image. |
|
Extra arguments used in the |
Return a string representation of the RunningDockerConfig instance. |
Import detail#
from ansys.dpf.core.server_factory import RunningDockerConfig
Property detail#
- property RunningDockerConfig.use_docker: bool#
Whether the DPF server should be started in a Docker Container by default.
- Return type:
bool
- property RunningDockerConfig.docker_server_port: int#
Port used inside the Docker Container to run the gRPC server.
- Return type:
int
- property RunningDockerConfig.server_id: int#
Running Docker Container id.
- Return type:
int
- property RunningDockerConfig.docker_name: str#
Name of Docker running Image.
- Return type:
str
- property RunningDockerConfig.mounted_volumes: dict#
Dictionary of local path to docker path of volumes mounted in the Docker Image.
These paths are checked for when result files are looked for by the server to prevent from uploading them.
- Return type:
dict
- property RunningDockerConfig.extra_args: str#
Extra arguments used in the
docker run
command.- Return type:
str
Method detail#
- RunningDockerConfig.replace_with_mounted_volumes(path: str) str #
Replace local path found in the list of mounted volumes by their mounted path in the docker.
- Parameters:
path (str) – Path to search for occurrences of mounted volumes.
- Returns:
path
- Return type:
str
- RunningDockerConfig.remove_docker_image() None #
Stop and Removes the Docker image with its id==server_id.
- RunningDockerConfig.listen_to_process(log: logging.Logger, cmd_lines: list, lines: list, timeout: float, stdout: bool = True) None #
Search inside the Docker Container stdout log to fill in this instance’s attributes.
- Parameters:
log – Instance of
logging
to add debug info to.cmd_lines (list) – Stdout of the shell process run
docker run
command.lines (list) – Internal Container’s stdout are copied into
lines
.timeout (float) – When to stop searching for stdout.
stdout (bool, optional) – Whether to check stdout or stderr.
- RunningDockerConfig.docker_run_cmd_command(docker_server_port: int, local_port: int) str #
Return a 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
- RunningDockerConfig.__str__()#
Return a string representation of the RunningDockerConfig instance.
This method provides a human-readable string summarizing the docker configuration, and the server id.
- Returns:
String representation of the RunningDockerConfig instance.
- Return type:
str