-
Couldn't load subscription status.
- Fork 1
feat: adding PyMAPDL + PyDPF example #89
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
Open
dipinknair
wants to merge
110
commits into
main
Choose a base branch
from
feat/pymapdl-dpf
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 109 commits
Commits
Show all changes
110 commits
Select commit
Hold shift + click to select a range
eb3417b
draft
dipinknair 498eb2d
draft
dipinknair 3a2fa8f
feat: applying latest changes
clatapie 6aa0102
Merge branch 'main' into feat/pymapdl-dpf
clatapie facb2d3
update path
dipinknair 4bfe7bf
update workflow
dipinknair 4d2042f
fix style
dipinknair 4a00f5f
Merge branch 'main' into feat/pymapdl-dpf
dipinknair 0ac3a44
add mapdl py file
dipinknair 97a7814
update checkout
dipinknair fb97a97
change shel script permission
b0c784b
feat: using latest PyMAPDL docker files
clatapie 1b923da
Merge branch 'main' into feat/pymapdl-dpf
clatapie 2c00834
fix: MAPDL workflow
clatapie d29bbc9
fix: MAPDL workflow - 2
clatapie 5263eee
fix: adding missing file
clatapie 54a8b9e
fix: applying @germa89's suggestions
clatapie 21df61a
fix: python version
clatapie 68d167d
fix: applying @germa89 feedback
clatapie 62b7628
fix: adding a venv
clatapie 1fd3bf2
fix: activate venv
clatapie 23dace6
fix: activate venv -2
clatapie f858ee5
fix: applying @germa89 feedback - 2
clatapie 6d80a0f
fix: virtual environment
clatapie 23e4b3c
fix: issue with source
clatapie 99e95b6
fix: removing ` Login to GitHub Container Registry` step
clatapie 7c61be0
fix: trying to fix ``start_mapdl.sh``
clatapie af82ebd
fix: DPF servie and test virtual framebuffer
clatapie 433df22
fix: MAPDL version
clatapie dd550a2
fix: pre-commit
clatapie 366dd8b
fix: commenting step as not used for the moment
clatapie f77b6bf
fix: ``start_mapdl.sh``
clatapie a1ff2ee
fix: removing CICD
clatapie 641f930
fix: removing matrix for testing purpose
clatapie 73a12b9
fix: requirements
clatapie e65dcdb
test: check if PyMAPDL port is free
clatapie 8cb7d37
fix: few fixes in ``start_mapdl``
clatapie 07547d6
fix: ``start_mapdl``
clatapie 63264ed
fix: using ``nc`` approach
clatapie 59db90e
fix: installing netcat
clatapie 9dbac4b
fix: using ``netstat``
clatapie 1425a1e
fix: CICD
clatapie 998f213
fix: MAPDL_PID
clatapie e8b64a0
fix: ``start_mapdl``
clatapie 55e74cf
fix: ``start_mapdl`` - 2
clatapie 093f9db
fix: ``start_mapdl`` - 3
clatapie f6f389b
fix: removing sleep
clatapie db08801
feat: simplifying ``wf_mapdl-dpf.py`` for tests
clatapie 7f72246
fix: pre-commit
clatapie 5c99dfd
fix: make files
clatapie d43d8ef
Merge branch 'main' into feat/pymapdl-dpf
clatapie 07ba8c8
fix: printing the logs
clatapie 5aad9e8
test: reverting doc version
clatapie 6038051
test: reverting doc version + testing MapdlPool
clatapie a865a2c
fix: launching two MAPDL instances
clatapie 6881bb7
fix: MapdlPool
clatapie 631083c
fix: MapdlPool
clatapie 879e241
fix: MapdlPool - 2
clatapie 39b17f4
feat: adding the all example
clatapie 5d91422
fix: example
clatapie 2ea8491
fix: pre-commit
clatapie a39a986
test: calling pydpf
clatapie 45ddb75
fix: pydpf server
clatapie eb8b419
fix: DPF_PORT value
clatapie f9dda24
fix: DPF server
clatapie fc1f9db
fix: env variable
clatapie e3561aa
fix: DPF ports
clatapie 0a29fdc
feat: adding the full example
clatapie 43ce38d
fix: python file
clatapie b18fcd0
fix: running python script in ``xvfb`` mode
clatapie af97bb5
fix: pyvista off_screen
clatapie 7d3242c
fix: pyvista off_screen - 2
clatapie 2dc3d6a
docs: run the doc
clatapie e4f7c9f
fix: documentation build
clatapie bd19bac
fix: install make
clatapie c7738db
fix: requirement files
clatapie 0733db7
feat: adding ``bvp.png`` sketch
clatapie 7c4c034
feat: clean up
clatapie 3a9b70e
Merge branch 'main' into feat/pymapdl-dpf
clatapie 112f1d4
Merge branch 'main' into feat/pymapdl-dpf
clatapie 82792f2
chore: auto fixes from pre-commit hooks
pre-commit-ci[bot] 832da11
docs: adding ``README.rst``
clatapie 386eaf9
feat: outputs stored in ``outputs/mapdl-dpf`` folder
clatapie 1d1cabf
fix: typo
clatapie 5a89dc1
Update mapdl-dpf/wf_mapdl-dpf.py
clatapie 730bd89
feat: move ``.ci`` into ``mapdl-dpf``
clatapie 3988202
fix: file access
clatapie c42c096
Merge branch 'main' into feat/pymapdl-dpf
clatapie e24351d
feat: aligning to other workflows
clatapie c51ee63
Update doc/make.bat
clatapie 386f1c6
fix: removing unused line
clatapie 25d0e61
fix: typo
clatapie 1c9eeab
Merge branch 'main' into feat/pymapdl-dpf
clatapie fd41640
Merge branch 'main' into feat/pymapdl-dpf
clatapie a402c77
fix: applying latest changes from #111
clatapie 19d753d
Update mapdl-dpf/README.rst
clatapie c5488f1
fix: resizing README
clatapie 65f6271
Update mapdl-dpf/wf_mapdl-dpf.py
clatapie 56a564e
Apply suggestions from code review
clatapie 7995e2f
Merge branch 'main' into feat/pymapdl-dpf
clatapie a9302b7
docs: README
clatapie 54efe75
fix: download artifacts in ``docs.yml``
clatapie 37413d1
Apply suggestions from code review
clatapie a0e1577
Apply suggestions from code review
clatapie b58e09b
Apply suggestions from code review
clatapie 7f3bfe9
Update mapdl-dpf/wf_mapdl-dpf.py
clatapie 12307de
fix: ``mapdl-dpf.py``
clatapie 03e800e
fix: pre-commit
clatapie 8b9880a
Merge branch 'main' into feat/pymapdl-dpf
clatapie 717baad
Apply suggestions from code review
clatapie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,197 @@ | ||
| name: MAPDL-DPF Workflow | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| doc-build: | ||
| required: false | ||
| default: false | ||
| type: boolean | ||
| description: 'Whether to build the documentation' | ||
| workflow_call: | ||
| inputs: | ||
| doc-build: | ||
| required: false | ||
| default: false | ||
| type: boolean | ||
| description: 'Whether to build the documentation' | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| paths: | ||
| - 'mapdl-dpf/**' | ||
|
|
||
| env: | ||
| ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER )}} | ||
| MAIN_PYTHON_VERSION: "3.11" | ||
| MAPDL_DOCKER_IMAGE: 'ghcr.io/ansys/mapdl' | ||
| DPF_DOCKER_IMAGE: ghcr.io/ansys/mapdl:v25.2-rocky-dpf-standalone | ||
| PYANSYS_WORKFLOWS_CI: true | ||
| ANSYS_RELEASE_FOR_DOCS: 25.2 | ||
| DPF_START_SERVER: false | ||
| ANSYS_DPF_ACCEPT_LA: Y | ||
| MAPDL_IMAGE_VERSION_DOCS_BUILD: v25.2.4-ubuntu-cicd | ||
| PYMAPDL_PORT_0: 21000 | ||
| PYMAPDL_DB_PORT_0: 21001 | ||
| PYMAPDL_PORT_1: 21002 | ||
| PYMAPDL_DB_PORT_1: 21003 | ||
| DPF_PORT_0: 21004 | ||
| DPF_PORT_1: 21005 | ||
| PYVISTA_OFF_SCREEN: true | ||
|
|
||
| jobs: | ||
|
|
||
| is-only-docs-required: | ||
| uses: ./.github/workflows/check-docs-required.yml | ||
| with: | ||
| doc-build: ${{ inputs.doc-build || false }} | ||
|
|
||
| mapdl-dpf: | ||
| name: MAPDL-DPF | ||
| runs-on: ubuntu-22.04 | ||
| needs: is-only-docs-required | ||
| container: | ||
| image: "ghcr.io/ansys/mapdl:v25.2.4-ubuntu-cicd" | ||
| options: -u=0:0 --oom-kill-disable --memory=6656MB --memory-swap=16896MB --shm-size=1gb --entrypoint /bin/bash | ||
| credentials: | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| ansys-release: ${{ needs.is-only-docs-required.outputs.only-docs == 'true' && fromJSON('[25.2]') || fromJSON('[25.2]') }} | ||
| env: | ||
| PYMAPDL_START_INSTANCE: FALSE | ||
| ON_DOCUMENTATION: TRUE | ||
| ON_CICD: TRUE | ||
|
|
||
| steps: | ||
|
|
||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python ${{ env.MAIN_PYTHON_VERSION }} | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ env.MAIN_PYTHON_VERSION }} | ||
|
|
||
| - name: Create a virtual environment | ||
| shell: bash | ||
| run: | | ||
| python -m venv .venv | ||
| . .venv/bin/activate | ||
| apt-get update && apt-get -y install gcc mono-mcs g++ | ||
|
|
||
| - name: Install dependencies | ||
| shell: bash | ||
| run: | | ||
| . .venv/bin/activate | ||
| python -m pip install --upgrade pip --root-user-action=ignore | ||
| pip install -r mapdl-dpf/requirements_${{ matrix.ansys-release }}.txt --root-user-action=ignore | ||
|
|
||
| - name: "Start MAPDL service directly (inside container)" | ||
| id: start_mapdl | ||
| shell: bash | ||
| env: | ||
| DISTRIBUTED_MODE: "dmp" | ||
| LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} | ||
| MAPDL_VERSION: ${{ env.MAPDL_IMAGE_VERSION_DOCS_BUILD }} | ||
| MAPDL_PACKAGE: ${{ env.MAPDL_DOCKER_IMAGE }} | ||
| ANSYSLMD_LICENSE_FILE: ${{ env.ANSYSLMD_LICENSE_FILE }} | ||
| ANSYS_DPF_ACCEPT_LA: ${{ env.ANSYS_DPF_ACCEPT_LA }} | ||
| run: | | ||
| . .venv/bin/activate | ||
|
|
||
| echo "Launching first MAPDL instance..." | ||
| export INSTANCE_NAME=MAPDL_0 | ||
| export PYMAPDL_PORT=$PYMAPDL_PORT_0 | ||
| export PYMAPDL_DB_PORT=$PYMAPDL_DB_PORT_0 | ||
| export DPF_PORT=$DPF_PORT_0 | ||
| mapdl-dpf/.ci/start_mapdl.sh & export MAPDL_PID=$! | ||
| echo "Launching MAPDL service at PID: $MAPDL_PID" | ||
| echo "MAPDL_PID=$(echo $MAPDL_PID)" >> $GITHUB_OUTPUT | ||
|
|
||
| echo "Launching second MAPDL instance..." | ||
| export INSTANCE_NAME=MAPDL_1 | ||
| export PYMAPDL_PORT=$PYMAPDL_PORT_1 | ||
| export PYMAPDL_DB_PORT=$PYMAPDL_DB_PORT_1 | ||
| export DPF_PORT=$DPF_PORT_1 | ||
| mapdl-dpf/.ci/start_mapdl.sh & export MAPDL_PID_1=$! | ||
| echo "Launching second MAPDL service at PID: $MAPDL_PID_1" | ||
| echo "MAPDL_PID_1=$(echo $MAPDL_PID_1)" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: "DPF server setup" | ||
| shell: bash | ||
| run: | | ||
| . .venv/bin/activate | ||
| echo "DPF service will be available through MAPDL container" | ||
| echo "DPF_PORT: $DPF_PORT" | ||
| # DPF is already available in the MAPDL container | ||
|
|
||
| - name: "Test virtual framebuffer" | ||
| shell: bash | ||
| run: | | ||
| . .venv/bin/activate | ||
| echo "Testing virtual framebuffer..." | ||
| # Install xvfb if not available | ||
| which xvfb-run || (apt-get update && apt-get install -y xvfb) | ||
|
|
||
| # Test display if the script exists | ||
| if [ -f "mapdl-dpf/.ci/display_test.py" ]; then | ||
| xvfb-run python mapdl-dpf/.ci/display_test.py | ||
| else | ||
| echo "Display test script not found, skipping..." | ||
| fi | ||
|
|
||
| - name: "Retrieve PyMAPDL version" | ||
| id: version | ||
| shell: bash | ||
| run: | | ||
| . .venv/bin/activate | ||
| echo "PYMAPDL_VERSION=$(python -c 'from ansys.mapdl.core import __version__; print(__version__)')" >> $GITHUB_OUTPUT | ||
| echo "PyMAPDL version is: $(python -c "from ansys.mapdl.core import __version__; print(__version__)")" | ||
|
|
||
| - name: Run the MAPDL-DPF script | ||
| shell: bash | ||
| env: | ||
| LIBGL_ALWAYS_SOFTWARE: 1 | ||
| PYANSYS_VISUALIZER_HTML_BACKEND: true | ||
| run: | | ||
| . .venv/bin/activate | ||
| echo "Building MAPDL-DPF workflow..." | ||
| echo "PYMAPDL_START_INSTANCE: $PYMAPDL_START_INSTANCE" | ||
| xvfb-run python mapdl-dpf/wf_mapdl-dpf.py | ||
|
|
||
| - name: "Install make" | ||
| shell: bash | ||
| run: | | ||
| apt-get update -qq && apt-get install -y make | ||
|
|
||
| - name: (DOCS) Build the documentation (only on ${{ env.ANSYS_RELEASE_FOR_DOCS}}) | ||
| if: needs.is-only-docs-required.outputs.only-docs == 'true' && matrix.ansys-release == env.ANSYS_RELEASE_FOR_DOCS | ||
| shell: bash | ||
| env: | ||
| BUILD_DOCS_SCRIPT: 'mapdl-dpf/wf_mapdl-dpf.py' | ||
| run: | | ||
| . .venv/bin/activate | ||
| cd doc | ||
| pip install -r requirements.txt --root-user-action=ignore | ||
| xvfb-run make html | ||
|
|
||
| - name: (DOCS) Upload docs artifacts | ||
| if: needs.is-only-docs-required.outputs.only-docs == 'true' && matrix.ansys-release == env.ANSYS_RELEASE_FOR_DOCS | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: mapdl-dpf-docs | ||
| path: | | ||
| doc/_build/ | ||
| doc/source/examples/mapdl-dpf/ | ||
| overwrite: true | ||
|
|
||
| - name: print MAPDL log | ||
| if: failure() | ||
| shell: bash | ||
| run: | | ||
| echo "Printing MAPDL log for debugging..." | ||
| cat MAPDL_0.log | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # Copyright (C) 2024 - 2025 ANSYS, Inc. and/or its affiliates. | ||
| # SPDX-License-Identifier: MIT | ||
| # | ||
| # | ||
| # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| # of this software and associated documentation files (the "Software"), to deal | ||
| # in the Software without restriction, including without limitation the rights | ||
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| # copies of the Software, and to permit persons to whom the Software is | ||
| # furnished to do so, subject to the following conditions: | ||
| # | ||
| # The above copyright notice and this permission notice shall be included in all | ||
| # copies or substantial portions of the Software. | ||
| # | ||
| # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| # SOFTWARE. | ||
|
|
||
| """Quickly check if VTK off screen plotting works.""" | ||
|
|
||
| import pyvista | ||
| from pyvista.plotting import system_supports_plotting | ||
|
|
||
| print("system_supports_plotting", system_supports_plotting()) | ||
| pyvista.OFF_SCREEN = True | ||
| pyvista.plot(pyvista.Sphere()) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.