[Feature] Support Stage Based Deployment CLI (#939)
Signed-off-by: wuhang <wuhang6@huawei.com> Signed-off-by: princepride <wangzhipeng628@gmail.com> Signed-off-by: wuhang <whlbx@hotmail.com> Co-authored-by: 汪志鹏 <wangzhipeng628@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
11 files changed
+1272
-198
No files matched your search
@@ -38,7 +38,7 @@ from vllm_omni.outputs import OmniRequestOutput
|
||||
logger = init_logger(__name__)
|
||||
|
||||
|
||||
def _weak_close_cleanup_async(stage_list, stage_in_queues, ray_pg, output_handler):
|
||||
def _weak_close_cleanup_async(stage_list, stage_in_queues, stage_out_queues, ray_pg, output_handler, zmq_ctx=None):
|
||||
"""Weak reference cleanup function for AsyncOmni instances."""
|
||||
if stage_list:
|
||||
for q in stage_in_queues:
|
||||
@@ -46,6 +46,13 @@ def _weak_close_cleanup_async(stage_list, stage_in_queues, ray_pg, output_handle
|
||||
q.put_nowait(SHUTDOWN_TASK)
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to send shutdown signal to stage input queue: {e}")
|
||||
close_fn = getattr(q, "close", None)
|
||||
if callable(close_fn):
|
||||
close_fn()
|
||||
for q in stage_out_queues:
|
||||
close_fn = getattr(q, "close", None)
|
||||
if callable(close_fn):
|
||||
close_fn()
|
||||
for stage in stage_list:
|
||||
try:
|
||||
stage.stop_stage_worker()
|
||||
@@ -55,6 +62,8 @@ def _weak_close_cleanup_async(stage_list, stage_in_queues, ray_pg, output_handle
|
||||
# Cancel output handler
|
||||
if output_handler is not None:
|
||||
output_handler.cancel()
|
||||
if zmq_ctx is not None:
|
||||
zmq_ctx.term()
|
||||
|
||||
|
||||
class AsyncOmni(OmniBase):
|
||||
@@ -108,8 +117,10 @@ class AsyncOmni(OmniBase):
|
||||
_weak_close_cleanup_async,
|
||||
self.stage_list,
|
||||
self._stage_in_queues,
|
||||
self._stage_out_queues,
|
||||
self._ray_pg,
|
||||
self.output_handler,
|
||||
self._zmq_ctx,
|
||||
)
|
||||
|
||||
def _create_default_diffusion_stage_cfg(self, kwargs: dict[str, Any]) -> dict[str, Any]:
|
||||
|
||||
Reference in new issue
Block a user