Skip to content

Commit

Permalink
refactor: gRPC FTS refactoring 10
Browse files Browse the repository at this point in the history
  • Loading branch information
hpohekar committed Apr 29, 2024
1 parent d0e7b16 commit 68983bf
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/ansys/fluent/core/launcher/fluent_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,7 @@ def configure_container_dict(
if host_mount_path and not os.path.exists(host_mount_path):
Path(host_mount_path).mkdir(parents=True, exist_ok=True)

if not container_mount_path:
container_mount_path = os.getenv(
"PYFLUENT_CONTAINER_MOUNT_PATH", DEFAULT_CONTAINER_MOUNT_PATH
)
elif "volumes" in container_dict:
if container_mount_path and "volumes" in container_dict:
logger.warning(
"'volumes' keyword specified in 'container_dict', but "
"it is going to be overwritten by specified 'container_mount_path'."
Expand All @@ -204,8 +200,8 @@ def configure_container_dict(
container_dict.update(
volumes=(
[f"{host_mount_path}:{container_mount_path}"]
if host_mount_path
else [f"pyfluent_data:{container_mount_path}"]
if (host_mount_path and container_mount_path)
else ["pyfluent_data:/mnt/pyfluent"]
)
)
else:
Expand Down Expand Up @@ -257,7 +253,9 @@ def configure_container_dict(

if "working_dir" not in container_dict:
container_dict.update(
working_dir=container_mount_path,
working_dir=(
container_mount_path if container_mount_path else "/mnt/pyfluent"
),
)

if "command" in container_dict:
Expand All @@ -274,7 +272,9 @@ def configure_container_dict(

if container_server_info_file:
container_server_info_file = (
PurePosixPath(container_mount_path)
PurePosixPath(
container_mount_path if container_mount_path else "/mnt/pyfluent"
)
/ PurePosixPath(container_server_info_file).name
)
else:
Expand All @@ -285,7 +285,10 @@ def configure_container_dict(
)
os.close(fd)
container_server_info_file = (
PurePosixPath(container_mount_path) / Path(sifile).name
PurePosixPath(
container_mount_path if container_mount_path else "/mnt/pyfluent"
)
/ Path(sifile).name
)

if not fluent_image:
Expand Down Expand Up @@ -316,7 +319,7 @@ def configure_container_dict(
container_dict[k] = v

server_info_file_path = (
Path(host_mount_path) if host_mount_path else pyfluent.USER_DATA_PATH
host_mount_path if host_mount_path else pyfluent.USER_DATA_PATH
)

host_server_info_file = (
Expand Down

0 comments on commit 68983bf

Please sign in to comment.