Paperspace command-line interface.
1.2K
https://github.com/polymathrobotics/oci/tree/main/paperspace-cli
Command-line interface for the Paperspace cloud.
For Polymath Robotics employees - supplemental internal docs.
Source location: https://github.com/polymathrobotics/oci/tree/main/paperspace-cli
You might want to consider using the Terraform provider instead of this command-line interface (CLI). To do anything useful with the CLI, you have to string together multiple commands together. This is oftentimes easier to do with Terraform than with the raw command-line interface.
Terraform provider example: https://github.com/polymathrobotics/oci/tree/main/paperspace-cli/terraform
Obtain a Paperspace API Key.
For more information on the API, refer to the following:
The Paperspace-Node module looks for the api key:
There are login and logout commands, but they currently don't do
anything. You must pass in the api key via the --apiKey parameter
or with this environment variable.
You can generate an API Keys by going to "My Account > Team settings" then click on the "API Keys" tab.
Make sure you install jq the command line json processor: sudo apt-get update && sudo apt-get install jq.
Many commands require user input, so it is recommended to pass the
--interactive and --tty flags as well:
docker run --rm \
--env=PAPERSPACE_API_KEY \
polymathrobotics/paperspace-cli paperspace jobs machineTypes | less
# Region can be `West Coast (CA1)`, `East Coast (NY2)`, `Europe (AMS1)`
%docker run --rm \
--env=PAPERSPACE_API_KEY \
polymathrobotics/paperspace-cli paperspace machines availability \
--region "West Coast (CA1)" --machineType "GPU+"
{
"available": true
}
% docker run --rm \
--env=PAPERSPACE_API_KEY \
polymathrobotics/paperspace-cli paperspace machines availability \
--region "East Coast (NY2)" --machineType "GPU+"
{
"available": false
}
docker run --rm \
--env=PAPERSPACE_API_KEY \
polymathrobotics/paperspace-cli paperspace templates list | less
Valid entries for region:
West Coast (CA1)East Coast (NY2)Europe (AMS1)https://support.paperspace.com/hc/en-us/articles/234711428-Machine-Pricing
Valid entries for machineType:
C1, C2, C3, C4, C5, C6, C7, C8, C9, C10AirStandardProAdvancedGPU+P4000, P5000, P6000, V100Valid entries for billingType:
monthlyhourlydocker run --rm --interactive --tty \
--env=PAPERSPACE_API_KEY \
polymathrobotics/paperspace-cli paperspace machines create \
--machineName "Testy" \
--region "East Coast (NY2)" \
--machineType "C1" \
--size 50 \
--billingType "hourly" \
--templateId "tkni3aa4" \
--teamId "<team_id>" \
--assignPublicIp true \
--startOnCreate true
PAPERSPACE_MACHINE_ID=$(docker run --rm --tty \
--env=PAPERSPACE_API_KEY \
polymathrobotics/paperspace-cli paperspace machines list | jq -r '.[] | select(.name|test("Testy")) | .id')
docker run --rm --interactive --tty \
--env=PAPERSPACE_API_KEY \
--env=PAPERSPACE_MACHINE_ID \
polymathrobotics/paperspace-cli paperspace machines waitfor \
--machineId "$PAPERSPACE_MACHINE_ID" \
--state "ready"
PAPERSPACE_PUBLIC_IP=$(docker run --rm --tty \
--env=PAPERSPACE_API_KEY \
--env=PAPERSPACE_MACHINE_ID \
polymathrobotics/paperspace-cli paperspace machines list | jq -r '.[] | select(.name|test("Testy")) | .publicIpAddress')
ssh -A "paperspace@${PAPERSPACE_PUBLIC_IP}"
docker run --rm \
--env=PAPERSPACE_API_KEY \
polymathrobotics/paperspace-cli paperspace machines list
# List running machines of a specific type
docker run --rm \
--env=PAPERSPACE_API_KEY \
polymathrobotics/paperspace-cli paperspace machines list | jq -r '.[] | select(.shutdownTimeoutInHours == 168) | .name'
docker run --rm --interactive --tty \
--env=PAPERSPACE_API_KEY \
--env=PAPERSPACE_MACHINE_ID \
polymathrobotics/paperspace-cli paperspace machines stop \
--machineId "$PAPERSPACE_MACHINE_ID"
docker run --rm --interactive --tty \
--env=PAPERSPACE_API_KEY \
--env=PAPERSPACE_MACHINE_ID \
polymathrobotics/paperspace-cli paperspace machines start \
--machineId "$PAPERSPACE_MACHINE_ID"
docker run --rm --interactive --tty \
--env=PAPERSPACE_API_KEY \
--env=PAPERSPACE_MACHINE_ID \
polymathrobotics/paperspace-cli paperspace machines show \
--machineId "$PAPERSPACE_MACHINE_ID"
You cannot disable or set the shutdown timeout on machine creation, but you can set it afterwards via machines update:
docker run --rm --interactive --tty \
--env=PAPERSPACE_API_KEY \
--env=PAPERSPACE_MACHINE_ID \
polymathrobotics/paperspace-cli paperspace machines update \
--machineId "$PAPERSPACE_MACHINE_ID" \
--shutdownTimeoutInHours null
docker run --rm --interactive --tty \
--env=PAPERSPACE_API_KEY \
--env=PAPERSPACE_MACHINE_ID \
polymathrobotics/paperspace-cli paperspace machines destroy \
--machineId "$PAPERSPACE_MACHINE_ID"
Content type
Image
Digest
sha256:991337d9d…
Size
96.1 MB
Last updated
almost 3 years ago
docker pull polymathrobotics/paperspace-cli