Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
227ae46
feat: changes to test windows container
moe-ad Oct 6, 2025
7488043
feat: detect container image and revise timeout values
moe-ad Oct 13, 2025
79ae090
Merge branch 'main' into feat/support-windows-based-containers
moe-ad Oct 13, 2025
26197d4
fix: codestyle
moe-ad Oct 13, 2025
0ab75a4
feat: revise timeout value
moe-ad Oct 13, 2025
0825d7e
feat: test linux images
moe-ad Oct 13, 2025
8a03320
feat: modify token
moe-ad Oct 13, 2025
05c03ba
feat: update conftest and test_docker to support windows containers
moe-ad Oct 13, 2025
f3dafc5
feat: update job name
moe-ad Oct 13, 2025
2ab8db6
fix: correct env variable
moe-ad Oct 13, 2025
376f85e
fix: env variable expansion on windows
moe-ad Oct 13, 2025
37cbe61
tests: skip test_python_plugings for docker tests
moe-ad Oct 13, 2025
2ed7406
Merge branch 'main' into feat/support-windows-based-containers
moe-ad Oct 14, 2025
397ce3f
Merge branch 'main' into feat/support-windows-based-containers
moe-ad Oct 16, 2025
dfd6a2d
test: skip test failing on a windows container
moe-ad Oct 16, 2025
67c9bf7
test: skip test failing on a windows container
moe-ad Oct 16, 2025
5e774ac
test: skip test failing on a windows container
moe-ad Oct 16, 2025
5a2c60d
test: skip test failing on a windows container
moe-ad Oct 16, 2025
bcb90a2
test: skip test failing on a windows container
moe-ad Oct 16, 2025
7371aae
Merge branch 'main' into feat/support-windows-based-containers
moe-ad Oct 27, 2025
7173cb7
test: increase timeout
moe-ad Oct 27, 2025
ab35627
Merge branch 'main' into feat/support-windows-based-containers
moe-ad Oct 28, 2025
79ef97c
feat: unskip test_plotter.py tests
moe-ad Oct 28, 2025
b0e81dd
feat: change DPF_DEFAULT_PORT
moe-ad Oct 28, 2025
0d64674
feat: increase docker launch timeout
moe-ad Oct 28, 2025
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
79 changes: 53 additions & 26 deletions .github/workflows/test_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@ env:

jobs:
docker_tests:
name: "Build and Test On Docker"
runs-on: ${{ matrix.os }}
name: "Build and Test On Docker on ${{ matrix.platform.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.image-name }}

steps:
- uses: actions/checkout@v4
Expand All @@ -58,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"
Expand All @@ -79,13 +85,34 @@ jobs:
run: |
pip install dist/${{ steps.wheel.outputs.wheel_name }}[graphics]

- name: "Install DPF"
id: set-server-path
uses: ansys/pydpf-actions/[email protected]
# - name: "Install DPF"
# id: set-server-path
# uses: ansys/pydpf-actions/[email protected]
# 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.PYANSYS_CI_BOT_TOKEN }}

- name: Download DPF docker container
if: runner.os == 'Linux'
env:
IMAGE_NAME: ${{ env.DPF_DOCKER }}
run: |
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/[email protected]
Expand Down Expand Up @@ -118,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: |
Expand All @@ -127,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: |
Expand All @@ -136,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: |
Expand All @@ -145,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: |
Expand All @@ -154,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: |
Expand All @@ -163,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: |
Expand All @@ -172,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: |
Expand All @@ -181,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: |
Expand All @@ -190,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: |
Expand All @@ -199,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: |
Expand All @@ -208,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: |
Expand All @@ -226,21 +253,21 @@ 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

- name: "Upload coverage to Codecov"
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' || '' }}
2 changes: 1 addition & 1 deletion src/ansys/dpf/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

"""
Expand Down
4 changes: 2 additions & 2 deletions src/ansys/dpf/core/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
20 changes: 18 additions & 2 deletions src/ansys/dpf/core/server_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"""

import io
import json
import logging
import os
import subprocess
Expand Down Expand Up @@ -90,8 +91,23 @@ 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"}
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
Expand Down
14 changes: 6 additions & 8 deletions src/ansys/dpf/core/server_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand All @@ -258,7 +258,7 @@ def launch_dpf_on_docker(
ansys_path=None,
ip=LOCALHOST,
port=DPF_DEFAULT_PORT,
timeout=10.0,
timeout=120.0,
):
"""Launch Ansys DPF.

Expand All @@ -274,10 +274,10 @@ 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 ``10``. Once the specified number of seconds
The default is ``50``. Once the specified number of seconds
passes, the connection fails.

"""
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1196,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
Expand Down Expand Up @@ -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)
Expand Down
22 changes: 19 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
"""

import functools
import json
import os
from pathlib import Path
import subprocess
import warnings

import psutil
Expand Down Expand Up @@ -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()
Expand Down
Loading
Loading