Skip to content

build: update ansys-dpf-core #3082

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

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5e0387a
Update ansys-dpf-core
germa89 May 10, 2024
bf887ba
Merge branch 'main' into maint/update-dpf-test
germa89 Jul 8, 2024
0bfc6b6
chore: adding changelog file 3082.dependencies.md
pyansys-ci-bot Jul 8, 2024
2b093f9
chore: merge remote-tracking branch 'origin/main' into maint/update-d…
germa89 Nov 25, 2024
a075b71
feat: using dpf action and latest version
germa89 Nov 25, 2024
ba09706
fix: using server installation
germa89 Nov 25, 2024
a648a24
fix: running dpf tests in local
germa89 Nov 25, 2024
63ffb7c
fix: adding dpf env var
germa89 Nov 25, 2024
a282e9d
fix: removing dpf unused env vars
germa89 Nov 25, 2024
905693c
Merge branch 'main' into maint/update-dpf-test
germa89 Nov 26, 2024
e6bee75
ci: removing check DPF port
germa89 Nov 26, 2024
70a0af8
Merge branch 'maint/update-dpf-test' of https://github.com/ansys/pyma…
germa89 Nov 26, 2024
05950e6
chore: adding changelog file 3082.dependencies.md [dependabot-skip]
pyansys-ci-bot Nov 26, 2024
3157b8b
Merge remote-tracking branch 'origin/main' into maint/update-dpf-test
germa89 Feb 10, 2025
74bfb7d
ci: fixing workflow
germa89 Feb 10, 2025
3ad2a87
feat: adding powershell to CICD
germa89 Feb 10, 2025
9196c0d
test: dpf server connection
germa89 Feb 11, 2025
4096786
ci: speed testing. temporary.
germa89 Feb 11, 2025
1be8e5e
fix: import
germa89 Feb 11, 2025
53bae01
feat: adding version
germa89 Feb 11, 2025
40eb4df
ci: adding ansys number to action
germa89 Feb 11, 2025
7ee9fd2
feat: using custom branch
germa89 Feb 11, 2025
4fae534
Merge branch 'main' into maint/update-dpf-test
germa89 Feb 11, 2025
6dde222
feat: using script instead of action
germa89 Feb 11, 2025
55ef819
fix: make executable
germa89 Feb 11, 2025
777c7c7
fix: server env var
germa89 Feb 11, 2025
49688e6
Merge branch 'main' into maint/update-dpf-test
germa89 Feb 11, 2025
32635bd
fix: moving down
germa89 Feb 11, 2025
5d8ba31
Merge branch 'maint/update-dpf-test' of https://github.com/ansys/pyma…
germa89 Feb 11, 2025
04f86de
feat: adding more info in case of failure.
germa89 Feb 11, 2025
e1fc043
feat: retrieving dpf server log file
germa89 Feb 11, 2025
42182b6
feat: increasing timeout
germa89 Feb 11, 2025
9e773fc
feat: increasing timeout
germa89 Feb 11, 2025
89d91d4
tests: test
germa89 Feb 11, 2025
1c8e717
test: again
germa89 Feb 11, 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
8 changes: 7 additions & 1 deletion .ci/build_matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,14 @@ for version in "${versions[@]}"; do
fi

# Add line to json
if [[ "$version" == *"latest-ubuntu"* ]] ; then
version_num=$(echo $LATEST_VERSION)
else
version_num=$(echo "$version" | head -c 5 | tail -c 4 | tr -d '.')
fi;

if [[ "$add_line" == "true" ]]; then
JSONline="{\"mapdl-version\": \"$version\"},"
JSONline="{\"mapdl-version\": \"$version\", \"number\": \"$version_num\" },"

echo "ADDED line: $JSONline"

Expand Down
2 changes: 2 additions & 0 deletions .ci/collect_mapdl_logs_locals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ cp *pymapdl.apdl ./"$LOG_NAMES"/ || echo "No PYMAPDL APDL log files could be fou
echo "Copying the profiling files..."
cp -r prof ./"$LOG_NAMES"/prof || echo "No profile files could be found"

echo "Copying DPF server files..."
cp dpf_server.log ./"$LOG_NAMES"/dpf-standalone || echo "No DPF server files could be found"

ls -la ./"$LOG_NAMES"

Expand Down
70 changes: 70 additions & 0 deletions .ci/install_dpf_server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Inputs
# - ANSYS_VERSION
# - OS

OS="${OS:-Linux}"
ANSYS_VERSION="${ANSYS_VERSION:-221}"
ANSYS_VERSION_WITH_POINT="${ANSYS_VERSION:0:2}.${ANSYS_VERSION:2}"
GITHUB_TOKEN="${GITHUB_TOKEN:?Error: MY_VAR is not set or empty}"

OLD_PATH=$(pwd)
echo "OS: $OS"
echo "Ansys version: $ANSYS_VERSION"
echo "Ansys version (number): $ANSYS_VERSION_WITH_POINT"

if [[ "$OS" == "Linux" ]]; then
BranchName="linux_release-$ANSYS_VERSION_WITH_POINT"
DIRECTORY="$(pwd)"
SERVER=$DIRECTORY/dpf-standalone
DIR="/aisol/bin/linx64"
executable="./Ans.Dpf.Grpc.sh"

else # Windows
BranchName="win_release-$ANSYS_VERSION_WITH_POINT"
DIRECTORY="$(pwd)"
SERVER=$DIRECTORY/dpf-standalone
DIR="\aisol\bin\winx64"
executable="./Ans.Dpf.Grpc.bat"

fi

echo "SERVER: $SERVER"
echo "BranchName: $BranchName"

git clone --branch $BranchName --single-branch https://[email protected]/ansys-dpf/dpf-standalone
echo "AWP_ROOT$ANSYS_VERSION=$SERVER" >> $GITHUB_OUTPUT

# Setting up the files
cd $SERVER
cd */*/*
echo "Current directory:"
echo "$(pwd)"

echo "Files in the directory:"
echo "$(ls)"

cd ".$DIR"
echo "Current directory:"
echo "$(pwd)"

echo "Files in the directory:"
echo "$(ls)"

if [[ "$OS" == "Linux" ]]; then
echo "Setting files permissions"
chmod 755 Ans.Dpf.Grpc.sh || echo "Failed to set permissions in 'Ans.Dpf.Grpc.sh' file."
#|| echo "Failed to set permissions in 'Ans.Dpf.Grpc.sh' file." && exit 1
chmod 755 Ans.Dpf.Grpc.exe || echo "Failed to set permissions in 'Ans.Dpf.Grpc.sh' file."
#|| echo "Failed to set permissions in 'Ans.Dpf.Grpc.exe' file." && exit 1
fi

echo "Starting server"
full_executable_path="$(pwd)/$executable"
echo "Full executable path: $full_executable_path"

cd $OLD_PATH
$full_executable_path --address 127.0.0.1 > dpf_server.log &

echo "Server started"
sleep 10
echo "File output: $(cat dpf_server.log)"
7 changes: 0 additions & 7 deletions .ci/waiting_services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,3 @@ sleep 0.1
done
echo "::endgroup::"
echo "MAPDL service is up!"

echo "::group:: Waiting for the DPF port to be open..."
while ! nc -z localhost "$DPF_PORT"; do
sleep 0.1
done
echo "::endgroup::"
echo "DPF service is up!"
2 changes: 1 addition & 1 deletion .devcontainer/codespaces-dev/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ansys-dpf-core==0.10.1
ansys-dpf-core==0.13.2
ansys-tools-visualization-interface==0.5.0
autopep8==2.3.1
matplotlib==3.9.2
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/codespaces-docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ansys-dpf-core==0.10.1
ansys-dpf-core==0.13.2
ansys-mapdl-reader==0.54.2
ansys-sphinx-theme==0.16.6
ansys-tools-visualization-interface==0.5.0
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer-local/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ansys-dpf-core==0.10.1
ansys-dpf-core==0.13.2
ansys-mapdl-reader==0.54.2
ansys-sphinx-theme==1.2.2
ansys-tools-visualization-interface==0.5.0
Expand Down
41 changes: 29 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ env:
MEILISEARCH_API_KEY: ${{ secrets.MEILISEARCH_API_KEY }}
MEILISEARCH_PUBLIC_API_KEY: ${{ secrets.MEILISEARCH_PUBLIC_API_KEY }}
PYANSYS_OFF_SCREEN: True
DPF_START_SERVER: False
DPF_PORT: 21004
MAPDL_PACKAGE: ghcr.io/ansys/mapdl
ON_CI: True
PYTEST_ARGUMENTS: '-vvv -rxXsa --color=yes --durations=30 --random-order --random-order-bucket=class --maxfail=10 --reruns 3 --reruns-delay 4 --cov=ansys.mapdl.core --cov-report=html --timeout=180 --profile-svg --profile'
PYTEST_ARGUMENTS: '-vvv -k "dpf" -rxXsa --color=yes --durations=30 --random-order --random-order-bucket=class --maxfail=10 --reruns 3 --reruns-delay 4 --cov=ansys.mapdl.core --cov-report=html --timeout=180 --profile-svg --profile'
ANSYS_DPF_ACCEPT_LA: "Y"

BUILD_CHEATSHEET: True
PYMAPDL_DEBUG_TESTING: True
Expand Down Expand Up @@ -189,9 +188,11 @@ jobs:
echo "Launching MAPDL service at PID: $DOCKER_PID"
echo "DOCKER_PID=$(echo $DOCKER_PID)" >> $GITHUB_OUTPUT

- name: "DPF server activation"
run: |
$(docker pull ghcr.io/ansys/dpf-core:22.2dev && docker run -d --name dpfserver -p ${{ env.DPF_PORT }}:50052 ghcr.io/ansys/dpf-core:22.2dev && echo "DPF Server active on port ${{ env.DPF_PORT }}.") &
# - name: "Install DPF"
# id: set-server-path
# uses: ansys/pydpf-actions/install-dpf-server@feat/allow-running-from-custom-location
# with:
# dpf-standalone-TOKEN: ${{secrets.PYANSYS_CI_BOT_TOKEN}}

- name: "Getting files change filters"
uses: dorny/paths-filter@v3
Expand Down Expand Up @@ -401,7 +402,7 @@ jobs:
build-test-remote:
name: "Remote: ${{ matrix.mapdl-version }}"
runs-on: ubuntu-22.04
needs: [smoke-tests, build-test-remote-matrix]
needs: [build-test-remote-matrix]
timeout-minutes: 35
strategy:
fail-fast: false
Expand All @@ -415,6 +416,7 @@ jobs:
PYMAPDL_START_INSTANCE: FALSE
ON_LOCAL: FALSE
ON_UBUNTU: FALSE
HAS_DPF: true

outputs:
DISTRIBUTED_MODE: ${{ steps.distributed_mode.outputs.distributed_mode }}
Expand Down Expand Up @@ -485,9 +487,12 @@ jobs:
echo "DOCKER_PID_0=$(echo $DOCKER_PID_0)" >> $GITHUB_OUTPUT
echo "DOCKER_PID_1=$(echo $DOCKER_PID_1)" >> $GITHUB_OUTPUT

- name: "DPF server activation"
run: |
$(docker pull ghcr.io/ansys/dpf-core:22.2dev && docker run -d --name dpfserver -p ${{ env.DPF_PORT }}:50052 ghcr.io/ansys/dpf-core:22.2dev && echo "DPF Server active on port ${{ env.DPF_PORT }}.") &
# - name: "Install DPF"
# id: set-server-path
# uses: ansys/pydpf-actions/install-dpf-server@feat/allow-running-from-custom-location
# with:
# dpf-standalone-TOKEN: ${{secrets.PYANSYS_CI_BOT_TOKEN}}
# ANSYS_VERSION: ${{ matrix.number }}

- name: "Getting files change filters"
uses: dorny/paths-filter@v3
Expand Down Expand Up @@ -540,6 +545,7 @@ jobs:
DISTRIBUTED_MODE: ${{ steps.distributed_mode.outputs.distributed_mode }}
ON_UBUNTU: ${{ steps.ubuntu_check.outputs.ON_UBUNTU }}
ON_STUDENT: ${{ steps.student_check.outputs.ON_STUDENT }}
DPF_SERVER_PATH: ${{ steps.set-server-path.outputs.SERVER }}
run: |
echo "ON_UBUNTU: $ON_UBUNTU"
echo "ON_STUDENT: $ON_STUDENT"
Expand Down Expand Up @@ -632,7 +638,7 @@ jobs:
name: "Local: ${{ matrix.mapdl-version }}"
runs-on: ubuntu-22.04
if: github.ref != 'refs/heads/main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
needs: [smoke-tests, build-test-local-minimal-matrix]
needs: [build-test-local-minimal-matrix]
timeout-minutes: 75
strategy:
fail-fast: false
Expand All @@ -649,6 +655,7 @@ jobs:
ON_UBUNTU: true
P_SCHEMA: "/ansys_inc/v241/ansys/ac4/schema"
PYTEST_TIMEOUT: 120 # seconds. Limit the duration for each unit test
HAS_DPF: true

steps:
- name: "Install Git and checkout project"
Expand Down Expand Up @@ -682,6 +689,15 @@ jobs:
python -m venv ./.venv
source ./.venv/bin/activate

- name: "Install DPF"
id: set-server-path
env:
OS: ${{ runner.os }}
ANSYS_VERSION: ${{ matrix.number }}
GITHUB_TOKEN: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
run: |
.ci/install_dpf_server.sh

- name: "Install OS packages"
run: |
apt update
Expand All @@ -707,12 +723,13 @@ jobs:
env:
ANSYSLMD_LICENSE_FILE: "1055@${{ secrets.LICENSE_SERVER }}"
ON_STUDENT: ${{ steps.student_check.outputs.ON_STUDENT }}
DPF_SERVER_PATH: ${{ steps.set-server-path.outputs.SERVER }}
run: |
echo "ON_UBUNTU: $ON_UBUNTU"
echo "ON_STUDENT: $ON_STUDENT"
unset PYMAPDL_PORT
unset PYMAPDL_START_INSTANCE
xvfb-run pytest -k "not test_dpf" \
xvfb-run pytest \
${{ env.PYTEST_ARGUMENTS }} \
--reset_only_failed --add_missing_images \
--cov-report=xml:${{ matrix.mapdl-version }}-local.xml
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/linkchecker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ jobs:
username: ${{ secrets.GH_USERNAME }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: "DPF server activation"
run: |
$(docker pull ghcr.io/ansys/dpf-core:22.2dev && docker run -d --name dpfserver -p ${{ env.DPF_PORT }}:50052 ghcr.io/ansys/dpf-core:22.2dev && echo "DPF Server active on port ${{ env.DPF_PORT }}.") &
- name: "Install DPF"
id: set-server-path
uses: ansys/pydpf-actions/[email protected]
with:
dpf-standalone-TOKEN: ${{secrets.PYANSYS_CI_BOT_TOKEN}}

- name: "Pull, launch, and validate MAPDL service"
id: start_mapdl
Expand Down
1 change: 1 addition & 0 deletions doc/changelog.d/3082.dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build: update ansys-dpf-core
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jupyter = [
]

tests = [
"ansys-dpf-core==0.10.1",
"ansys-dpf-core==0.13.2",
"ansys-tools-visualization-interface==0.8.1",
"autopep8==2.3.2",
"matplotlib==3.10.0",
Expand All @@ -73,7 +73,7 @@ tests = [
"vtk==9.3.1",
]
doc = [
"ansys-dpf-core==0.10.1",
"ansys-dpf-core==0.13.2",
"ansys-mapdl-reader==0.54.2",
"ansys-sphinx-theme==1.3.1",
"ansys-tools-visualization-interface==0.8.1",
Expand Down
4 changes: 3 additions & 1 deletion tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ def has_grpc():


def has_dpf():
return bool(os.environ.get("DPF_PORT"))
return (os.environ.get("HAS_DPF").lower().strip() in ["true", "yes"]) or bool(
os.environ.get("DPF_PORT")
)


def is_smp():
Expand Down
16 changes: 9 additions & 7 deletions tests/test_dpf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
# SOFTWARE.

"""Test the DPF implementation"""
import os

import pytest

from conftest import HAS_DPF, ON_CI, has_dependency, requires
Expand All @@ -31,9 +29,7 @@
pytest.skip(allow_module_level=True)

from ansys.dpf import core as dpf
from ansys.dpf.core.server_types import DPF_DEFAULT_PORT

DPF_PORT = os.environ.get("DPF_PORT", DPF_DEFAULT_PORT) # Set in ci.yaml
from ansys.dpf.core import server as server_module


@pytest.fixture()
Expand All @@ -52,7 +48,7 @@ def skip_dpf(mapdl):
def test_dpf_connection(skip_dpf):
# uses 127.0.0.1 and port 50054 by default
try:
grpc_con = dpf.connect_to_server(port=DPF_PORT)
grpc_con = dpf.connect_to_server()
assert grpc_con.live
assert True
except OSError:
Expand All @@ -66,7 +62,13 @@ def test_upload(skip_dpf, mapdl, solved_box, tmpdir):
rst_path = mapdl.download_result(str(tmpdir.mkdir("tmpdir")))

# Establishing connection
grpc_con = dpf.connect_to_server(port=DPF_PORT)
grpc_con = dpf.connect_to_server()

server = server.DPFServer()
server = server_module.get_or_create_server(server)
if not server.local_server and not server.docker_config.use_docker:
return upload_file_in_tmp_folder(local_path, server=server)

assert grpc_con.live

# Upload RST
Expand Down
Loading