Skip to content
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

Using only one script to launch MAPDL #2863

Merged
merged 3 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
38 changes: 33 additions & 5 deletions .ci/start_mapdl.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
#!/bin/bash
echo "MAPDL_VERSION: $MAPDL_VERSION"

export MAPDL_IMAGE="$MAPDL_PACKAGE:$MAPDL_VERSION"
echo "MAPDL_IMAGE: $MAPDL_IMAGE"
docker pull "$MAPDL_IMAGE"

export MAJOR=$(echo "$MAPDL_VERSION" | head -c 3 | tail -c 2)
export MINOR=$(echo "$MAPDL_VERSION" | head -c 5 | tail -c 1)

export VERSION="$MAJOR$MINOR"
echo "MAPDL VERSION: $VERSION"


if [[ $MAPDL_VERSION == *"ubuntu"* ]] ; then
echo "It is an ubuntu based image"
export EXEC_PATH=/ansys_inc/v$VERSION/ansys/bin/mapdl
export P_SCHEMA=/ansys_inc/v$VERSION/ansys/ac4/schema

else
echo "It is a CentOS based image"
export EXEC_PATH=/ansys_inc/ansys/bin/mapdl
export P_SCHEMA=/ansys_inc/ansys/ac4/schema
fi;

echo "EXEC_PATH: $EXEC_PATH"
echo "P_SCHEMA: $P_SCHEMA"

docker run \
--entrypoint "/bin/bash" \
--name mapdl \
--restart always \
--health-cmd="ps aux | grep \"[/]ansys_inc/.*ansys\.e.*grpc\" -q && echo 0 || echo 1" \
Expand All @@ -14,10 +41,11 @@ docker run \
-p "$PYMAPDL_DB_PORT":50055 \
--shm-size=1gb \
-e I_MPI_SHM_LMT=shm \
-e P_SCHEMA=/ansys_inc/ansys/ac4/schema \
--oom-kill-disable \
--memory=6656MB \
-e P_SCHEMA="$P_SCHEMA" \
-w /jobs \
-u=0:0 \
--memory=6656MB \
--memory-swap=16896MB \
"$MAPDL_IMAGE" \
-"$DISTRIBUTED_MODE" -np 2 > log.txt &
"$MAPDL_IMAGE" "$EXEC_PATH" -grpc -dir /jobs -"$DISTRIBUTED_MODE" -np 2 > log.txt &

grep -q 'Server listening on' <(timeout 60 tail -f log.txt)
18 changes: 0 additions & 18 deletions .ci/start_mapdl_student.sh

This file was deleted.

24 changes: 0 additions & 24 deletions .ci/start_mapdl_ubuntu.sh

This file was deleted.

34 changes: 8 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ env:
PYANSYS_OFF_SCREEN: True
DPF_START_SERVER: False
DPF_PORT: 21002
DOCKER_PACKAGE: ghcr.io/ansys/mapdl
DOCKER_IMAGE_VERSION_DOCS_BUILD: v24.1-ubuntu-student
MAPDL_PACKAGE: ghcr.io/ansys/mapdl
MAPDL_IMAGE_VERSION_DOCS_BUILD: v24.1-ubuntu-student
ON_CI: True
PYTEST_ARGUMENTS: '-vv --durations=10 --maxfail=3 --reruns 3 --reruns-delay 4 --cov=ansys.mapdl.core --cov-report=html'

Expand Down Expand Up @@ -166,9 +166,10 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: "Pull, launch, and validate MAPDL service"
run: .ci/start_mapdl_student.sh
run: .ci/start_mapdl.sh
env:
MAPDL_IMAGE: '${{ env.DOCKER_PACKAGE }}:${{ env.DOCKER_IMAGE_VERSION_DOCS_BUILD }}'
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
MAPDL_VERSION: ${{ env.MAPDL_IMAGE_VERSION_DOCS_BUILD }}
DISTRIBUTED_MODE: "dmp"

- name: "Retrieve PyMAPDL version"
Expand Down Expand Up @@ -394,28 +395,9 @@ jobs:
- name: "Pull, launch, and validate MAPDL service"
env:
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
run: |
export MAPDL_VERSION=${{ matrix.mapdl-version }}
export MAPDL_IMAGE=${{ env.DOCKER_PACKAGE }}:${{ matrix.mapdl-version }}
export DISTRIBUTED_MODE=${{ steps.distributed_mode.outputs.distributed_mode }}

echo "MAPDL_VERSION: $MAPDL_VERSION"
echo "MAPDL_IMAGE: $MAPDL_IMAGE"

if [[ $MAPDL_VERSION == *"ubuntu-student"* ]] ; then
echo "It is student version (ubuntu-based)."
echo "No license server is needed."
.ci/start_mapdl_student.sh

elif [[ $MAPDL_VERSION == *"ubuntu"* ]] ; then
echo "It is an ubuntu based image"
.ci/start_mapdl_ubuntu.sh

else
echo "It is a CentOS based image"
.ci/start_mapdl.sh

fi;
MAPDL_VERSION: ${{ matrix.mapdl-version }}
DISTRIBUTED_MODE: ${{ steps.distributed_mode.outputs.distributed_mode }}
run: .ci/start_mapdl.sh

- name: "Unit testing requirements installation"
run: |
Expand Down
Loading