We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8287a38 commit bf44026Copy full SHA for bf44026
1 file changed
runpod/serverless/core.py
@@ -207,18 +207,21 @@ async def run(config: Dict[str, Any]) -> None:
207
while True:
208
jobs = hook.get_jobs(max_concurrency, max_jobs)
209
210
- if len(jobs) == 0:
+ if len(jobs) == 0 or jobs is None:
211
continue
212
213
for job in jobs:
214
- asyncio.create_task(_process_job(handler, job))
+ asyncio.create_task(_process_job(handler, job), name=job['id'])
215
await asyncio.sleep(0)
216
217
218
219
220
def main(config: Dict[str, Any]) -> None:
221
"""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
+
225
try:
226
work_loop = asyncio.new_event_loop()
227
asyncio.ensure_future(run(config), loop=work_loop)
0 commit comments