Skip to content
Merged
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## Release (Patch) 1.2.3 (10/4/23)

### Bug Fix

- Job outputs that were not dictionaries, bool, or str were swallowed by the serverless worker. This has been fixed.

## Release 1.2.2 (10/4/23)

### Added
Expand Down
4 changes: 3 additions & 1 deletion runpod/serverless/modules/rp_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,11 @@ async def run_job(handler: Callable, job: Dict[str, Any]) -> Dict[str, Any]:
elif isinstance(job_output, bool):
run_result = {"output": job_output}

elif isinstance(job_output, str):
else:
run_result = {"output": job_output}



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

Expand Down
11 changes: 9 additions & 2 deletions tests/test_serverless/test_modules/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,19 @@ async def test_simple_job(self):
Tests the run_job function
'''
mock_handler = Mock()
mock_handler.return_value = "test"

mock_handler.return_value = "test"
job_result = await rp_job.run_job(mock_handler, self.sample_job)

assert job_result == {"output": "test"}

mock_handler.return_value = ['test1', 'test2']
job_result_list = await rp_job.run_job(mock_handler, self.sample_job)
assert job_result_list == {"output":["test1", "test2"]}

mock_handler.return_value = 123
job_result_int = await rp_job.run_job(mock_handler, self.sample_job)
assert job_result_int == {"output": 123}

async def test_job_with_errors(self):
'''
Tests the run_job function with errors
Expand Down