mirror of
https://github.com/wassname/ray.git
synced 2026-07-18 12:40:56 +08:00
[Serve] Implement ServeHandle refactoring (#10527)
This commit is contained in:
@@ -4,7 +4,7 @@ from collections import defaultdict, deque
|
||||
import time
|
||||
from typing import DefaultDict, List, Dict, Any, Optional
|
||||
import pickle
|
||||
from dataclasses import dataclass
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
from ray.exceptions import RayTaskError
|
||||
|
||||
@@ -12,12 +12,29 @@ import ray
|
||||
from ray.experimental import metrics
|
||||
from ray.serve.context import TaskContext
|
||||
from ray.serve.endpoint_policy import RandomEndpointPolicy
|
||||
from ray.serve.request_params import RequestMetadata
|
||||
from ray.serve.utils import logger, chain_future
|
||||
|
||||
REPORT_QUEUE_LENGTH_PERIOD_S = 1.0
|
||||
|
||||
|
||||
@dataclass
|
||||
class RequestMetadata:
|
||||
endpoint: str
|
||||
request_context: TaskContext
|
||||
|
||||
call_method: str = "__call__"
|
||||
shard_key: Optional[str] = None
|
||||
|
||||
http_method: str = "GET"
|
||||
http_headers: Dict[str, str] = field(default_factory=dict)
|
||||
|
||||
is_shadow_query: bool = False
|
||||
|
||||
def __post_init__(self):
|
||||
self.http_headers.setdefault("X-Serve-Call-Method", self.call_method)
|
||||
self.http_headers.setdefault("X-Serve-Shard-Key", self.shard_key)
|
||||
|
||||
|
||||
@dataclass
|
||||
class Query:
|
||||
args: List[Any]
|
||||
|
||||
Reference in New Issue
Block a user