"vscode:/vscode.git/clone" did not exist on "4f882be4a0d319551ce2a0eadcace0e76f3432cd"
Unverified Commit 7a83b1ae authored by Gene Der Su's avatar Gene Der Su Committed by GitHub
Browse files

[BugFix] Lazy import ray (#10021)

parent ad233189
...@@ -5,7 +5,6 @@ from typing import Iterator, List, Optional, Union ...@@ -5,7 +5,6 @@ from typing import Iterator, List, Optional, Union
import cloudpickle import cloudpickle
import zmq import zmq
from ray.exceptions import RayTaskError
from vllm import AsyncEngineArgs, SamplingParams from vllm import AsyncEngineArgs, SamplingParams
# yapf conflicts with isort for this block # yapf conflicts with isort for this block
...@@ -306,11 +305,17 @@ class MQLLMEngine: ...@@ -306,11 +305,17 @@ class MQLLMEngine:
def _send_outputs(self, outputs: REQUEST_OUTPUTS_T): def _send_outputs(self, outputs: REQUEST_OUTPUTS_T):
"""Send List of RequestOutput to RPCClient.""" """Send List of RequestOutput to RPCClient."""
if outputs: if outputs:
try:
from ray.exceptions import RayTaskError
# RayTaskError might not pickelable here. We need to unpack the # RayTaskError might not pickelable here. We need to unpack the
# underlying exception as the real exception in the output. # underlying exception as the real exception in the output.
if (isinstance(outputs, RPCError) if (isinstance(outputs, RPCError)
and isinstance(outputs.exception, RayTaskError)): and isinstance(outputs.exception, RayTaskError)):
outputs.exception = outputs.exception.cause outputs.exception = outputs.exception.cause
except ImportError:
pass
output_bytes = pickle.dumps(outputs) output_bytes = pickle.dumps(outputs)
self.output_socket.send_multipart((output_bytes, ), copy=False) self.output_socket.send_multipart((output_bytes, ), copy=False)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment