MCPcopy Index your code
hub / github.com/InternLM/lmdeploy / start

Method start

lmdeploy/pytorch/engine/engine_loop.py:546–564  ·  view source on GitHub ↗

Create async tasks.

(self, event_loop: asyncio.AbstractEventLoop)

Source from the content-addressed store, hash-verified

544 await asyncio.sleep(.5)
545
546 def start(self, event_loop: asyncio.AbstractEventLoop):
547 """Create async tasks."""
548 # start executor
549 logger.info('Starting executor.')
550 self.executor.start(self.forward_event)
551 # start owned loops
552 self.tasks.add(event_loop.create_task(self.executor.wait_tasks(), name='MainLoopWaitExecutor'))
553 logger.info('Starting async task MainLoopPreprocessMessage.')
554 self.tasks.add(event_loop.create_task(self.preprocess_loop(), name='MainLoopPreprocessMessage'))
555 logger.info('Starting async task MainLoopResponse.')
556 self.tasks.add(event_loop.create_task(self.send_response_loop(), name='MainLoopSendResponse'))
557 logger.info('Starting async task MainLoop.')
558 self.tasks.add(event_loop.create_task(self.main_loop(), name='MainLoopMain'))
559 if self.config.role != EngineRole.Hybrid:
560 logger.info('Starting async task MigrationLoop.')
561 self.tasks.add(event_loop.create_task(self.migration_loop(), name='MainLoopMigration'))
562
563 for task in self.tasks:
564 task.add_done_callback(self.tasks.discard)
565
566 async def wait_tasks(self):
567 """Wait for all tasks to finish."""

Callers

nothing calls this directly

Calls 7

preprocess_loopMethod · 0.95
send_response_loopMethod · 0.95
main_loopMethod · 0.95
migration_loopMethod · 0.95
create_taskMethod · 0.80
addMethod · 0.45
wait_tasksMethod · 0.45

Tested by

no test coverage detected