-
Notifications
You must be signed in to change notification settings - Fork 396
infra: start gpu server every 24hs #2287
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
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| name: "Start Aggregation Mode Server" | ||
|
|
||
| # Starts the Paperspace GPU server that runs the aggregation mode. | ||
| # | ||
| # The server is kept powered off to avoid 24/7 billing. This workflow boots it | ||
| # once a day; on boot the machine runs `aggregation_mode.service`, which executes | ||
| # the SP1 aggregations and then powers the machine off again | ||
| # (see infra/aggregation_mode/run.sh). | ||
| on: | ||
| schedule: | ||
| # 15:00 UTC == 12:00 GMT-3, every day. GitHub Actions cron is always in UTC. | ||
| - cron: "0 15 * * *" | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
|
JuArce marked this conversation as resolved.
|
||
| start-server: | ||
| name: Start Paperspace aggregation server | ||
|
JuArce marked this conversation as resolved.
|
||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| permissions: {} | ||
| steps: | ||
| - name: Start Paperspace machine | ||
| env: | ||
| PAPERSPACE_API_KEY: ${{ secrets.PAPERSPACE_API_KEY }} | ||
| MACHINE_ID: ${{ secrets.PAPERSPACE_MACHINE_ID }} | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| if [ -z "${PAPERSPACE_API_KEY}" ] || [ -z "${MACHINE_ID}" ]; then | ||
| echo "::error::PAPERSPACE_API_KEY and PAPERSPACE_MACHINE_ID secrets must be set." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Starting Paperspace machine ${MACHINE_ID}..." | ||
| http_code=$(curl -sS --max-time 30 -o response.json -w "%{http_code}" \ | ||
| -X PATCH "https://api.paperspace.com/v1/machines/${MACHINE_ID}/start" \ | ||
| -H "Authorization: Bearer ${PAPERSPACE_API_KEY}") | ||
|
|
||
| echo "Paperspace API responded with HTTP ${http_code}" | ||
|
|
||
| # 2xx means the start request was accepted. | ||
| if [ "${http_code}" -lt 200 ] || [ "${http_code}" -ge 300 ]; then | ||
| # Only dump the response body on failure: a successful start response | ||
| # contains the full machine object (public IP, network details, etc.), | ||
| # which GitHub Actions would not mask in the log. | ||
| echo "::error::Failed to start Paperspace machine (HTTP ${http_code})." | ||
| cat response.json || true | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Start request accepted. The machine will run the aggregation on boot and shut itself down afterwards." | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.