R
Runpod11mo ago
tzk

How to get progress updates from Runpod?

Hi all - my goal is to get progress updates from a job request - presently I'm polling a job status request every two seconds, and I would like to get feedback of the % completed. Looking through the documentation, I'm updated the handler function in rp_handler.py by adding the following code:
for update_number in range(0, 100):
runpod.serverless.progress_update(job, f"{update_number}")
return {"progress": update_number}
for update_number in range(0, 100):
runpod.serverless.progress_update(job, f"{update_number}")
return {"progress": update_number}
I was expecting a new key "progress" in my status request response body - but it's not there? What should I be doing - perhaps have I misunderstood the documentation? Here is the request status:
{
"headers": {},
"ok": true,
"redirected": false,
"status": 200,
"statusText": "",
"type": "cors",
"url": "https://api.runpod.ai/v2/qoepgisqx0u3qy/status/1896d710-4f48-4e71-ba2d-f30e47c6f940-u1",
"body": {},
"bodyUsed": false,
"data": {
"delayTime": 9070,
"executionTime": 256,
"id": "1896d710-4f48-4e71-ba2d-f30e47c6f940-u1",
"output": "0",
"status": "IN_PROGRESS",
"workerId": "smjcwth8e5sqvv"
}
}
{
"headers": {},
"ok": true,
"redirected": false,
"status": 200,
"statusText": "",
"type": "cors",
"url": "https://api.runpod.ai/v2/qoepgisqx0u3qy/status/1896d710-4f48-4e71-ba2d-f30e47c6f940-u1",
"body": {},
"bodyUsed": false,
"data": {
"delayTime": 9070,
"executionTime": 256,
"id": "1896d710-4f48-4e71-ba2d-f30e47c6f940-u1",
"output": "0",
"status": "IN_PROGRESS",
"workerId": "smjcwth8e5sqvv"
}
}
4 Replies
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
yhlong00000
yhlong0000010mo ago
data -> output
tzk
tzkOP10mo ago
Apologies, I was on my phone when posting so it didn't format correctly. The code snippet for showing progress is:
for update_number in range(0, 100):
runpod.serverless.progress_update(job, f"{update_number}")
return {"progress": update_number}
for update_number in range(0, 100):
runpod.serverless.progress_update(job, f"{update_number}")
return {"progress": update_number}
So I think I should be removing the "return" line as there is already a return for a successful completion in rp_handler.py. The question is then, where should I output update_number?
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?