Skip to content

Commit b1b6ef8

Browse files
author
Justin Merrell
committed
fix: added json confirmation
1 parent d36e095 commit b1b6ef8

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

runpod/serverless/modules/job.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def run(job):
6363
model = inference.Model()
6464

6565
job_output = model.run(job)
66+
log(f"Job output: {job_output}")
6667

6768
for index, output in enumerate(job_output):
6869
if "error" in output:
@@ -77,6 +78,8 @@ def run(job):
7778
job_duration = time.time() - time_job_started
7879
job_duration_ms = int(job_duration * 1000)
7980

81+
log(f"Returning as output: {job_output}")
82+
8083
return {
8184
"output": job_output,
8285
"duration_ms": job_duration_ms
@@ -87,15 +90,16 @@ def post(worker_id, job_id, job_output, job_time):
8790
'''
8891
Complete the job.
8992
'''
90-
if os.environ.get('RUNPOD_WEBHOOK_POST_OUTPUT', None) is None:
91-
return
92-
9393
job_data = {
9494
"output": job_output
9595
}
9696

9797
job_data = json.dumps(job_data, ensure_ascii=False)
9898

99+
if os.environ.get('RUNPOD_WEBHOOK_POST_OUTPUT', None) is None:
100+
log("RUNPOD_WEBHOOK_POST_OUTPUT not set, skipping completing job", 'WARNING')
101+
return
102+
99103
job_done_url = str(os.environ.get('RUNPOD_WEBHOOK_POST_OUTPUT'))
100104
job_done_url = job_done_url.replace('$ID', job_id)
101105
job_done_url = job_done_url.replace('$RUNPOD_POD_ID', worker_id)

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = runpod
3-
version = 0.4.3
3+
version = 0.4.4
44
description = Official Python library for RunPod API & SDK.
55
long_description = file: README.md
66
long_description_content_type = text/markdown

0 commit comments

Comments
 (0)