diff --git a/.ci/build_matrix.sh b/.ci/build_matrix.sh index 67189fda44..9ad3558494 100755 --- a/.ci/build_matrix.sh +++ b/.ci/build_matrix.sh @@ -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" diff --git a/.ci/collect_mapdl_logs_locals.sh b/.ci/collect_mapdl_logs_locals.sh index b6082b4f18..e8af6644a0 100755 --- a/.ci/collect_mapdl_logs_locals.sh +++ b/.ci/collect_mapdl_logs_locals.sh @@ -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" diff --git a/.ci/install_dpf_server.sh b/.ci/install_dpf_server.sh new file mode 100755 index 0000000000..614f087459 --- /dev/null +++ b/.ci/install_dpf_server.sh @@ -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://$GITHUB_TOKEN@github.com/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)" diff --git a/.ci/waiting_services.sh b/.ci/waiting_services.sh index b2050ef89d..5dbb241d88 100755 --- a/.ci/waiting_services.sh +++ b/.ci/waiting_services.sh @@ -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!" \ No newline at end of file diff --git a/.devcontainer/codespaces-dev/requirements.txt b/.devcontainer/codespaces-dev/requirements.txt index 528e88e771..2f4aecb45a 100644 --- a/.devcontainer/codespaces-dev/requirements.txt +++ b/.devcontainer/codespaces-dev/requirements.txt @@ -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 diff --git a/.devcontainer/codespaces-docs/requirements.txt b/.devcontainer/codespaces-docs/requirements.txt index 3f78d22d3a..eb3dcc4002 100644 --- a/.devcontainer/codespaces-docs/requirements.txt +++ b/.devcontainer/codespaces-docs/requirements.txt @@ -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 diff --git a/.devcontainer/devcontainer-local/requirements.txt b/.devcontainer/devcontainer-local/requirements.txt index 1028f6e99c..1f36ece33a 100644 --- a/.devcontainer/devcontainer-local/requirements.txt +++ b/.devcontainer/devcontainer-local/requirements.txt @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a90f39a1d..92ecafd7b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 @@ -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 @@ -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 }} @@ -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 @@ -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" @@ -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 @@ -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" @@ -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 @@ -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 diff --git a/.github/workflows/linkchecker.yml b/.github/workflows/linkchecker.yml index aaa85a39dd..3ae2891f11 100644 --- a/.github/workflows/linkchecker.yml +++ b/.github/workflows/linkchecker.yml @@ -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/install-dpf-server@v2.3 + with: + dpf-standalone-TOKEN: ${{secrets.PYANSYS_CI_BOT_TOKEN}} - name: "Pull, launch, and validate MAPDL service" id: start_mapdl diff --git a/doc/changelog.d/3082.dependencies.md b/doc/changelog.d/3082.dependencies.md new file mode 100644 index 0000000000..3ec6ead92c --- /dev/null +++ b/doc/changelog.d/3082.dependencies.md @@ -0,0 +1 @@ +build: update ansys-dpf-core \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index fc319fdcc1..9389f9b492 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", @@ -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", diff --git a/tests/common.py b/tests/common.py index 9a7581f843..c375f9cb47 100644 --- a/tests/common.py +++ b/tests/common.py @@ -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(): diff --git a/tests/test_dpf.py b/tests/test_dpf.py index 4d83004ad2..2022b8f5c2 100644 --- a/tests/test_dpf.py +++ b/tests/test_dpf.py @@ -21,8 +21,6 @@ # SOFTWARE. """Test the DPF implementation""" -import os - import pytest from conftest import HAS_DPF, ON_CI, has_dependency, requires @@ -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() @@ -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: @@ -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