mirror of
https://github.com/wassname/ray.git
synced 2026-07-20 12:40:20 +08:00
[serve] Master actor fault tolerance (#8116)
This commit is contained in:
@@ -23,24 +23,14 @@ def create_backend_worker(func_or_class):
|
||||
assert False, "func_or_class must be function or class."
|
||||
|
||||
class RayServeWrappedWorker(object):
|
||||
def __init__(self,
|
||||
backend_tag,
|
||||
replica_tag,
|
||||
init_args,
|
||||
router_handle=None):
|
||||
def __init__(self, backend_tag, replica_tag, init_args):
|
||||
serve.init()
|
||||
if is_function:
|
||||
_callable = func_or_class
|
||||
else:
|
||||
_callable = func_or_class(*init_args)
|
||||
|
||||
if router_handle is None:
|
||||
master_actor = serve.api._get_master_actor()
|
||||
[router_handle] = ray.get(
|
||||
master_actor.get_backend_worker_config.remote())
|
||||
|
||||
self.backend = RayServeWorker(backend_tag, _callable,
|
||||
router_handle, is_function)
|
||||
self.backend = RayServeWorker(backend_tag, _callable, is_function)
|
||||
|
||||
def get_metrics(self):
|
||||
return self.backend.get_metrics()
|
||||
@@ -76,10 +66,9 @@ def ensure_async(func):
|
||||
class RayServeWorker:
|
||||
"""Handles requests with the provided callable."""
|
||||
|
||||
def __init__(self, name, _callable, router_handle, is_function):
|
||||
def __init__(self, name, _callable, is_function):
|
||||
self.name = name
|
||||
self.callable = _callable
|
||||
self.router_handle = router_handle
|
||||
self.is_function = is_function
|
||||
|
||||
self.error_counter = 0
|
||||
|
||||
Reference in New Issue
Block a user