feat: Add RunPod start and improved pod creation
- Added a new `start_on_demand_pod` function to the RunPod client. - Improved the `create_on_demand_pod` function to handle nested machine structure in the response. - Updated the example to use the new functions and handle the new response structure. - Updated the API key for the example. - Added more descriptive field names in the `create_on_demand_pod` input. Co-authored-by: mariobassem12 <mariobassem12@gmail.com>
This commit is contained in:
@@ -6,23 +6,23 @@ import freeflowuniverse.herolib.clients.runpod
|
||||
// Example 1: Create client with direct API key
|
||||
mut rp := runpod.get_or_create(
|
||||
name: 'example1'
|
||||
api_key: 'rpa_JDYDWBS0PDTC55T1BYT1PX85CL4D5YEBZ48LETRXyf4gxr'
|
||||
api_key: 'rpa_YYQ2HSM1AVP55MKX39R3LTH5KDCSWJBVKG5Y52Z2oryd46'
|
||||
)!
|
||||
|
||||
// Create a new on demand pod
|
||||
pod_response := rp.create_on_demand_pod(
|
||||
name: 'RunPod Tensorflow'
|
||||
image_name: 'runpod/tensorflow'
|
||||
cloud_type: .all
|
||||
gpu_count: 1
|
||||
volume_in_gb: 40
|
||||
on_demand_pod_response := rp.create_on_demand_pod(
|
||||
name: 'RunPod Tensorflow'
|
||||
image_name: 'runpod/tensorflow'
|
||||
cloud_type: .all
|
||||
gpu_count: 1
|
||||
volume_in_gb: 40
|
||||
container_disk_in_gb: 40
|
||||
min_memory_in_gb: 15
|
||||
min_vcpu_count: 2
|
||||
gpu_type_id: "NVIDIA RTX A6000"
|
||||
ports: "8888/http"
|
||||
volume_mount_path: "/workspace"
|
||||
env: [
|
||||
min_memory_in_gb: 15
|
||||
min_vcpu_count: 2
|
||||
gpu_type_id: 'NVIDIA RTX A6000'
|
||||
ports: '8888/http'
|
||||
volume_mount_path: '/workspace'
|
||||
env: [
|
||||
runpod.EnvironmentVariableInput{
|
||||
key: 'JUPYTER_PASSWORD'
|
||||
value: 'rn51hunbpgtltcpac3ol'
|
||||
@@ -30,7 +30,7 @@ pod_response := rp.create_on_demand_pod(
|
||||
]
|
||||
)!
|
||||
|
||||
println('Created pod with ID: ${pod_response.id}')
|
||||
println('Created pod with ID: ${on_demand_pod_response.id}')
|
||||
|
||||
// create a spot pod
|
||||
spot_pod_resp := rp.create_spot_pod(
|
||||
@@ -56,3 +56,7 @@ spot_pod_resp := rp.create_spot_pod(
|
||||
]
|
||||
)!
|
||||
println('Created spot pod with ID: ${spot_pod_resp.id}')
|
||||
|
||||
// start on-demand pod
|
||||
start_on_demand_pod := rp.start_on_demand_pod(pod_id: '${on_demand_pod_response.id}', gpu_count: 1)!
|
||||
println('Started pod with ID: ${start_on_demand_pod.id}')
|
||||
|
||||
Reference in New Issue
Block a user