Skip to content

Commit

Permalink
fix: streamed errors were previously swallowed (#384)
Browse files Browse the repository at this point in the history
This created false-positive completed tasks
  • Loading branch information
deanq authored Dec 10, 2024
1 parent 0a57890 commit d7a2131
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion runpod/serverless/modules/rp_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,15 @@ async def handle_job(session: ClientSession, config: Dict[str, Any], job) -> dic
job_result = {"output": []}
async for stream_output in generator_output:
log.debug(f"Stream output: {stream_output}", job["id"])
if "error" in stream_output:

if type(stream_output.get("output")) == dict:
if stream_output["output"].get("error"):
stream_output = {"error": str(stream_output["output"]["error"])}

if stream_output.get("error"):
job_result = stream_output
break

if config.get("return_aggregate_stream", False):
job_result["output"].append(stream_output["output"])

Expand Down

0 comments on commit d7a2131

Please sign in to comment.