dstack
dstack copied to clipboard
Add spot in runpod
@peterschmidt85 @TheBits I will update this PR to include resolved issues. https://github.com/dstackai/dstack/issues/1133
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
}}
Hi @Bihan!
Functions
generate_pod_deployment_mutationandgenerate_pod_rent_interruptable_mutationare 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 Thank you!