Skip to content

Commit 0f6642b

Browse files
authored
Merge branch 'testnet' into update_claim_contracts_with_base
2 parents 8baa95f + 8fec550 commit 0f6642b

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: "Start Aggregation Mode Server"
2+
3+
# Starts the Paperspace GPU server that runs the aggregation mode.
4+
#
5+
# The server is kept powered off to avoid 24/7 billing. This workflow boots it
6+
# once a day; on boot the machine runs `aggregation_mode.service`, which executes
7+
# the SP1 aggregations and then powers the machine off again
8+
# (see infra/aggregation_mode/run.sh).
9+
on:
10+
schedule:
11+
# 15:00 UTC == 12:00 GMT-3, every day. GitHub Actions cron is always in UTC.
12+
- cron: "0 15 * * *"
13+
workflow_dispatch:
14+
15+
jobs:
16+
start-server:
17+
name: Start Paperspace aggregation server
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 5
20+
permissions: {}
21+
steps:
22+
- name: Start Paperspace machine
23+
env:
24+
PAPERSPACE_API_KEY: ${{ secrets.PAPERSPACE_API_KEY }}
25+
MACHINE_ID: ${{ secrets.PAPERSPACE_MACHINE_ID }}
26+
run: |
27+
set -euo pipefail
28+
29+
if [ -z "${PAPERSPACE_API_KEY}" ] || [ -z "${MACHINE_ID}" ]; then
30+
echo "::error::PAPERSPACE_API_KEY and PAPERSPACE_MACHINE_ID secrets must be set."
31+
exit 1
32+
fi
33+
34+
echo "Starting Paperspace machine ${MACHINE_ID}..."
35+
http_code=$(curl -sS --max-time 30 -o response.json -w "%{http_code}" \
36+
-X PATCH "https://api.paperspace.com/v1/machines/${MACHINE_ID}/start" \
37+
-H "Authorization: Bearer ${PAPERSPACE_API_KEY}")
38+
39+
echo "Paperspace API responded with HTTP ${http_code}"
40+
41+
# 2xx means the start request was accepted.
42+
if [ "${http_code}" -lt 200 ] || [ "${http_code}" -ge 300 ]; then
43+
# Only dump the response body on failure: a successful start response
44+
# contains the full machine object (public IP, network details, etc.),
45+
# which GitHub Actions would not mask in the log.
46+
echo "::error::Failed to start Paperspace machine (HTTP ${http_code})."
47+
cat response.json || true
48+
exit 1
49+
fi
50+
51+
echo "Start request accepted. The machine will run the aggregation on boot and shut itself down afterwards."

0 commit comments

Comments
 (0)