R
RunPod6mo ago
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>
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())
# 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 ```python import runpod runpod.api_key = "Your Key"...
Jump to solution
10 Replies
Justin Merrell
Justin Merrell6mo ago
May you post the link to the doc page you are using?
Daan
Daan6mo ago
RunPod
Using Your API
Okay! Now you have everything set up, but how do you use it?
Justin Merrell
Justin Merrell6mo ago
Thank you, yes this appears to be outdated, and in the process of getting updated. Checkout https://github.com/runpod/runpod-python/blob/main/examples/endpoints/run.py for an example. For visibility: @PatrickR
Daan
Daan6mo ago
Okay, so retrieving the status of a job by its id and enpoint_id is not possible yet (in python code)? In the example it is also done with the run_request object, but this is not JSON-serializable.
Justin Merrell
Justin Merrell6mo ago
I see what you are asking, checking to see if this needs to be added or just missing docs. cc: @nathaniel
Daan
Daan6mo ago
okay, thanks
Justin Merrell
Justin Merrell6mo ago
Here https://github.com/runpod/runpod-python/blob/5645bb1758c9725d7dd914f127df1047293b9d7c/runpod/endpoint/runner.py#L93 The following should work:
import runpod
job = runpod.endpoint.Job(endpoint_id=123, job_id=ab)
print(job.status())
import runpod
job = runpod.endpoint.Job(endpoint_id=123, job_id=ab)
print(job.status())
Looks like we just need to add an example to the docs for this.
Daan
Daan6mo ago
The argument 'client' is required, and I am not really sure what this is or how I can get this
Solution
Justin Merrell
Justin Merrell6mo ago
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())
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.
Daan
Daan6mo ago
solved! Thanks for the quick help
Want results from more Discord servers?
Add your server
More Posts