Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update fluent container mount path and show them using logging #2874

Merged
merged 41 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
f30edfb
fix: Update host_mount_path and examples download path
hpohekar May 29, 2024
289b2a8
show mapped path using logging
hpohekar May 29, 2024
7afa297
update working dir
hpohekar May 29, 2024
bd6f3cb
Merge branch 'main' into fix/refactor_fluent_container_mount_paths
hpohekar May 29, 2024
1d1bde1
Update src/ansys/fluent/core/launcher/fluent_container.py
hpohekar May 29, 2024
1363591
Merge branch 'main' into fix/refactor_fluent_container_mount_paths
hpohekar May 29, 2024
0625cf0
use os.getcwd()
hpohekar May 29, 2024
b5471e7
Merge branch 'fix/refactor_fluent_container_mount_paths' of https://g…
hpohekar May 29, 2024
7cb469c
remove __name__
hpohekar May 29, 2024
b54363f
replace pyfluent.EXAMPLES_PATH with os.getcwd()
hpohekar May 29, 2024
5f5aa6c
replace EXAMPLES_PATH with os.getcwd()
hpohekar May 29, 2024
3b7cfe4
update test_file_transfer_service.py
hpohekar May 29, 2024
16e6f7c
update __init__.py
hpohekar May 29, 2024
982e02e
test fix
hpohekar May 29, 2024
f0ee7f2
Merge branch 'main' into fix/refactor_fluent_container_mount_paths
hpohekar May 29, 2024
4b295d8
test fix 1
hpohekar May 30, 2024
2a93808
Merge branch 'fix/refactor_fluent_container_mount_paths' of https://g…
hpohekar May 30, 2024
6935449
Merge branch 'main' into fix/refactor_fluent_container_mount_paths
hpohekar May 30, 2024
1e41bfa
system coupling fix
hpohekar May 31, 2024
1529e5f
Merge branch 'fix/refactor_fluent_container_mount_paths' of https://g…
hpohekar May 31, 2024
b3bfcc1
Merge branch 'main' into fix/refactor_fluent_container_mount_paths
hpohekar May 31, 2024
ac434aa
Revert "system coupling fix"
hpohekar May 31, 2024
862c9d5
Revert "test fix 1"
hpohekar May 31, 2024
d687def
Revert "test fix"
hpohekar May 31, 2024
55a58e8
Revert "update __init__.py"
hpohekar May 31, 2024
985fbcb
Revert "update test_file_transfer_service.py"
hpohekar May 31, 2024
75ff17e
Revert "replace EXAMPLES_PATH with os.getcwd()"
hpohekar May 31, 2024
5d9a2fc
Revert "replace pyfluent.EXAMPLES_PATH with os.getcwd()"
hpohekar May 31, 2024
7066223
Merge branch 'fix/refactor_fluent_container_mount_paths' of https://g…
hpohekar May 31, 2024
2534bf6
remove download_file changes
hpohekar May 31, 2024
59436cb
configure host_mount_path
hpohekar May 31, 2024
13ebba3
add test to check warning
hpohekar May 31, 2024
809b758
add test to check warning 1
hpohekar May 31, 2024
186cd62
add test to check warning 2
hpohekar May 31, 2024
50a24a9
add module level variable
hpohekar Jun 3, 2024
e4f576f
Update tests/conftest.py
hpohekar Jun 3, 2024
d447415
rename variable
hpohekar Jun 3, 2024
d3ec884
rename variable 1
hpohekar Jun 3, 2024
6fa030e
use env
hpohekar Jun 4, 2024
2887edc
use var
hpohekar Jun 4, 2024
2b88687
Merge branch 'main' into fix/refactor_fluent_container_mount_paths
hpohekar Jun 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/ansys/fluent/core/launcher/fluent_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,11 @@ def configure_container_dict(
if file_transfer_service:
host_mount_path = pyfluent.USER_DATA_PATH
else:
host_mount_path = pyfluent.EXAMPLES_PATH
host_mount_path = (
pyfluent.EXAMPLES_PATH
if os.getenv("LOGNAME") == "ansys"
else os.getcwd()
)
hpohekar marked this conversation as resolved.
Show resolved Hide resolved
elif "volumes" in container_dict:
logger.warning(
"'volumes' keyword specified in 'container_dict', but "
Expand Down Expand Up @@ -228,6 +232,9 @@ def configure_container_dict(
host_mount_path = volumes_string.replace(":" + container_mount_path, "")
logger.debug(f"host_mount_path: {host_mount_path}")
logger.debug(f"container_mount_path: {container_mount_path}")
logger.warning(
f"Starting Fluent container mounted to {host_mount_path}, with this path available as {container_mount_path} for the Fluent session running inside the container."
)
hpohekar marked this conversation as resolved.
Show resolved Hide resolved

if "ports" not in container_dict:
if not port:
Expand Down
12 changes: 12 additions & 0 deletions tests/test_launcher.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from pathlib import Path
import platform

Expand Down Expand Up @@ -450,3 +451,14 @@ def get_processor_count(solver):
# https://github.com/ansys/pyfluent/issues/2624
# with pyfluent.launch_fluent(additional_arguments="-t2") as solver:
# assert get_processor_count(solver) == 2


def test_container_warning_for_host_mount_path(caplog):
if check_docker_support():
solver = pyfluent.launch_fluent()
assert (
"this path available as /mnt/pyfluent for the Fluent session running inside the container."
in caplog.text
)
assert pyfluent.EXAMPLES_PATH in caplog.text
assert os.getcwd() not in caplog.text
hpohekar marked this conversation as resolved.
Show resolved Hide resolved
Loading