Skip to content

Commit 794e7b7

Browse files
Merge pull request #153 from runpod/output-patch
Output patch
2 parents 32a0af4 + 538a5e2 commit 794e7b7

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log
22

3+
## Release (Patch) 1.2.3 (10/4/23)
4+
5+
### Bug Fix
6+
7+
- Job outputs that were not dictionaries, bool, or str were swallowed by the serverless worker. This has been fixed.
8+
39
## Release 1.2.2 (10/4/23)
410

511
### Added

runpod/serverless/modules/rp_job.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,11 @@ async def run_job(handler: Callable, job: Dict[str, Any]) -> Dict[str, Any]:
129129
elif isinstance(job_output, bool):
130130
run_result = {"output": job_output}
131131

132-
elif isinstance(job_output, str):
132+
else:
133133
run_result = {"output": job_output}
134134

135+
136+
135137
if run_result.get("output") == {}:
136138
run_result.pop("output")
137139

tests/test_serverless/test_modules/test_job.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,19 @@ async def test_simple_job(self):
177177
Tests the run_job function
178178
'''
179179
mock_handler = Mock()
180-
mock_handler.return_value = "test"
181180

181+
mock_handler.return_value = "test"
182182
job_result = await rp_job.run_job(mock_handler, self.sample_job)
183-
184183
assert job_result == {"output": "test"}
185184

185+
mock_handler.return_value = ['test1', 'test2']
186+
job_result_list = await rp_job.run_job(mock_handler, self.sample_job)
187+
assert job_result_list == {"output":["test1", "test2"]}
188+
189+
mock_handler.return_value = 123
190+
job_result_int = await rp_job.run_job(mock_handler, self.sample_job)
191+
assert job_result_int == {"output": 123}
192+
186193
async def test_job_with_errors(self):
187194
'''
188195
Tests the run_job function with errors

0 commit comments

Comments
 (0)