From bf440267ff470d400f314ec0ad90d6cc9d3c58b0 Mon Sep 17 00:00:00 2001 From: Justin Merrell Date: Tue, 16 Jan 2024 14:04:00 -0500 Subject: [PATCH 1/4] Update core.py --- runpod/serverless/core.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/runpod/serverless/core.py b/runpod/serverless/core.py index 6c9f9a6c..aae6872d 100644 --- a/runpod/serverless/core.py +++ b/runpod/serverless/core.py @@ -207,11 +207,11 @@ async def run(config: Dict[str, Any]) -> None: while True: jobs = hook.get_jobs(max_concurrency, max_jobs) - if len(jobs) == 0: + if len(jobs) == 0 or jobs is None: continue for job in jobs: - asyncio.create_task(_process_job(handler, job)) + asyncio.create_task(_process_job(handler, job), name=job['id']) await asyncio.sleep(0) await asyncio.sleep(0) @@ -219,6 +219,9 @@ async def run(config: Dict[str, Any]) -> None: def main(config: Dict[str, Any]) -> None: """Run the worker in an asyncio event loop.""" + if config.get('handler') is None: + raise ValueError("config must contain a handler function") + try: work_loop = asyncio.new_event_loop() asyncio.ensure_future(run(config), loop=work_loop) From 5d22522ed5fc2677d4b2c81f826e5380e917f277 Mon Sep 17 00:00:00 2001 From: Justin Merrell Date: Tue, 16 Jan 2024 14:15:21 -0500 Subject: [PATCH 2/4] Update tests.json --- .github/tests.json | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/tests.json b/.github/tests.json index 384dec13..8ef1c068 100644 --- a/.github/tests.json +++ b/.github/tests.json @@ -57,5 +57,24 @@ "value3" ] } + }, + { + "hardwareConfig": { + "endpointConfig": { + "gpuIds": "ADA_24,AMPERE_16,AMPERE_24,AMPERE_48,AMPERE_80", + "name": "runpod-python E2E Test - Serverless Core" + }, + "templateConfig": { + "env"[ + { + "key": "RUNPOD_USE_CORE", + "value": "true" + } + ] + } + }, + "input": { + "mock_return": "this worked!" + } } ] From 0fa2630945aa47224ee39273e39a24a2aab9a15b Mon Sep 17 00:00:00 2001 From: Justin Merrell Date: Tue, 16 Jan 2024 14:20:47 -0500 Subject: [PATCH 3/4] Update tests.json --- .github/tests.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/tests.json b/.github/tests.json index 8ef1c068..0e7e96d0 100644 --- a/.github/tests.json +++ b/.github/tests.json @@ -65,7 +65,7 @@ "name": "runpod-python E2E Test - Serverless Core" }, "templateConfig": { - "env"[ + "env": [ { "key": "RUNPOD_USE_CORE", "value": "true" From c0222a7a16be766a3cecf2cc13d17488f8fee0fd Mon Sep 17 00:00:00 2001 From: Justin Merrell Date: Tue, 16 Jan 2024 15:00:54 -0500 Subject: [PATCH 4/4] Update core.py --- runpod/serverless/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runpod/serverless/core.py b/runpod/serverless/core.py index aae6872d..7074d7ff 100644 --- a/runpod/serverless/core.py +++ b/runpod/serverless/core.py @@ -170,7 +170,7 @@ def finish_stream(self, job_id: str) -> bool: # -------------------------------- Process Job ------------------------------- # -def _process_job(handler: Callable, job: Dict[str, Any]) -> Dict[str, Any]: +async def _process_job(handler: Callable, job: Dict[str, Any]) -> Dict[str, Any]: """ Process a single job. """ hook = Hook()