Skip to content

Commit d7a2131

Browse files
authored
fix: streamed errors were previously swallowed (#384)
This created false-positive completed tasks
1 parent 0a57890 commit d7a2131

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

runpod/serverless/modules/rp_job.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,15 @@ async def handle_job(session: ClientSession, config: Dict[str, Any], job) -> dic
126126
job_result = {"output": []}
127127
async for stream_output in generator_output:
128128
log.debug(f"Stream output: {stream_output}", job["id"])
129-
if "error" in stream_output:
129+
130+
if type(stream_output.get("output")) == dict:
131+
if stream_output["output"].get("error"):
132+
stream_output = {"error": str(stream_output["output"]["error"])}
133+
134+
if stream_output.get("error"):
130135
job_result = stream_output
131136
break
137+
132138
if config.get("return_aggregate_stream", False):
133139
job_result["output"].append(stream_output["output"])
134140

0 commit comments

Comments
 (0)