Skip to content

Commit

Permalink
Adds a Python sample to return the status of a running job
Browse files Browse the repository at this point in the history
  • Loading branch information
rachfop committed Dec 31, 2023
1 parent b361d48 commit 4677da0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion v1.0/SERVERLESS/custom-apis/using-your-api-copy.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ running your api via **/run** runs the code asynchronously, here's a sample resp
```Text cURL
curl https://api.runpod.ai/v2/<your-api-id>/status/<your-status-id>
```
```python
```python Start a job and return a status
# this requires the installation of runpod-python
# with `pip install runpod-python` beforehand

Expand All @@ -186,6 +186,18 @@ run_request = endpoint.run(

print(run_request.status())
```
```python Get the status of a running job
# Prerequisite: Install runpod-python using `pip install runpod-python`
import runpod

runpod.api_key = "xxxxxxxxxxxxxxxxxxxxxx" # Replace with your API key
client = runpod.endpoint.runner.RunPodClient()


job = runpod.endpoint.Job(endpoint_id="your_endpoint_id", job_id="your_job_id", client=client)

print(job.status())
```
<!-- dprint-ignore-end -->

**sample response (for job in progress)**
Expand Down

0 comments on commit 4677da0

Please sign in to comment.