dstack icon indicating copy to clipboard operation
dstack copied to clipboard

Add spot in runpod

Open Bihan opened this issue 1 year ago • 3 comments

Bihan avatar Apr 11 '24 14:04 Bihan

@peterschmidt85 @TheBits I will update this PR to include resolved issues. https://github.com/dstackai/dstack/issues/1133

Bihan avatar Apr 16 '24 05:04 Bihan

Hi @Bihan!

Functions generate_pod_deployment_mutation and generate_pod_rent_interruptable_mutation are almost the same. Please combine them into one.

@@ -1,4 +1,5 @@
-def generate_pod_deployment_mutation(
+def generate_pod_rent_interruptable_mutation(
+    bid_per_gpu: float,
     name: str,
     image_name: str,
     gpu_type_id: str,
@@ -21,11 +22,12 @@
     allowed_cuda_versions: Optional[List[str]] = None,
 ) -> str:
     """
-    Generates a mutation to deploy a pod on demand.
+    Generates a mutation to deploy a pod spot.
     """
     input_fields = []
 
     # ------------------------------ Required Fields ----------------------------- #
+    input_fields.append(f"bidPerGpu: {bid_per_gpu}")
     input_fields.append(f'name: "{name}"')
     input_fields.append(f'imageName: "{image_name}"')
     input_fields.append(f'gpuTypeId: "{gpu_type_id}"')
@@ -82,19 +84,16 @@
 
     # Format input fields
     input_string = ", ".join(input_fields)
-
     return f"""
         mutation {{
-          podFindAndDeployOnDemand(
+          podRentInterruptable(
             input: {{
               {input_string}
             }}
           ) {{
             id
-            desiredStatus
+            lastStatusChange
             imageName
-            env
-            machineId
             machine {{
               podHostId
             }}

TheBits avatar May 02 '24 17:05 TheBits

Hi @Bihan!

Functions generate_pod_deployment_mutation and generate_pod_rent_interruptable_mutation are almost the same. Please combine them into one.

@@ -1,4 +1,5 @@
-def generate_pod_deployment_mutation(
+def generate_pod_rent_interruptable_mutation(
+    bid_per_gpu: float,
     name: str,
     image_name: str,
     gpu_type_id: str,
@@ -21,11 +22,12 @@
     allowed_cuda_versions: Optional[List[str]] = None,
 ) -> str:
     """
-    Generates a mutation to deploy a pod on demand.
+    Generates a mutation to deploy a pod spot.
     """
     input_fields = []
 
     # ------------------------------ Required Fields ----------------------------- #
+    input_fields.append(f"bidPerGpu: {bid_per_gpu}")
     input_fields.append(f'name: "{name}"')
     input_fields.append(f'imageName: "{image_name}"')
     input_fields.append(f'gpuTypeId: "{gpu_type_id}"')
@@ -82,19 +84,16 @@
 
     # Format input fields
     input_string = ", ".join(input_fields)
-
     return f"""
         mutation {{
-          podFindAndDeployOnDemand(
+          podRentInterruptable(
             input: {{
               {input_string}
             }}
           ) {{
             id
-            desiredStatus
+            lastStatusChange
             imageName
-            env
-            machineId
             machine {{
               podHostId
             }}

@TheBits I have pushed the changes. Thank you for the review.

Bihan avatar May 03 '24 10:05 Bihan

@Bihan Thank you!

TheBits avatar May 06 '24 04:05 TheBits