Skip to content

Commit d8f2504

Browse files
committed
fix(ci): Free up disk space on runner
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
1 parent 4fe9583 commit d8f2504

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

‎.github/workflows/cluster-faces-test.yml‎

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,18 @@ jobs:
589589
# persisted in the database header, so it survives across connections.
590590
sqlite3 data/nextcloud.db "PRAGMA journal_mode=WAL;"
591591
592+
- name: Free up disk space
593+
run: |
594+
# This job installs the Python ML stack (torch, onnxruntime, insightface
595+
# models) on top of the dataset, which the pure-PHP job does not. On a
596+
# tight runner that pushes the disk to ~97% during classification, which
597+
# aborts the crawl, stalls the ExApp task and locks the (WAL) SQLite DB.
598+
# Drop preinstalled toolchains we don't use to reclaim ~20-30 GB up front.
599+
echo "disk before cleanup: $(df -h / | awk 'NR==2 {print $4" free ("$5" used)"}')"
600+
sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc /usr/local/.ghcup /opt/hostedtoolcache/CodeQL /usr/local/share/powershell /usr/local/share/chromium || true
601+
sudo docker image prune --all --force || true
602+
echo "disk after cleanup: $(df -h / | awk 'NR==2 {print $4" free ("$5" used)"}')"
603+
592604
- name: Enable app_api
593605
run: ./occ app:enable -vvv -f app_api
594606

@@ -720,6 +732,10 @@ jobs:
720732
run: |
721733
# Probe available disk so we can tell whether runs die on ENOSPC.
722734
disk_free() { df -h / | awk 'NR==2 {print $4" free ("$5" used)"}'; }
735+
# Query the DB with a busy timeout so a transient WAL lock (the ExApp and
736+
# cron write concurrently) makes the poll wait instead of failing with
737+
# "database is locked" (exit 5), which would otherwise kill the step.
738+
sq() { sqlite3 -cmd ".timeout 60000" data/nextcloud.db "$1"; }
723739
echo "disk before classification: $(disk_free)"
724740
./occ upgrade # in case server master has new migrations in the meantime
725741
./occ files:scan admin
@@ -733,24 +749,24 @@ jobs:
733749
for i in $(seq 1 180); do
734750
# Clustering is done explicitly in the "Run clustering" step below, so
735751
# drop these jobs before each cron run to keep classification cron fast.
736-
sqlite3 data/nextcloud.db "delete from oc_jobs where class like '%ClusterFacesJob';" || true
752+
sq "delete from oc_jobs where class like '%ClusterFacesJob';" || true
737753
php cron.php || true
738-
QUEUE=$(sqlite3 data/nextcloud.db "select count(*) from oc_recognize_queue_faces;")
739-
CRAWL=$(sqlite3 data/nextcloud.db "select count(*) from oc_jobs where class like '%StorageCrawlJob' or class like '%SchedulerJob';")
754+
QUEUE=$(sq "select count(*) from oc_recognize_queue_faces;")
755+
CRAWL=$(sq "select count(*) from oc_jobs where class like '%StorageCrawlJob' or class like '%SchedulerJob';")
740756
echo "round $i: faces queue=$QUEUE, pending crawl/scheduler jobs=$CRAWL, disk=$(disk_free)"
741757
if [ "$QUEUE" -eq 0 ] && [ "$CRAWL" -eq 0 ] && [ "$i" -gt 3 ]; then break; fi
742758
sleep 10
743759
done
744760
# Wait for the ExApp to finish processing all scheduled TaskProcessing
745761
# tasks (status 0=unknown, 1=scheduled, 2=running are still pending).
746762
for i in $(seq 1 240); do
747-
PENDING=$(sqlite3 data/nextcloud.db "select count(*) from oc_taskprocessing_tasks where app_id = 'recognize' and status in (0, 1, 2);")
763+
PENDING=$(sq "select count(*) from oc_taskprocessing_tasks where app_id = 'recognize' and status in (0, 1, 2);")
748764
echo "wait $i: pending recognize taskprocessing tasks=$PENDING, disk=$(disk_free)"
749765
if [ "$PENDING" -eq 0 ]; then break; fi
750766
sleep 30
751767
done
752768
echo "disk after classification: $(disk_free)"
753-
FAILED=$(sqlite3 data/nextcloud.db "select count(*) from oc_taskprocessing_tasks where app_id = 'recognize' and status = 4;")
769+
FAILED=$(sq "select count(*) from oc_taskprocessing_tasks where app_id = 'recognize' and status = 4;")
754770
echo "failed recognize taskprocessing tasks: $FAILED"
755771
756772
- uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3

0 commit comments

Comments
 (0)