From 227ae46dc1ccf63f58278e1466709ab589698930 Mon Sep 17 00:00:00 2001 From: moe-ad Date: Mon, 6 Oct 2025 02:30:45 +0200 Subject: [PATCH 01/20] feat: changes to test windows container --- src/ansys/dpf/core/server.py | 4 ++-- src/ansys/dpf/core/server_factory.py | 3 ++- src/ansys/dpf/core/server_types.py | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/ansys/dpf/core/server.py b/src/ansys/dpf/core/server.py index fc14a0ac595..61766fd5eda 100644 --- a/src/ansys/dpf/core/server.py +++ b/src/ansys/dpf/core/server.py @@ -164,7 +164,7 @@ def start_local_server( load_operators=True, use_docker_by_default=True, docker_config=RUNNING_DOCKER, - timeout=20.0, + timeout=100.0, config=None, use_pypim_by_default=True, context=None, @@ -310,7 +310,7 @@ def connect_to_server( ip=LOCALHOST, port=DPF_DEFAULT_PORT, as_global=True, - timeout=10.0, + timeout=100.0, config=None, context=None, ): diff --git a/src/ansys/dpf/core/server_factory.py b/src/ansys/dpf/core/server_factory.py index 2be2f8a069d..6556e223693 100644 --- a/src/ansys/dpf/core/server_factory.py +++ b/src/ansys/dpf/core/server_factory.py @@ -91,7 +91,8 @@ def __init__( from ansys.dpf.core import LOCAL_DOWNLOADED_EXAMPLES_PATH if mounted_volumes is None: - mounted_volumes = {LOCAL_DOWNLOADED_EXAMPLES_PATH: "/tmp/downloaded_examples"} + # mounted_volumes = {LOCAL_DOWNLOADED_EXAMPLES_PATH: "/tmp/downloaded_examples"} + mounted_volumes = {LOCAL_DOWNLOADED_EXAMPLES_PATH: "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Temp\\downloaded_examples"} self._use_docker = use_docker self._docker_name = docker_name diff --git a/src/ansys/dpf/core/server_types.py b/src/ansys/dpf/core/server_types.py index 05964171502..116a26f4d89 100644 --- a/src/ansys/dpf/core/server_types.py +++ b/src/ansys/dpf/core/server_types.py @@ -222,7 +222,7 @@ def read_stdout(): def launch_dpf( - ansys_path, ip=LOCALHOST, port=DPF_DEFAULT_PORT, timeout=10, context: ServerContext = None + ansys_path, ip=LOCALHOST, port=DPF_DEFAULT_PORT, timeout=100, context: ServerContext = None ): """Launch Ansys DPF. @@ -258,7 +258,7 @@ def launch_dpf_on_docker( ansys_path=None, ip=LOCALHOST, port=DPF_DEFAULT_PORT, - timeout=10.0, + timeout=100.0, ): """Launch Ansys DPF. @@ -791,7 +791,7 @@ def __init__( ansys_path: Union[str, None] = None, ip: str = LOCALHOST, port: str = DPF_DEFAULT_PORT, - timeout: float = 10.0, + timeout: float = 100.0, as_global: bool = True, load_operators: bool = True, launch_server: bool = True, @@ -1222,7 +1222,7 @@ def __init__( ansys_path: Union[str, None] = None, ip: str = LOCALHOST, port: str = DPF_DEFAULT_PORT, - timeout: float = 5.0, + timeout: float = 100.0, as_global: bool = True, load_operators: bool = True, launch_server: bool = True, From 7488043f8cd523328cfaa6f8f1fe058468231597 Mon Sep 17 00:00:00 2001 From: moe-ad Date: Mon, 13 Oct 2025 09:57:55 +0200 Subject: [PATCH 02/20] feat: detect container image and revise timeout values --- src/ansys/dpf/core/server.py | 4 ++-- src/ansys/dpf/core/server_factory.py | 17 ++++++++++++++--- src/ansys/dpf/core/server_types.py | 10 ++++------ 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/ansys/dpf/core/server.py b/src/ansys/dpf/core/server.py index 61766fd5eda..fc14a0ac595 100644 --- a/src/ansys/dpf/core/server.py +++ b/src/ansys/dpf/core/server.py @@ -164,7 +164,7 @@ def start_local_server( load_operators=True, use_docker_by_default=True, docker_config=RUNNING_DOCKER, - timeout=100.0, + timeout=20.0, config=None, use_pypim_by_default=True, context=None, @@ -310,7 +310,7 @@ def connect_to_server( ip=LOCALHOST, port=DPF_DEFAULT_PORT, as_global=True, - timeout=100.0, + timeout=10.0, config=None, context=None, ): diff --git a/src/ansys/dpf/core/server_factory.py b/src/ansys/dpf/core/server_factory.py index 6556e223693..6c954415d48 100644 --- a/src/ansys/dpf/core/server_factory.py +++ b/src/ansys/dpf/core/server_factory.py @@ -32,6 +32,7 @@ import os import subprocess import time +import json from ansys.dpf.gate.load_api import ( _find_outdated_ansys_version, @@ -90,9 +91,19 @@ def __init__( ): from ansys.dpf.core import LOCAL_DOWNLOADED_EXAMPLES_PATH - if mounted_volumes is None: - # mounted_volumes = {LOCAL_DOWNLOADED_EXAMPLES_PATH: "/tmp/downloaded_examples"} - mounted_volumes = {LOCAL_DOWNLOADED_EXAMPLES_PATH: "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Temp\\downloaded_examples"} + if use_docker: + args = ['docker', 'inspect', '-f', 'json', docker_name] + inspect_docker_image = subprocess.run(args, capture_output=True) + if inspect_docker_image.stderr: + raise Exception(f"Specified docker image not found. Verify that the image name '{docker_name}' is valid and the image file is available locally.") + + output = json.loads(inspect_docker_image.stdout) + image_os = output[0]['Os'] + if mounted_volumes is None: + if image_os == 'linux': + mounted_volumes = {LOCAL_DOWNLOADED_EXAMPLES_PATH: "/tmp/downloaded_examples"} + else: # image is windows + mounted_volumes = {LOCAL_DOWNLOADED_EXAMPLES_PATH: "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Temp\\downloaded_examples"} self._use_docker = use_docker self._docker_name = docker_name diff --git a/src/ansys/dpf/core/server_types.py b/src/ansys/dpf/core/server_types.py index 116a26f4d89..686f4ec496d 100644 --- a/src/ansys/dpf/core/server_types.py +++ b/src/ansys/dpf/core/server_types.py @@ -222,7 +222,7 @@ def read_stdout(): def launch_dpf( - ansys_path, ip=LOCALHOST, port=DPF_DEFAULT_PORT, timeout=100, context: ServerContext = None + ansys_path, ip=LOCALHOST, port=DPF_DEFAULT_PORT, timeout=10, context: ServerContext = None ): """Launch Ansys DPF. @@ -258,7 +258,7 @@ def launch_dpf_on_docker( ansys_path=None, ip=LOCALHOST, port=DPF_DEFAULT_PORT, - timeout=100.0, + timeout=50.0, ): """Launch Ansys DPF. @@ -277,7 +277,7 @@ def launch_dpf_on_docker( ``"DPF_DEFAULT_PORT"``, which is 50054. timeout : float, optional Maximum number of seconds for the initialization attempt. - The default is ``10``. Once the specified number of seconds + The default is ``50``. Once the specified number of seconds passes, the connection fails. """ @@ -791,7 +791,7 @@ def __init__( ansys_path: Union[str, None] = None, ip: str = LOCALHOST, port: str = DPF_DEFAULT_PORT, - timeout: float = 100.0, + timeout: float = 10.0, as_global: bool = True, load_operators: bool = True, launch_server: bool = True, @@ -836,7 +836,6 @@ def __init__( ansys_path=ansys_path, ip=ip, port=port, - timeout=timeout, ) else: launch_dpf(ansys_path, ip, port, timeout=timeout, context=context) @@ -1271,7 +1270,6 @@ def __init__( ansys_path=ansys_path, ip=ip, port=port, - timeout=timeout, ) else: launch_dpf(ansys_path, ip, port, timeout=timeout, context=context) From 26197d4904863984159a09fa90cf7ea3f645727a Mon Sep 17 00:00:00 2001 From: moe-ad Date: Mon, 13 Oct 2025 10:14:43 +0200 Subject: [PATCH 03/20] fix: codestyle --- src/ansys/dpf/core/server_factory.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/ansys/dpf/core/server_factory.py b/src/ansys/dpf/core/server_factory.py index 6c954415d48..56c1c8d7207 100644 --- a/src/ansys/dpf/core/server_factory.py +++ b/src/ansys/dpf/core/server_factory.py @@ -28,11 +28,11 @@ """ import io +import json import logging import os import subprocess import time -import json from ansys.dpf.gate.load_api import ( _find_outdated_ansys_version, @@ -92,18 +92,22 @@ def __init__( from ansys.dpf.core import LOCAL_DOWNLOADED_EXAMPLES_PATH if use_docker: - args = ['docker', 'inspect', '-f', 'json', docker_name] + args = ["docker", "inspect", "-f", "json", docker_name] inspect_docker_image = subprocess.run(args, capture_output=True) if inspect_docker_image.stderr: - raise Exception(f"Specified docker image not found. Verify that the image name '{docker_name}' is valid and the image file is available locally.") + raise Exception( + f"Specified docker image not found. Verify that the image name '{docker_name}' is valid and the image file is available locally." + ) output = json.loads(inspect_docker_image.stdout) - image_os = output[0]['Os'] + image_os = output[0]["Os"] if mounted_volumes is None: - if image_os == 'linux': + if image_os == "linux": mounted_volumes = {LOCAL_DOWNLOADED_EXAMPLES_PATH: "/tmp/downloaded_examples"} - else: # image is windows - mounted_volumes = {LOCAL_DOWNLOADED_EXAMPLES_PATH: "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Temp\\downloaded_examples"} + else: # image is windows + mounted_volumes = { + LOCAL_DOWNLOADED_EXAMPLES_PATH: "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Temp\\downloaded_examples" + } self._use_docker = use_docker self._docker_name = docker_name From 0ab75a4234959623536aa89a7ce3e77556d2481e Mon Sep 17 00:00:00 2001 From: moe-ad Date: Mon, 13 Oct 2025 10:16:36 +0200 Subject: [PATCH 04/20] feat: revise timeout value --- src/ansys/dpf/core/server_types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/dpf/core/server_types.py b/src/ansys/dpf/core/server_types.py index 686f4ec496d..5e2fd047d47 100644 --- a/src/ansys/dpf/core/server_types.py +++ b/src/ansys/dpf/core/server_types.py @@ -1221,7 +1221,7 @@ def __init__( ansys_path: Union[str, None] = None, ip: str = LOCALHOST, port: str = DPF_DEFAULT_PORT, - timeout: float = 100.0, + timeout: float = 5.0, as_global: bool = True, load_operators: bool = True, launch_server: bool = True, From 0825d7ee1ffce19125e815843c0e2bf5c5426666 Mon Sep 17 00:00:00 2001 From: moe-ad Date: Mon, 13 Oct 2025 10:47:21 +0200 Subject: [PATCH 05/20] feat: test linux images --- .github/workflows/test_docker.yml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_docker.yml b/.github/workflows/test_docker.yml index 6470e81fe8a..05ee718695d 100644 --- a/.github/workflows/test_docker.yml +++ b/.github/workflows/test_docker.yml @@ -30,6 +30,7 @@ env: MODULE: core ANSYS_DPF_ACCEPT_LA: Y ANSYSLMD_LICENSE_FILE: 1055@${{secrets.LICENSE_SERVER}} + DPF_DOCKER: ghcr.io/ansys-dpf/dpf-standalone:linux-25.1 jobs: docker_tests: @@ -79,13 +80,26 @@ jobs: run: | pip install dist/${{ steps.wheel.outputs.wheel_name }}[graphics] - - name: "Install DPF" - id: set-server-path - uses: ansys/pydpf-actions/install-dpf-docker@v2.3 + # - name: "Install DPF" + # id: set-server-path + # uses: ansys/pydpf-actions/install-dpf-docker@v2.3 + # with: + # dpf-standalone-TOKEN: ${{secrets.PYANSYS_CI_BOT_TOKEN}} + # standalone_suffix: ${{ inputs.standalone_suffix }} + # ANSYS_VERSION : ${{ inputs.ANSYS_VERSION || vars.ANSYS_VERSION_DEFAULT }} + + - name: "Login to Github Container Registry" + uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 with: - dpf-standalone-TOKEN: ${{secrets.PYANSYS_CI_BOT_TOKEN}} - standalone_suffix: ${{ inputs.standalone_suffix }} - ANSYS_VERSION : ${{ inputs.ANSYS_VERSION || vars.ANSYS_VERSION_DEFAULT }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Download DPF docker container + env: + IMAGE_NAME: ${{ env.DPF_DOCKER }} + run: | + docker pull $IMAGE_NAME - name: "Check licences of packages" uses: ansys/pydpf-actions/check-licenses@v2.3 From 8a03320d73944a4819e9411fb181f5fc32a4a249 Mon Sep 17 00:00:00 2001 From: moe-ad Date: Mon, 13 Oct 2025 10:56:44 +0200 Subject: [PATCH 06/20] feat: modify token --- .github/workflows/test_docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_docker.yml b/.github/workflows/test_docker.yml index 05ee718695d..212e118856c 100644 --- a/.github/workflows/test_docker.yml +++ b/.github/workflows/test_docker.yml @@ -93,7 +93,7 @@ jobs: with: registry: ghcr.io username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + password: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} - name: Download DPF docker container env: From 05c03ba41d7fbe5faf2c6c4d208c42bdb1a9f1db Mon Sep 17 00:00:00 2001 From: moe-ad Date: Mon, 13 Oct 2025 12:31:23 +0200 Subject: [PATCH 07/20] feat: update conftest and test_docker to support windows containers --- .github/workflows/test_docker.yml | 23 ++++++++++++++--------- tests/conftest.py | 22 +++++++++++++++++++--- tests/entry/conftest.py | 22 +++++++++++++++++++--- 3 files changed, 52 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test_docker.yml b/.github/workflows/test_docker.yml index 212e118856c..0ea70433b94 100644 --- a/.github/workflows/test_docker.yml +++ b/.github/workflows/test_docker.yml @@ -30,17 +30,22 @@ env: MODULE: core ANSYS_DPF_ACCEPT_LA: Y ANSYSLMD_LICENSE_FILE: 1055@${{secrets.LICENSE_SERVER}} - DPF_DOCKER: ghcr.io/ansys-dpf/dpf-standalone:linux-25.1 jobs: docker_tests: name: "Build and Test On Docker" - runs-on: ${{ matrix.os }} + runs-on: ${{ matrix.platform.os }} strategy: fail-fast: false matrix: python-version: ["3.10"] - os: ["ubuntu-latest"] + platform: + - os: "ubuntu-latest" + image-name: ghcr.io/ansys-dpf/dpf-standalone:linux-26.1 + - os: "windows-latest" + image-name: ghcr.io/ansys-dpf/dpf-standalone:windows-26.1 + env: + DPF_DOCKER: ${{ matrix.platform.os }} steps: - uses: actions/checkout@v4 @@ -59,7 +64,7 @@ jobs: - name: "Build the wheel" shell: bash run: | - if [ ${{ matrix.os }} == "ubuntu-latest" ]; then + if [ ${{ matrix.platform.os }} == "ubuntu-latest" ]; then export platform="manylinux_2_17" else export platform="win" @@ -240,7 +245,7 @@ jobs: - name: "Upload Test Results" uses: actions/upload-artifact@v4 with: - name: ${{ env.PACKAGE_NAME }}_${{ matrix.python-version }}_${{ matrix.os }}_pytest_${{ inputs.ANSYS_VERSION || vars.ANSYS_VERSION_DEFAULT }}_docker + name: ${{ env.PACKAGE_NAME }}_${{ matrix.python-version }}_${{ matrix.platform.os }}_pytest_${{ inputs.ANSYS_VERSION || vars.ANSYS_VERSION_DEFAULT }}_docker path: tests/junit/test-results.xml timeout-minutes: 5 @@ -248,13 +253,13 @@ jobs: uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} # required - name: ${{ env.PACKAGE_NAME }}_${{ matrix.python-version }}_${{ matrix.os }}_pytest_${{ inputs.ANSYS_VERSION || vars.ANSYS_VERSION_DEFAULT }}_docker.xml - flags: docker,${{ inputs.ANSYS_VERSION || vars.ANSYS_VERSION_DEFAULT }},${{ matrix.os }},${{ matrix.python-version }} + name: ${{ env.PACKAGE_NAME }}_${{ matrix.python-version }}_${{ matrix.platform.os }}_pytest_${{ inputs.ANSYS_VERSION || vars.ANSYS_VERSION_DEFAULT }}_docker.xml + flags: docker,${{ inputs.ANSYS_VERSION || vars.ANSYS_VERSION_DEFAULT }},${{ matrix.platform.os }},${{ matrix.python-version }} - name: "Upload test analytics results to Codecov" if: ${{ !cancelled() }} uses: codecov/test-results-action@v1 with: token: ${{ secrets.CODECOV_TOKEN }} - name: test_results_${{ env.PACKAGE_NAME }}_${{ matrix.python-version }}_${{ matrix.os }}_${{ inputs.ANSYS_VERSION || vars.ANSYS_VERSION_DEFAULT }}${{ inputs.test_any == 'true' && '_any' || '' }} - flags: ${{ inputs.ANSYS_VERSION || vars.ANSYS_VERSION_DEFAULT }},${{ matrix.os }},${{ matrix.python-version }}${{ inputs.test_any == 'true' && ',any' || '' }} + name: test_results_${{ env.PACKAGE_NAME }}_${{ matrix.python-version }}_${{ matrix.platform.os }}_${{ inputs.ANSYS_VERSION || vars.ANSYS_VERSION_DEFAULT }}${{ inputs.test_any == 'true' && '_any' || '' }} + flags: ${{ inputs.ANSYS_VERSION || vars.ANSYS_VERSION_DEFAULT }},${{ matrix.platform.os }},${{ matrix.python-version }}${{ inputs.test_any == 'true' && ',any' || '' }} diff --git a/tests/conftest.py b/tests/conftest.py index f241ee23aa4..6e812aa9d9d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -27,8 +27,10 @@ """ import functools +import json import os from pathlib import Path +import subprocess import warnings import psutil @@ -67,9 +69,23 @@ def _get_test_files_directory(): ssl._create_default_https_context = ssl._create_unverified_context if running_docker: - ansys.dpf.core.server_types.RUNNING_DOCKER.mounted_volumes[_get_test_files_directory()] = ( - "/tmp/test_files" - ) + docker_name = ansys.dpf.core.server_types.RUNNING_DOCKER.docker_name + args = ["docker", "inspect", "-f", "json", docker_name] + inspect_docker_image = subprocess.run(args, capture_output=True) + if inspect_docker_image.stderr: + raise Exception( + f"Specified docker image not found. Verify that the image name '{docker_name}' is valid and the image file is available locally." + ) + output = json.loads(inspect_docker_image.stdout) + image_os = output[0]["Os"] + if image_os == "linux": + ansys.dpf.core.server_types.RUNNING_DOCKER.mounted_volumes[_get_test_files_directory()] = ( + "/tmp/test_files" + ) + else: # image is windows + ansys.dpf.core.server_types.RUNNING_DOCKER.mounted_volumes[_get_test_files_directory()] = ( + "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Temp\\test_files" + ) @pytest.hookimpl() diff --git a/tests/entry/conftest.py b/tests/entry/conftest.py index 01e1a0bf70a..12148e284b5 100644 --- a/tests/entry/conftest.py +++ b/tests/entry/conftest.py @@ -29,8 +29,10 @@ """ import functools +import json import os from pathlib import Path +import subprocess import pytest @@ -67,9 +69,23 @@ def _get_test_files_directory(): ssl._create_default_https_context = ssl._create_unverified_context if running_docker: - ansys.dpf.core.server_types.RUNNING_DOCKER.mounted_volumes[_get_test_files_directory()] = ( - "/tmp/test_files" - ) + docker_name = ansys.dpf.core.server_types.RUNNING_DOCKER.docker_name + args = ["docker", "inspect", "-f", "json", docker_name] + inspect_docker_image = subprocess.run(args, capture_output=True) + if inspect_docker_image.stderr: + raise Exception( + f"Specified docker image not found. Verify that the image name '{docker_name}' is valid and the image file is available locally." + ) + output = json.loads(inspect_docker_image.stdout) + image_os = output[0]["Os"] + if image_os == "linux": + ansys.dpf.core.server_types.RUNNING_DOCKER.mounted_volumes[_get_test_files_directory()] = ( + "/tmp/test_files" + ) + else: # image is windows + ansys.dpf.core.server_types.RUNNING_DOCKER.mounted_volumes[_get_test_files_directory()] = ( + "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Temp\\test_files" + ) SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_1 = meets_version( get_server_version(core._global_server()), "8.1" From f3dafc5bf14561f942c52f9a05727e4d5652aaf0 Mon Sep 17 00:00:00 2001 From: moe-ad Date: Mon, 13 Oct 2025 12:33:55 +0200 Subject: [PATCH 08/20] feat: update job name --- .github/workflows/test_docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_docker.yml b/.github/workflows/test_docker.yml index 0ea70433b94..5ca6f11afb3 100644 --- a/.github/workflows/test_docker.yml +++ b/.github/workflows/test_docker.yml @@ -33,7 +33,7 @@ env: jobs: docker_tests: - name: "Build and Test On Docker" + name: "Build and Test On Docker on ${{ matrix.platform.os }}" runs-on: ${{ matrix.platform.os }} strategy: fail-fast: false From 2ab8db6c492c127782274f0b5e32a6d3a73d9f94 Mon Sep 17 00:00:00 2001 From: moe-ad Date: Mon, 13 Oct 2025 12:38:37 +0200 Subject: [PATCH 09/20] fix: correct env variable --- .github/workflows/test_docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_docker.yml b/.github/workflows/test_docker.yml index 5ca6f11afb3..0b6708df7cc 100644 --- a/.github/workflows/test_docker.yml +++ b/.github/workflows/test_docker.yml @@ -45,7 +45,7 @@ jobs: - os: "windows-latest" image-name: ghcr.io/ansys-dpf/dpf-standalone:windows-26.1 env: - DPF_DOCKER: ${{ matrix.platform.os }} + DPF_DOCKER: ${{ matrix.platform.image-name }} steps: - uses: actions/checkout@v4 From 376f85ed8dac9a75694ba5393a8f50c315e8eeb0 Mon Sep 17 00:00:00 2001 From: moe-ad Date: Mon, 13 Oct 2025 12:53:25 +0200 Subject: [PATCH 10/20] fix: env variable expansion on windows --- .github/workflows/test_docker.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_docker.yml b/.github/workflows/test_docker.yml index 0b6708df7cc..63a018ab06e 100644 --- a/.github/workflows/test_docker.yml +++ b/.github/workflows/test_docker.yml @@ -101,10 +101,18 @@ jobs: password: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} - name: Download DPF docker container + if: runner.os == 'Linux' env: IMAGE_NAME: ${{ env.DPF_DOCKER }} run: | - docker pull $IMAGE_NAME + docker pull "$IMAGE_NAME" + + - name: Download DPF docker container + if: runner.os == 'Windows' + env: + IMAGE_NAME: ${{ env.DPF_DOCKER }} + run: | + docker pull "$env:IMAGE_NAME" - name: "Check licences of packages" uses: ansys/pydpf-actions/check-licenses@v2.3 From 37cbe616092b83705f255e279126c9d0d6805320 Mon Sep 17 00:00:00 2001 From: moe-ad Date: Mon, 13 Oct 2025 13:18:22 +0200 Subject: [PATCH 11/20] tests: skip test_python_plugings for docker tests --- tests/test_python_plugins.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_python_plugins.py b/tests/test_python_plugins.py index 3abfe1a33c2..ea55c6f7910 100644 --- a/tests/test_python_plugins.py +++ b/tests/test_python_plugins.py @@ -37,6 +37,7 @@ PinSpecification, SpecificationProperties, ) +import ansys.dpf.core.server_types import conftest from conftest import ( SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_4_0, @@ -54,6 +55,10 @@ if platform.system() == "Linux": pytest.skip("Known failures for the Ubuntu-latest GitHub pipelines", allow_module_level=True) +running_docker = ansys.dpf.core.server_types.RUNNING_DOCKER.use_docker +if running_docker: + pytest.skip("Skip python plugins tests in docker", allow_module_level=True) + update_virtual_environment_for_custom_operators(restore_original=True) update_virtual_environment_for_custom_operators() From dfd6a2d98bd0f772bbc9b7a4753011d276f41133 Mon Sep 17 00:00:00 2001 From: moe-ad Date: Thu, 16 Oct 2025 08:25:15 +0200 Subject: [PATCH 12/20] test: skip test failing on a windows container --- tests/test_plotter.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_plotter.py b/tests/test_plotter.py index 743f09755f9..aa93ecf580d 100644 --- a/tests/test_plotter.py +++ b/tests/test_plotter.py @@ -20,7 +20,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +import json from pathlib import Path +import subprocess import pytest @@ -28,6 +30,7 @@ from ansys.dpf import core from ansys.dpf.core import Model, Operator, element_types, errors as dpf_errors, misc from ansys.dpf.core.plotter import plot_chart +import ansys.dpf.core.server_types from conftest import ( SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_5_0, SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0, @@ -43,6 +46,21 @@ else: HAS_PYVISTA = False +running_docker = ansys.dpf.core.server_types.RUNNING_DOCKER.use_docker + +# Determine image os if running docker +image_os = None +if running_docker: + docker_name = ansys.dpf.core.server_types.RUNNING_DOCKER.docker_name + args = ["docker", "inspect", "-f", "json", docker_name] + inspect_docker_image = subprocess.run(args, capture_output=True) + if inspect_docker_image.stderr: + raise Exception( + f"Specified docker image not found. Verify that the image name '{docker_name}' is valid and the image file is available locally." + ) + output = json.loads(inspect_docker_image.stdout) + image_os = output[0]["Os"] + def remove_picture(picture): if Path.cwd().joinpath(picture).exists(): @@ -290,6 +308,10 @@ def test_field_elemental_nodal_plot_multi_shells(multishells): @pytest.mark.skipif(not HAS_PYVISTA, reason="Please install pyvista") @pytest.mark.skipif(not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_10_0, reason="Old bug before 25R2") +@pytest.mark.skipif( + running_docker and image_os == "windows", + reason="Test fails when running DPF server on a windows container", +) def test_dpf_plotter_add_field_elemental_nodal_multi_shells(multishells): fc: core.FieldsContainer = core.operators.result.stress( data_sources=core.DataSources(multishells), From 67c9bf7224be7611f99e434baacde07c8259d83e Mon Sep 17 00:00:00 2001 From: moe-ad Date: Thu, 16 Oct 2025 09:16:11 +0200 Subject: [PATCH 13/20] test: skip test failing on a windows container --- tests/test_plotter.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_plotter.py b/tests/test_plotter.py index aa93ecf580d..4feea9cb2fd 100644 --- a/tests/test_plotter.py +++ b/tests/test_plotter.py @@ -284,6 +284,10 @@ def test_field_elemental_nodal_plot_multiple_solid_types(): @pytest.mark.skipif(not HAS_PYVISTA, reason="Please install pyvista") +@pytest.mark.skipif( + running_docker and image_os == "windows", + reason="Test fails when running DPF server on a windows container", +) def test_field_elemental_nodal_plot_shells(): from ansys.dpf.core import examples From 5e774acc19683d4fe90d7c0cd2b77867eee88c73 Mon Sep 17 00:00:00 2001 From: moe-ad Date: Thu, 16 Oct 2025 10:22:02 +0200 Subject: [PATCH 14/20] test: skip test failing on a windows container --- tests/test_plotter.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_plotter.py b/tests/test_plotter.py index 4feea9cb2fd..a52da61dcfc 100644 --- a/tests/test_plotter.py +++ b/tests/test_plotter.py @@ -252,6 +252,10 @@ def test_field_nodal_plot(allkindofcomplexity): @pytest.mark.skipif(not HAS_PYVISTA, reason="Please install pyvista") +@pytest.mark.skipif( + running_docker and image_os == "windows", + reason="Test fails when running DPF server on a windows container", +) def test_field_elemental_nodal_plot_simple(simple_bar): model = Model(simple_bar) stress = model.results.element_nodal_forces() From 5a2c60d694145b5a83cd9f641f72075941caeb1b Mon Sep 17 00:00:00 2001 From: moe-ad Date: Thu, 16 Oct 2025 11:04:14 +0200 Subject: [PATCH 15/20] test: skip test failing on a windows container --- tests/test_plotter.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_plotter.py b/tests/test_plotter.py index a52da61dcfc..59b409cd505 100644 --- a/tests/test_plotter.py +++ b/tests/test_plotter.py @@ -277,6 +277,10 @@ def test_field_elemental_nodal_plot_scoped(simple_bar): @pytest.mark.skipif(not HAS_PYVISTA, reason="Please install pyvista") +@pytest.mark.skipif( + running_docker and image_os == "windows", + reason="Test fails when running DPF server on a windows container", +) def test_field_elemental_nodal_plot_multiple_solid_types(): from ansys.dpf.core import examples From bcb90a20c5b958d68b17ab001011890aa7b441ac Mon Sep 17 00:00:00 2001 From: moe-ad Date: Thu, 16 Oct 2025 13:44:27 +0200 Subject: [PATCH 16/20] test: skip test failing on a windows container --- tests/test_plotter.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_plotter.py b/tests/test_plotter.py index 59b409cd505..27cbcc3f0d3 100644 --- a/tests/test_plotter.py +++ b/tests/test_plotter.py @@ -447,6 +447,10 @@ def test_dpf_plotter_add_field_elemental_nodal_plot_simple(simple_bar): @pytest.mark.skipif(not HAS_PYVISTA, reason="Please install pyvista") +@pytest.mark.skipif( + running_docker and image_os == "windows", + reason="Test fails when running DPF server on a windows container", +) def test_dpf_plotter_add_field_elemental_nodal_plot_scoped(simple_bar): mesh_scoping = dpf.core.mesh_scoping_factory.elemental_scoping( element_ids=list(range(1501, 3001)) From 7173cb7e9fa440d69d96be38c2c580bcccd985ad Mon Sep 17 00:00:00 2001 From: moe-ad Date: Mon, 27 Oct 2025 11:30:23 +0100 Subject: [PATCH 17/20] test: increase timeout --- .github/workflows/test_docker.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test_docker.yml b/.github/workflows/test_docker.yml index 63a018ab06e..b66a6437a37 100644 --- a/.github/workflows/test_docker.yml +++ b/.github/workflows/test_docker.yml @@ -145,7 +145,7 @@ jobs: - name: "Test API" uses: nick-fields/retry@v3 with: - timeout_minutes: 10 + timeout_minutes: 20 max_attempts: 2 shell: bash command: | @@ -154,7 +154,7 @@ jobs: - name: "Test API test_launcher" uses: nick-fields/retry@v3 with: - timeout_minutes: 2 + timeout_minutes: 20 max_attempts: 2 shell: bash command: | @@ -163,7 +163,7 @@ jobs: - name: "Test API test_server" uses: nick-fields/retry@v3 with: - timeout_minutes: 8 + timeout_minutes: 20 max_attempts: 2 shell: bash command: | @@ -172,7 +172,7 @@ jobs: - name: "Test API test_local_server" uses: nick-fields/retry@v3 with: - timeout_minutes: 2 + timeout_minutes: 20 max_attempts: 2 shell: bash command: | @@ -181,7 +181,7 @@ jobs: - name: "Test API test_multi_server" uses: nick-fields/retry@v3 with: - timeout_minutes: 5 + timeout_minutes: 20 max_attempts: 2 shell: bash command: | @@ -190,7 +190,7 @@ jobs: - name: "Test API test_remote_workflow" uses: nick-fields/retry@v3 with: - timeout_minutes: 2 + timeout_minutes: 20 max_attempts: 3 shell: bash command: | @@ -199,7 +199,7 @@ jobs: - name: "Test API test_remote_operator" uses: nick-fields/retry@v3 with: - timeout_minutes: 2 + timeout_minutes: 20 max_attempts: 2 shell: bash command: | @@ -208,7 +208,7 @@ jobs: - name: "Test API test_workflow" uses: nick-fields/retry@v3 with: - timeout_minutes: 3 + timeout_minutes: 20 max_attempts: 3 shell: bash command: | @@ -217,7 +217,7 @@ jobs: - name: "Test API test_service" uses: nick-fields/retry@v3 with: - timeout_minutes: 3 + timeout_minutes: 20 max_attempts: 2 shell: bash command: | @@ -226,7 +226,7 @@ jobs: - name: "Test Operators" uses: nick-fields/retry@v3 with: - timeout_minutes: 3 + timeout_minutes: 20 max_attempts: 2 shell: bash command: | @@ -235,7 +235,7 @@ jobs: - name: "Test Documentation" uses: nick-fields/retry@v3 with: - timeout_minutes: 8 + timeout_minutes: 20 max_attempts: 2 shell: bash command: | From 79ef97c1b1bd0caed8076713d9158c8c336ff954 Mon Sep 17 00:00:00 2001 From: moe-ad Date: Tue, 28 Oct 2025 09:43:53 +0100 Subject: [PATCH 18/20] feat: unskip test_plotter.py tests --- tests/test_plotter.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/test_plotter.py b/tests/test_plotter.py index 27cbcc3f0d3..69131e924bd 100644 --- a/tests/test_plotter.py +++ b/tests/test_plotter.py @@ -252,10 +252,10 @@ def test_field_nodal_plot(allkindofcomplexity): @pytest.mark.skipif(not HAS_PYVISTA, reason="Please install pyvista") -@pytest.mark.skipif( - running_docker and image_os == "windows", - reason="Test fails when running DPF server on a windows container", -) +# @pytest.mark.skipif( +# running_docker and image_os == "windows", +# reason="Test fails when running DPF server on a windows container", +# ) def test_field_elemental_nodal_plot_simple(simple_bar): model = Model(simple_bar) stress = model.results.element_nodal_forces() @@ -277,10 +277,10 @@ def test_field_elemental_nodal_plot_scoped(simple_bar): @pytest.mark.skipif(not HAS_PYVISTA, reason="Please install pyvista") -@pytest.mark.skipif( - running_docker and image_os == "windows", - reason="Test fails when running DPF server on a windows container", -) +# @pytest.mark.skipif( +# running_docker and image_os == "windows", +# reason="Test fails when running DPF server on a windows container", +# ) def test_field_elemental_nodal_plot_multiple_solid_types(): from ansys.dpf.core import examples @@ -292,10 +292,10 @@ def test_field_elemental_nodal_plot_multiple_solid_types(): @pytest.mark.skipif(not HAS_PYVISTA, reason="Please install pyvista") -@pytest.mark.skipif( - running_docker and image_os == "windows", - reason="Test fails when running DPF server on a windows container", -) +# @pytest.mark.skipif( +# running_docker and image_os == "windows", +# reason="Test fails when running DPF server on a windows container", +# ) def test_field_elemental_nodal_plot_shells(): from ansys.dpf.core import examples @@ -320,10 +320,10 @@ def test_field_elemental_nodal_plot_multi_shells(multishells): @pytest.mark.skipif(not HAS_PYVISTA, reason="Please install pyvista") @pytest.mark.skipif(not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_10_0, reason="Old bug before 25R2") -@pytest.mark.skipif( - running_docker and image_os == "windows", - reason="Test fails when running DPF server on a windows container", -) +# @pytest.mark.skipif( +# running_docker and image_os == "windows", +# reason="Test fails when running DPF server on a windows container", +# ) def test_dpf_plotter_add_field_elemental_nodal_multi_shells(multishells): fc: core.FieldsContainer = core.operators.result.stress( data_sources=core.DataSources(multishells), @@ -447,10 +447,10 @@ def test_dpf_plotter_add_field_elemental_nodal_plot_simple(simple_bar): @pytest.mark.skipif(not HAS_PYVISTA, reason="Please install pyvista") -@pytest.mark.skipif( - running_docker and image_os == "windows", - reason="Test fails when running DPF server on a windows container", -) +# @pytest.mark.skipif( +# running_docker and image_os == "windows", +# reason="Test fails when running DPF server on a windows container", +# ) def test_dpf_plotter_add_field_elemental_nodal_plot_scoped(simple_bar): mesh_scoping = dpf.core.mesh_scoping_factory.elemental_scoping( element_ids=list(range(1501, 3001)) From b0e81dde96d693fd857f8086cafc7cc407484c6b Mon Sep 17 00:00:00 2001 From: moe-ad Date: Tue, 28 Oct 2025 09:52:22 +0100 Subject: [PATCH 19/20] feat: change DPF_DEFAULT_PORT --- src/ansys/dpf/core/core.py | 2 +- src/ansys/dpf/core/server.py | 4 ++-- src/ansys/dpf/core/server_types.py | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ansys/dpf/core/core.py b/src/ansys/dpf/core/core.py index b479cdb0e3f..317c2c4136d 100644 --- a/src/ansys/dpf/core/core.py +++ b/src/ansys/dpf/core/core.py @@ -345,7 +345,7 @@ class BaseService: -------- Connect to an existing DPF server >>> from ansys.dpf import core as dpf - >>> #server = dpf.connect_to_server(ip='127.0.0.1', port = 50054, as_global=False) + >>> #server = dpf.connect_to_server(ip='127.0.0.1', port = 60054, as_global=False) >>> #base = dpf.BaseService(server=server) """ diff --git a/src/ansys/dpf/core/server.py b/src/ansys/dpf/core/server.py index fc14a0ac595..d4dc04cfa8e 100644 --- a/src/ansys/dpf/core/server.py +++ b/src/ansys/dpf/core/server.py @@ -182,7 +182,7 @@ def start_local_server( default is ``"LOCALHOST"``. port : int, optional Port to connect to the remote instance on. The default is - ``"DPF_DEFAULT_PORT"``, which is 50054. + ``"DPF_DEFAULT_PORT"``, which is 60054. ansys_path : str or os.PathLike, optional Root path for the Ansys installation directory. For example, ``"/ansys_inc/v212/"``. The default is the latest Ansys installation. @@ -326,7 +326,7 @@ def connect_to_server( default is ``"LOCALHOST"``. port : int Port to connect to the remote instance on. The default is - ``"DPF_DEFAULT_PORT"``, which is 50054. + ``"DPF_DEFAULT_PORT"``, which is 60054. as_global : bool, optional Global variable that stores the IP address and port for the DPF module. All DPF objects created in this Python session will diff --git a/src/ansys/dpf/core/server_types.py b/src/ansys/dpf/core/server_types.py index 5e2fd047d47..66907001ffd 100644 --- a/src/ansys/dpf/core/server_types.py +++ b/src/ansys/dpf/core/server_types.py @@ -60,7 +60,7 @@ LOG = logging.getLogger(__name__) LOG.setLevel("DEBUG") -DPF_DEFAULT_PORT = int(os.environ.get("DPF_PORT", 50054)) +DPF_DEFAULT_PORT = int(os.environ.get("DPF_PORT", 60054)) LOCALHOST = os.environ.get("DPF_IP", "127.0.0.1") RUNNING_DOCKER = server_factory.create_default_docker_config() @@ -236,7 +236,7 @@ def launch_dpf( default is ``"LOCALHOST"``. port : int Port to connect to the remote instance on. The default is - ``"DPF_DEFAULT_PORT"``, which is 50054. + ``"DPF_DEFAULT_PORT"``, which is 60054. timeout : float, optional Maximum number of seconds for the initialization attempt. The default is ``10``. Once the specified number of seconds @@ -274,7 +274,7 @@ def launch_dpf_on_docker( default is ``"LOCALHOST"``. port : int Port to connect to the remote instance on. The default is - ``"DPF_DEFAULT_PORT"``, which is 50054. + ``"DPF_DEFAULT_PORT"``, which is 60054. timeout : float, optional Maximum number of seconds for the initialization attempt. The default is ``50``. Once the specified number of seconds @@ -1195,7 +1195,7 @@ class LegacyGrpcServer(BaseServer): default is ``"LOCALHOST"``. port : int Port to connect to the remote instance on. The default is - ``"DPF_DEFAULT_PORT"``, which is 50054. + ``"DPF_DEFAULT_PORT"``, which is 60054. timeout : float, optional Maximum number of seconds for the initialization attempt. The default is ``10``. Once the specified number of seconds From 0d646741cfadcea390b0cd9849062ec7e238d799 Mon Sep 17 00:00:00 2001 From: moe-ad Date: Tue, 28 Oct 2025 10:47:52 +0100 Subject: [PATCH 20/20] feat: increase docker launch timeout --- src/ansys/dpf/core/server_types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/dpf/core/server_types.py b/src/ansys/dpf/core/server_types.py index 66907001ffd..3526f247769 100644 --- a/src/ansys/dpf/core/server_types.py +++ b/src/ansys/dpf/core/server_types.py @@ -258,7 +258,7 @@ def launch_dpf_on_docker( ansys_path=None, ip=LOCALHOST, port=DPF_DEFAULT_PORT, - timeout=50.0, + timeout=120.0, ): """Launch Ansys DPF.