Exemplo n.º 1
0
    def _start_in_process(self):

        grpc_aio.init_grpc_aio()
        app = web.Application()
        methods = self._getMethods()
        # connect to product server
        grpc_channel = grpc_aio.insecure_channel("localhost:50050")
        aio_stub = self._get_stub_class()(grpc_channel)
        routes = []
        for method in methods:
            stub_method = getattr(aio_stub, method.name)
            # construct a partial handler.
            handler = partial(self._handle_post_unary_unary,
                              aio_stub_method=stub_method, request_type=method.request_cls)
            routes.append(web.post(method.url, handler))
            print(stub_method)
        app.add_routes(routes)
        self._app = app
        web.run_app(app, host="127.0.0.1", port=65000)
Exemplo n.º 2
0
import ray.dashboard.utils as dashboard_utils
import ray.experimental.internal_kv as internal_kv
from ray._private import ray_constants
from ray._private.gcs_pubsub import GcsAioErrorSubscriber, GcsAioLogSubscriber
from ray._private.gcs_utils import GcsClient, check_health
from ray.dashboard.datacenter import DataOrganizer
from ray.dashboard.utils import async_loop_forever

try:
    from grpc import aio as aiogrpc
except ImportError:
    from grpc.experimental import aio as aiogrpc

logger = logging.getLogger(__name__)

aiogrpc.init_grpc_aio()
GRPC_CHANNEL_OPTIONS = (
    *ray_constants.GLOBAL_GRPC_OPTIONS,
    ("grpc.max_send_message_length", ray_constants.GRPC_CPP_MAX_MESSAGE_SIZE),
    ("grpc.max_receive_message_length",
     ray_constants.GRPC_CPP_MAX_MESSAGE_SIZE),
)


class GCSHealthCheckThread(threading.Thread):
    def __init__(self, gcs_address: str):
        self.gcs_address = gcs_address
        self.work_queue = Queue()

        super().__init__(daemon=True)