RunpodR
Runpod3y ago
12 replies
Daan

Possible error in docs: Status of a job with python code

In the docs, there is this command to retrieve the status of a submitted job:
curl https://api.runpod.ai/v2/<your-api-id>/status/<your-status-id>

And in the docs, this should be the equivalent python code:
# this requires the installation of runpod-python
# with `pip install runpod-python` beforehand

import runpod

runpod.api_key = "xxxxxxxxxxxxxxxxxxxxxx" # you can find this in settings

endpoint = runpod.Endpoint("ENDPOINT_ID")

run_request = endpoint.run(
    {"prompt": "a cute magical flying dog, fantasy art drawn by disney concept artists"}
)

print(run_request.status())

But I do not want to start a job again, I just want to retrieve the status of the job (by the job_id, enpoint_id and api_key). I gues this is a small error in the docs, or isn't there a way to retrieve the status of a job by these parameters, as it is possible with curl?
Solution
My apologies

import runpod 
runpod.api_key = "Your Key"
client = runpod.endpoint.runner.RunPodClient()
job = runpod.endpoint.Job(endpoint_id=123, job_id=ab, client=client)
print(job.status())


Try that, looks like we need to expose a couple more things for the next release.
Was this page helpful?