R
RunPod3w 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
nerdylive
nerdylive3w ago
I don't get the code, I think the progress update should be indented And return is only once yeah
yhlong00000
yhlong000002w ago
data -> output
tzk
tzkOP2w 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?
nerdylive
nerdylive2w ago
I think that is a correct way to use progress updates already
Want results from more Discord servers?
Add your server