Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions runpod/serverless/modules/rp_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,6 @@ async def run_job(handler: Callable, job: Dict[str, Any]) -> Dict[str, Any]:
else:
run_result = {"output": job_output}

if run_result.get("output") == {}:
run_result.pop("output")

check_return_size(run_result) # Checks the size of the return body.

except Exception as err:
Expand Down
21 changes: 21 additions & 0 deletions tests/test_serverless/test_modules/test_fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,17 @@ def test_runsync(self):
"output": {"result": "success"},
}

empty_handler = Mock(return_value={})
empty_worker_api = rp_fastapi.WorkerAPI({"handler": empty_handler})
empty_runsync_return = asyncio.run(
empty_worker_api._sim_runsync(default_input_object)
)
assert empty_runsync_return == {
"id": "test-123",
"status": "COMPLETED",
"output": {},
}

# Test with generator handler
def generator_handler(job):
del job
Expand Down Expand Up @@ -330,6 +341,16 @@ def test_status(self):
"output": {"result": "success"},
}

empty_handler = Mock(return_value={})
empty_worker_api = rp_fastapi.WorkerAPI({"handler": empty_handler})
asyncio.run(empty_worker_api._sim_run(default_input_object))
empty_status_return = asyncio.run(empty_worker_api._sim_status("test-123"))
assert empty_status_return == {
"id": "test-123",
"status": "COMPLETED",
"output": {},
}

# Test webhook caller sent
asyncio.run(worker_api._sim_run(input_object_with_webhook))
asyncio.run(worker_api._sim_status("test-123"))
Expand Down