runpod-python icon indicating copy to clipboard operation
runpod-python copied to clipboard

Requesting a pod for cpu via python sdk seems not possible

Open Lhemamou opened this issue 1 year ago • 5 comments

Describe the bug When I want to create a only cpu pod, it's needed to choose a gpu_type_id but when i test all the gpu_type_id with gpu_count=0 , I have not access to any server.

To Reproduce `list_gpus=[x['id'] for x in runpod.get_gpus()]

for gpu in list_gpus: try: runpod.create_pod(name="test_pod",image_name="docker/image", gpu_count=0,gpu_type_id=gpu, container_disk_in_gb=20, min_vcpu_count=2,min_memory_in_gb=8,ports="8080/http;22/tcp") break except runpod.error.QueryError as e: print(e)`

-> print statement : There are no longer any instances available with the requested specifications. Please refresh and try again.

Expected behavior A clear and concise description of what you expected to happen. Expect to obtain a cpu only server

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22] Ubuntu

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context Add any other context about the problem here. python==3.10.12 runpod==1.6.2

Lhemamou avatar May 11 '24 18:05 Lhemamou

Are there any updates on this issue and when it might be fixed? I too am running into a similar issue but then with the gpus itself (not trying to have only cpus)

frankvp11 avatar Jul 23 '24 20:07 frankvp11

I have the same issue and it pretty annoying

zaddy6 avatar Aug 26 '24 11:08 zaddy6

I wrote to RunPod support about this, and received the following guidance:

  • CPU pods are not supported yet via the Python SDK, but they're working on it.
  • There is an undocumented method of achieving this via the graphQL API (which we can call e.g. using python's requests library). Here is what it looks like as a curl command:
curl --request POST \
  --header 'content-type: application/json' \
  --url 'https://api.runpod.io/graphql?api_key=${API_KEY}' \
  --data '{"query": "mutation { deployCpuPod(input: { instanceId: \"cpu3c-2-4\", cloudType: SECURE, containerDiskInGb: 5, deployCost: 0.06, dataCenterId: null, networkVolumeId: null, startJupyter: true, startSsh: true, templateId: \"runpod-ubuntu\", volumeKey: null, ports: \"22/tcp\" }) { id imageName env machineId machine { podHostId } } }"}'

I verified that this works, and it also works with custom template ID, and you can also pass a name for your pod as part of the input.

matcha-mochi-rm avatar Oct 31 '24 22:10 matcha-mochi-rm