Skip to main content

Python SDK for the Denvr Cloud API

Project description

denvr

A Python SDK for interacting with Denvr Cloud.

GitHub Actions Workflow Status Coveralls Swagger Validator Denvrpy Docs Denvr Dataworks Docs Denvr Dataworks Registration


This package is largely autogenerated from our Denvr Cloud API Spec

Installation

pip install denvr

Quickstart

Getting started with the denvr python sdk just involves loading and calling the client builder function, which returns a Client object for each denvr service (e.g., clusters, vpcs, servers/virtual).

import json
from denvr.client import client
virtual = client('servers/virtual')

Lets start by fetching some of Denvr's VM configurations. We'll use json.dumps to make the output a bit easier to read.

print(json.dumps(virtual.get_configurations(), indent=2))
{
  "items": [
    {
      "id": 5,
      "user_friendly_name": "A100_40GB_PCIe_1x",
      "name": "A100_40GB_PCIe_1x",
      "description": null,
      "os_version": "20.04",
      "os_type": "Ubuntu",
      "storage": 1700,
      "gpu_type": "nvidia.com/A100PCIE40GB",
      "gpu_family": "NVIDIA A100",
      "gpu_brand": "Nvidia",
      "gpu_name": "A100 40GB PCIe",
      "type": "nvidia.com/A100PCIE40GB",
      "brand_family": "NVIDIA A100",
      "brand": "Nvidia",
      "text_name": "A100 40GB PCIe",
      "gpus": 1,
      "vcpus": 14,
      "memory": 112,
      "price": 2.05,
      "compute_network": null,
      "is_gpu_platform": true,
      "clusters": [
        "Hou1",
        "Msc1"
      ]
    },
    {
      "id": 6,
      "user_friendly_name": "A100_40GB_PCIe_2x",
      "name": "A100_40GB_PCIe_2x",
      "description": null,
      "os_version": "20.04",
      "os_type": "Ubuntu",
      "storage": 3400,
      "gpu_type": "nvidia.com/A100PCIE40GB",
      "gpu_family": "NVIDIA A100",
      "gpu_brand": "Nvidia",
      "gpu_name": "A100 40GB PCIe",
      "type": "nvidia.com/A100PCIE40GB",
      "brand_family": "NVIDIA A100",
      "brand": "Nvidia",
      "text_name": "A100 40GB PCIe",
      "gpus": 2,
      "vcpus": 28,
      "memory": 224,
      "price": 4.1,
      "compute_network": null,
      "is_gpu_platform": true,
      "clusters": [
        "Hou1",
        "Msc1"
      ]
    },
    ...

Next we'll try Creating a new virtual machine:

print(json.dumps(
    virtual.create_server(
        name="api-test",
        rpool="on-demand",
        vpc="denvr",
        configuration="H100_80GB_SXM_8x",
        cluster="Hou1",
        ssh_keys=["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAA..."],
        operating_system_image="Ubuntu 22.04.4 LTS",
        root_disk_size=500,
    ),
    indent=2
))
{
  "username": "rory@denvrdata.com",
  "tenancy_name": "denvr",
  "rpool": "on-demand",
  "direct_attached_storage_persisted": false,
  "id": "api-test",
  "namespace": "denvr",
  "configuration": "H100_80GB_SXM_8x",
  "storage": 20000,
  "gpu_type": "nvidia.com/H100SXM480GB",
  "gpus": 8,
  "vcpus": 200,
  "memory": 940,
  "ip": "",
  "private_ip": "172.16.0.84",
  "image": "Ubuntu_22.04.4_LTS",
  "cluster": "Hou1",
  "status": "na",
  "storage_type": "na"
}

Similarly, we can also fetch info about a specific vm.

print(json.dumps(
    virtual.get_server(
        id='rofinn-intel-dev',
        namespace='denvr',
        cluster='Hou1'
    ),
    indent=2
))
{
  "username": "rory@denvrdata.com",
  "tenancy_name": "denvr",
  "rpool": "reserved-denvr",
  "direct_attached_storage_persisted": false,
  "id": "rofinn-intel-dev",
  "namespace": "denvr",
  "configuration": "15",
  "storage": 27000,
  "gpu_type": "intel/GAUDI2",
  "gpus": 8,
  "vcpus": 152,
  "memory": 940,
  ...
  "image": "habana-1.16.2",
  "cluster": "Hou1",
  "status": "ONLINE",
  "storage_type": "na"
}

A different example using our applications service.

print(json.dumps(
    app.create_catalog_application(
        name="api-test",
        cluster="Msc1",
        hardware_package_name="g-nvidia-1xa100-40gb-pcie-14vcpu-112gb",
        application_catalog_item_name="jupyter-notebook",
        application_catalog_item_version="python-3.11.9",
        resource_pool="on-demand",
        jupyter_token="abc123"
    ),
    indent=2
))
{
  "id": "api-test",
  "cluster": "Msc1",
  "status": null,
  "tenant": "denvr",
  "created_by": "rory@denvrdata.com",
  "private_ip": "172.16.0.180",
  "public_ip": "",
  "resource_pool": "on-demand",
  "dns": "",
  "ssh_username": "",
  "application_catalog_item_name": "jupyter-notebook",
  "application_catalog_item_version_name": "python-3.11.9",
  "hardware_package_name": "g-nvidia-1xa100-40gb-pcie-14vcpu-112gb",
  "persisted_direct_attached_storage": false,
  "personal_shared_storage": false,
  "tenant_shared_storage": false
}
print(json.dumps(app.get_applications(), indent=2))
{
  "items": [
    {
      "id": "api-test",
      "cluster": "Msc1",
      "status": "ONLINE",
      "tenant": "denvr",
      "createdBy": "rory@denvrdata.com",
      "privateIp": "172.16.0.180",
      "publicIp": "130.250.171.126",
      "resourcePool": "on-demand",
      "dns": "https://YYC-130-250-171-126.cloud.denvrdata.com/",
      "sshUsername": "",
      "applicationCatalogItemName": "jupyter-notebook",
      "applicationCatalogItemVersionName": "python-3.11.9",
      "hardwarePackageName": "g-nvidia-1xa100-40gb-pcie-14vcpu-112gb",
      "persistedDirectAttachedStorage": false,
      "personalSharedStorage": false,
      "tenantSharedStorage": false
    }
  ]
}

Using a Waiter

from denvr.waiters import waiter

create_app = waiter(app.create_catalog_application)
response = create_app(
  name="api-test",
  cluster="Msc1",
  hardware_package_name="g-nvidia-1xa100-40gb-pcie-14vcpu-112gb",
  application_catalog_item_name="jupyter-notebook",
  application_catalog_item_version="python-3.11.9",
  resource_pool="on-demand",
  jupyter_token="abc123"
)
print(json.dumps(response, indent=2))
{
  "instance_details": {
    "id": "api-test",
    "cluster": "Msc1",
    "status": "ONLINE",
    "privateIp": "172.16.0.100",
    "publicIp": "130.250.171.177",
    "imageCmdOverride": null,
    "environmentVariables": {
      "USERNAME": "ubuntu",
      "JUPYTER_TOKEN": "abc123",
      "DIRECT_ATTACHED_STORAGE": "True"
    },
    "readinessWatcherPort": 443,
    "createdBy": "rory.finnegan@denvrdata.com",
    "tenant": "denvr",
    "resourcePool": "on-demand",
    "creationTime": "2025-04-09T01:15:35Z",
    "lastUpdated": "2025-04-09T01:15:35+00:00",
    "dns": "https://yyc-130-250-171-177.cloud.denvrdata.com/",
    "persistedDirectAttachedStorage": false,
    "personalSharedStorage": false,
    "tenantSharedStorage": false
  },
  "application_catalog_item": {
    "name": "jupyter-notebook",
    "applicationSourceDetailsUrl": null,
    "versions": [
      {
        "name": "python-3.11.9",
        "imageUrl": "quay.io/jupyter/base-notebook:python-3.11.9",
        "imageLastPushDate": "2024-07-14T07:00:00+00:00",
        "platform": "NVIDIA",
        "launchType": "jupyter",
        "releaseNotesUrl": "https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html"
      }
    ]
  },
  "hardware_package": {
    "name": "g-nvidia-1xa100-40gb-pcie-14vcpu-112gb",
    "description": "1x A100 40 GB PCIe GPU, 14 vCPUs, 112GB RAM",
    "gpuCount": 1,
    "gpuType": "nvidia.com/A100PCIE40GB",
    "gpuBrand": "NVIDIA",
    "gpuName": "NVIDIA A100",
    "vcpusCount": 14,
    "memoryGb": 112,
    "directAttachedStorageGb": 1700,
    "pricePerHour": 1.15
  }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

denvr-0.5.0.tar.gz (105.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

denvr-0.5.0-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file denvr-0.5.0.tar.gz.

File metadata

  • Download URL: denvr-0.5.0.tar.gz
  • Upload date:
  • Size: 105.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for denvr-0.5.0.tar.gz
Algorithm Hash digest
SHA256 c30c2bae96be11ff6e6fc55559012de218b07354259e5ce4224dbac11966642c
MD5 d20a4ee8826ff5f3c8203795a95af8d4
BLAKE2b-256 55d3085034ffd1bc7960b6472328a2b69711a4bb700583ef19e10b05c18b9f6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for denvr-0.5.0.tar.gz:

Publisher: release.yml on denvrdata/denvrpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file denvr-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: denvr-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for denvr-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a87dbce556458237ff36fe2447f3d6f1dfbb52e4b292f07301488ff5bc62defa
MD5 c5def64523ba2184005439d2b07ce3f4
BLAKE2b-256 51c4958bf130148342e86836535e70f93a4560426ad3acc502ee7a4230e81703

See more details on using hashes here.

Provenance

The following attestation bundles were made for denvr-0.5.0-py3-none-any.whl:

Publisher: release.yml on denvrdata/denvrpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page