Skip to content

fix: reducing space consumption in GitHub runners #3900

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

Merged
merged 24 commits into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
eb327e1
feat: add disk space usage reporting and cleanup steps in local testi…
germa89 May 7, 2025
a7bafbf
feat: add disk space cleanup step before build in local testing workflow
germa89 May 7, 2025
1c9746d
chore: adding changelog file 3900.fixed.md [dependabot-skip]
pyansys-ci-bot May 7, 2025
7e6c2ba
feat: enhance disk space reporting in local testing workflow
germa89 May 7, 2025
0e6e683
Merge branch 'fix/reducing-space-consumption-in-github-runners' of ht…
germa89 May 7, 2025
7f52e41
fix: update disk usage reporting to show current directory size
germa89 May 7, 2025
c052c99
fix: improve disk usage reporting with error handling in local testin…
germa89 May 7, 2025
e3a04ea
fix: remove redundant disk usage checks and streamline reporting in l…
germa89 May 7, 2025
b194467
fix: replace cp with mv for log file handling in local and remote scr…
germa89 May 7, 2025
c88cb46
fix: update log file handling to create directories before moving fil…
germa89 May 7, 2025
e949dcc
Merge branch 'main' into fix/reducing-space-consumption-in-github-run…
germa89 May 7, 2025
23323c4
fix: update tar command to remove files after compression in log coll…
germa89 May 8, 2025
14ffadd
fix: update pytest arguments to exclude logs on passed tests in local…
germa89 May 8, 2025
34ed6fd
fix: add disk usage checks for runner directories in local testing wo…
germa89 May 8, 2025
2fb273f
Merge branch 'main' into fix/reducing-space-consumption-in-github-run…
germa89 May 8, 2025
1731c67
fix: add disk usage check for CodeQL directory in local testing workflow
germa89 May 8, 2025
a1b2591
Merge branch 'fix/reducing-space-consumption-in-github-runners' of ht…
germa89 May 8, 2025
28ccacc
fix: remove CodeQL directory after disk usage check in local testing …
germa89 May 8, 2025
a943ba6
fix: enhance disk usage reporting and cleanup for CodeQL directory in…
germa89 May 8, 2025
cfa510d
fix: streamline disk usage reporting and cleanup for CodeQL directory…
germa89 May 8, 2025
e5a848d
chore: Update .ci/collect_mapdl_logs_remote.sh
germa89 May 8, 2025
42cbf76
chore: adding changelog file 3900.fixed.md [dependabot-skip]
pyansys-ci-bot May 8, 2025
d92ab8d
fix: add pre-test and post-test disk space reporting and cleanup for …
germa89 May 8, 2025
a17d39f
Merge branch 'fix/reducing-space-consumption-in-github-runners' of ht…
germa89 May 8, 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
13 changes: 7 additions & 6 deletions .ci/collect_mapdl_logs_locals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
mkdir "$LOG_NAMES" && echo "Successfully generated directory $LOG_NAMES"

echo "Copying the log files..."
cp *.log ./"$LOG_NAMES"/ || echo "No log files could be found"
cp *apdl.out ./"$LOG_NAMES"/ || echo "No APDL log files could be found"
cp *pymapdl.apdl ./"$LOG_NAMES"/ || echo "No PYMAPDL APDL log files could be found"
mv *.log ./"$LOG_NAMES"/ || echo "No log files could be found"
mv *apdl.out ./"$LOG_NAMES"/ || echo "No APDL log files could be found"
mv *pymapdl.apdl ./"$LOG_NAMES"/ || echo "No PYMAPDL APDL log files could be found"

echo "Copying the profiling files..."
cp -r prof ./"$LOG_NAMES"/prof || echo "No profile files could be found"
mkdir -p ./"$LOG_NAMES"/prof
mv prof/* ./"$LOG_NAMES"/prof || echo "No profile files could be found"

echo "Copying the JSONL files..."
cp *.jsonl ./"$LOG_NAMES"/ || echo "No JSONL files could be found"
mv *.jsonl ./"$LOG_NAMES"/ || echo "No JSONL files could be found"

ls -la ./"$LOG_NAMES"

echo "Tar files..."
tar cvzf ./"$LOG_NAMES".tgz ./"$LOG_NAMES" || echo "Failed to compress"
tar --remove-files -cvzf ./"$LOG_NAMES".tgz ./"$LOG_NAMES" || echo "Failed to compress"
30 changes: 14 additions & 16 deletions .ci/collect_mapdl_logs_remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,41 @@ if [[ $MAPDL_VERSION == *"ubuntu"* ]] ; then
echo "It is an ubuntu based image"
export FILE=/jobs/file
export WDIR='/jobs/'

else
echo "It is a CentOS based image"
export FILE=file
export WDIR=""

fi;


mkdir "$LOG_NAMES" && echo "Successfully generated directory $LOG_NAMES"

####
echo "Collecting MAPDL logs..."

(docker exec "$MAPDL_INSTANCE" /bin/bash -c "mkdir -p /mapdl_logs && echo 'Successfully created directory inside docker container'") || echo "Failed to create a directory inside docker container for logs."
(docker exec "$MAPDL_INSTANCE" /bin/bash -c "if compgen -G '$FILE*.out' > /dev/null ;then cp -f /file*.out /mapdl_logs && echo 'Successfully copied out files.'; fi") || echo "Failed to copy the 'out' files into a local file"
(docker exec "$MAPDL_INSTANCE" /bin/bash -c "if compgen -G '$FILE*.err' > /dev/null ;then cp -f /file*.err /mapdl_logs && echo 'Successfully copied err files.'; fi") || echo "Failed to copy the 'err' files into a local file"
(docker exec "$MAPDL_INSTANCE" /bin/bash -c "if compgen -G '$FILE*.log' > /dev/null ;then cp -f /file*.log /mapdl_logs && echo 'Successfully copied log files.'; fi") || echo "Failed to copy the 'log' files into a local file"
(docker exec "$MAPDL_INSTANCE" /bin/bash -c "if compgen -G '$WDIR*.crash' > /dev/null ;then cp -f /*.crash /mapdl_logs && echo 'Successfully copied crash files.'; fi") || echo "Failed to copy the 'crash' files into a local file"
(docker exec "$MAPDL_INSTANCE" /bin/bash -c "if compgen -G '$FILE*.out' > /dev/null ;then mv -f /file*.out /mapdl_logs && echo 'Successfully moved out files.'; fi") || echo "Failed to move the 'out' files into a local file"
(docker exec "$MAPDL_INSTANCE" /bin/bash -c "if compgen -G '$FILE*.err' > /dev/null ;then mv -f /file*.err /mapdl_logs && echo 'Successfully moved err files.'; fi") || echo "Failed to move the 'err' files into a local file"
(docker exec "$MAPDL_INSTANCE" /bin/bash -c "if compgen -G '$FILE*.log' > /dev/null ;then mv -f /file*.log /mapdl_logs && echo 'Successfully moved log files.'; fi") || echo "Failed to move the 'log' files into a local file"
(docker exec "$MAPDL_INSTANCE" /bin/bash -c "if compgen -G '$WDIR*.crash' > /dev/null ;then mv -f $WDIR*.crash /mapdl_logs && echo 'Successfully moved crash files.'; fi") || echo "Failed to move the 'crash' files into a local file"

docker cp "$MAPDL_INSTANCE":/mapdl_logs/. ./"$LOG_NAMES"/. || echo "Failed to copy the 'log-build-docs' files into a local directory"

####
echo "Collecting local build logs..."

echo "Collecting docker run log..."
cp log.txt ./"$LOG_NAMES"/log.txt || echo "MAPDL run docker log not found."
mv log.txt ./"$LOG_NAMES"/log.txt || echo "MAPDL run docker log not found."

echo "Copying docker launch log..."
cp mapdl_launch_0.log ./"$LOG_NAMES"/mapdl_launch_0.log || echo "MAPDL launch docker log not found."
cp mapdl_launch_1.log ./"$LOG_NAMES"/mapdl_launch_1.log || echo "MAPDL launch docker log not found."
echo "Moving docker launch log..."
mv mapdl_launch_0.log ./"$LOG_NAMES"/mapdl_launch_0.log || echo "MAPDL launch docker log not found."
mv mapdl_launch_1.log ./"$LOG_NAMES"/mapdl_launch_1.log || echo "MAPDL launch docker log not found."

echo "Copying the profiling files..."
cp -r prof ./"$LOG_NAMES"/prof || echo "No profile files could be found"
echo "Moving the profiling files..."
mkdir -p ./"$LOG_NAMES"/prof
mv prof/* ./"$LOG_NAMES"/prof || echo "No profile files could be found"

echo "Copying the JSONL files..."
cp *.jsonl ./"$LOG_NAMES"/ || echo "No JSONL files could be found"
echo "Moving the JSONL files..."
mv *.jsonl ./"$LOG_NAMES"/ || echo "No JSONL files could be found"

echo "Collecting file structure..."
ls -R > ./"$LOG_NAMES"/files_structure.txt || echo "Failed to copy file structure to a file"
Expand All @@ -48,4 +46,4 @@ echo "Collecting docker file structure..."
docker exec "$MAPDL_INSTANCE" /bin/bash -c "ls -R" > ./"$LOG_NAMES"/docker_files_structure.txt || echo "Failed to copy the docker structure into a local file"

echo "Tar files..."
tar cvzf ./"$LOG_NAMES".tgz ./"$LOG_NAMES" || echo "Failed to compress"
tar --remove-files -cvzf ./"$LOG_NAMES".tgz ./"$LOG_NAMES" || echo "Failed to compress"
21 changes: 18 additions & 3 deletions .github/workflows/test-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:
TESTING_MINIMAL: ${{ inputs.testing-minimal }}
P_SCHEMA: "/ansys_inc/v241/ansys/ac4/schema"
PYTEST_TIMEOUT: 120 # seconds. Limit the duration for each unit test
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 -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 --report-log-exclude-logs-on-passed-tests'
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1

Expand All @@ -132,6 +132,15 @@ jobs:
password: ${{ secrets.token }}

steps:
- name: "Freeing some space and show space consumption (pre-test)"
shell: bash
run: |
echo "Deleting CodeQL..."
rm -rf /__t/CodeQL || echo "CodeQL not found"

echo "Disk space:"
df -h

- name: "Install Git and checkout project"
uses: actions/checkout@v4.2.2
with:
Expand Down Expand Up @@ -162,13 +171,13 @@ jobs:
shell: bash
if: inputs.testing-minimal == true
run: |
apt-get update && apt install -y libgomp1 graphviz
apt-get update && apt install -y libgomp1 graphviz && apt-get clean

- name: "Installing OS packages"
shell: bash
if: inputs.testing-minimal == false
run: |
apt-get update && apt install -y libgl1-mesa-glx xvfb libgomp1 graphviz
apt-get update && apt install -y libgl1-mesa-glx xvfb libgomp1 graphviz && apt-get clean

- name: "Setup Python"
uses: actions/setup-python@v5
Expand Down Expand Up @@ -289,3 +298,9 @@ jobs:
name: ${{ inputs.file-name }}.xml
path: ./${{ inputs.file-name }}.xml

- name: "Show space consumption (post-test)"
if: always()
shell: bash
run: |
echo "Disk space:"
df -h
20 changes: 18 additions & 2 deletions .github/workflows/test-remote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,19 @@ jobs:
PYMAPDL_DB_PORT2: 21003 # default won't work on GitHub runners
DPF_PORT: 21004
DPF_START_SERVER: False
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 -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 --report-log-exclude-logs-on-passed-tests'
MAPDL_PACKAGE: ghcr.io/ansys/mapdl

steps:
- name: "Freeing some space and show space consumption (pre-test)"
shell: bash
run: |
echo "Deleting CodeQL..."
rm -rf /__t/CodeQL || echo "CodeQL not found"

echo "Disk space:"
df -h

- name: "Install Git and checkout project"
uses: actions/checkout@v4.2.2

Expand Down Expand Up @@ -263,4 +272,11 @@ jobs:
LOG_NAMES: logs-${{ inputs.file-name }}
shell: bash
run: |
.ci/display_logs_remote.sh
.ci/display_logs_remote.sh

- name: "Show space consumption (post-test)"
if: always()
shell: bash
run: |
echo "Disk space:"
df -h
1 change: 1 addition & 0 deletions doc/changelog.d/3900.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix: reducing space consumption in GitHub runners
Loading