From 96ebee5d58daf4bc1a8470797d6d7c63c61d3680 Mon Sep 17 00:00:00 2001 From: German Date: Fri, 8 Mar 2024 13:27:27 +0100 Subject: [PATCH 1/3] Using only one script to launch MAPDL --- .ci/start_mapdl.sh | 36 +++++++++++++++++++++++++++++++----- .ci/start_mapdl_student.sh | 18 ------------------ .ci/start_mapdl_ubuntu.sh | 24 ------------------------ .github/workflows/ci.yml | 28 +++++----------------------- 4 files changed, 36 insertions(+), 70 deletions(-) delete mode 100755 .ci/start_mapdl_student.sh delete mode 100755 .ci/start_mapdl_ubuntu.sh diff --git a/.ci/start_mapdl.sh b/.ci/start_mapdl.sh index f69a2f8dab..dfb7b7eb32 100755 --- a/.ci/start_mapdl.sh +++ b/.ci/start_mapdl.sh @@ -1,6 +1,31 @@ #!/bin/bash +echo "MAPDL_VERSION: $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" \ @@ -14,10 +39,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) diff --git a/.ci/start_mapdl_student.sh b/.ci/start_mapdl_student.sh deleted file mode 100755 index 2c927913b2..0000000000 --- a/.ci/start_mapdl_student.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -docker pull "$MAPDL_IMAGE" -docker run \ - --entrypoint "/bin/bash" \ - --name mapdl \ - --restart always \ - -e ANSYS_LOCK="OFF" \ - -p "$PYMAPDL_PORT":50052 \ - -p "$PYMAPDL_DB_PORT":50055 \ - --shm-size=1gb \ - -e I_MPI_SHM_LMT=shm \ - -e P_SCHEMA=/ansys_inc/v241/ansys/ac4/schema \ - -w /jobs \ - -u=0:0 \ - --memory=6656MB \ - --memory-swap=16896MB \ - "$MAPDL_IMAGE" /ansys_inc/v241/ansys/bin/mapdl -grpc -dir /jobs -"$DISTRIBUTED_MODE" -np 2 > log.txt & -# grep -q 'Server listening on' <(timeout 60 tail -f log.txt) diff --git a/.ci/start_mapdl_ubuntu.sh b/.ci/start_mapdl_ubuntu.sh deleted file mode 100755 index 123e4a789c..0000000000 --- a/.ci/start_mapdl_ubuntu.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -docker pull "$MAPDL_IMAGE" -docker run \ - --entrypoint "/bin/bash" \ - --name mapdl \ - --restart always \ - --health-cmd="ps aux | grep \"[/]ansys_inc/.*ansys\.e.*grpc\" -q && echo 0 || echo 1" \ - --health-interval=0.5s \ - --health-retries=4 \ - --health-timeout=0.5s \ - --health-start-period=10s \ - -e ANSYSLMD_LICENSE_FILE=1055@"$LICENSE_SERVER" \ - -e ANSYS_LOCK="OFF" \ - -p "$PYMAPDL_PORT":50052 \ - -p "$PYMAPDL_DB_PORT":50055 \ - --shm-size=1gb \ - -e I_MPI_SHM_LMT=shm \ - -e P_SCHEMA=/ansys_inc/v222/ansys/ac4/schema \ - -w /jobs \ - -u=0:0 \ - --memory=6656MB \ - --memory-swap=16896MB \ - "$MAPDL_IMAGE" /ansys_inc/v222/ansys/bin/mapdl -grpc -dir /jobs -"$DISTRIBUTED_MODE" -np 2 > log.txt & -grep -q 'Server listening on' <(timeout 60 tail -f log.txt) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9dd8b211a8..f074f13e97 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -166,7 +166,7 @@ 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 }}' DISTRIBUTED_MODE: "dmp" @@ -394,28 +394,10 @@ 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 }} + MAPDL_IMAGE: ${{ env.DOCKER_PACKAGE }}:${{ matrix.mapdl-version }} + DISTRIBUTED_MODE: ${{ steps.distributed_mode.outputs.distributed_mode }} + run: .ci/start_mapdl.sh - name: "Unit testing requirements installation" run: | From 40a7dc47732634d7c53b0dc74255b2a34b73f356 Mon Sep 17 00:00:00 2001 From: German Date: Fri, 8 Mar 2024 14:00:51 +0100 Subject: [PATCH 2/3] Fixing doc build --- .ci/start_mapdl.sh | 2 ++ .github/workflows/ci.yml | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.ci/start_mapdl.sh b/.ci/start_mapdl.sh index dfb7b7eb32..4a650a168a 100755 --- a/.ci/start_mapdl.sh +++ b/.ci/start_mapdl.sh @@ -1,5 +1,7 @@ #!/bin/bash echo "MAPDL_VERSION: $MAPDL_VERSION" + +export MAPDL_IMAGE="$MAPDL_PACKAGE:$MAPDL_VERSION" echo "MAPDL_IMAGE: $MAPDL_IMAGE" docker pull "$MAPDL_IMAGE" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f074f13e97..7478239ac5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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' @@ -168,7 +168,8 @@ jobs: - name: "Pull, launch, and validate MAPDL service" 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" @@ -395,7 +396,6 @@ jobs: env: LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} MAPDL_VERSION: ${{ matrix.mapdl-version }} - MAPDL_IMAGE: ${{ env.DOCKER_PACKAGE }}:${{ matrix.mapdl-version }} DISTRIBUTED_MODE: ${{ steps.distributed_mode.outputs.distributed_mode }} run: .ci/start_mapdl.sh From 6a5d6b1393b35b306a802683618d96dc11bc4e2a Mon Sep 17 00:00:00 2001 From: German Date: Fri, 8 Mar 2024 16:55:33 +0100 Subject: [PATCH 3/3] Avoiding codacy issue --- .ci/start_mapdl.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/start_mapdl.sh b/.ci/start_mapdl.sh index 4a650a168a..cb6453770c 100755 --- a/.ci/start_mapdl.sh +++ b/.ci/start_mapdl.sh @@ -41,11 +41,11 @@ docker run \ -p "$PYMAPDL_DB_PORT":50055 \ --shm-size=1gb \ -e I_MPI_SHM_LMT=shm \ - -e P_SCHEMA=$P_SCHEMA \ + -e P_SCHEMA="$P_SCHEMA" \ -w /jobs \ -u=0:0 \ --memory=6656MB \ --memory-swap=16896MB \ - "$MAPDL_IMAGE" $EXEC_PATH -grpc -dir /jobs -"$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)