Skip to content

Commit bf44026

Browse files
committed
Update core.py
1 parent 8287a38 commit bf44026

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

runpod/serverless/core.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,18 +207,21 @@ async def run(config: Dict[str, Any]) -> None:
207207
while True:
208208
jobs = hook.get_jobs(max_concurrency, max_jobs)
209209

210-
if len(jobs) == 0:
210+
if len(jobs) == 0 or jobs is None:
211211
continue
212212

213213
for job in jobs:
214-
asyncio.create_task(_process_job(handler, job))
214+
asyncio.create_task(_process_job(handler, job), name=job['id'])
215215
await asyncio.sleep(0)
216216

217217
await asyncio.sleep(0)
218218

219219

220220
def main(config: Dict[str, Any]) -> None:
221221
"""Run the worker in an asyncio event loop."""
222+
if config.get('handler') is None:
223+
raise ValueError("config must contain a handler function")
224+
222225
try:
223226
work_loop = asyncio.new_event_loop()
224227
asyncio.ensure_future(run(config), loop=work_loop)

0 commit comments

Comments
 (0)