MCPcopy
hub / github.com/mudler/LocalAI / serve

Function serve

backend/python/tinygrad/backend.py:760–779  ·  view source on GitHub ↗
(address)

Source from the content-addressed store, hash-verified

758
759
760async def serve(address):
761 server = grpc.aio.server(
762 migration_thread_pool=futures.ThreadPoolExecutor(max_workers=MAX_WORKERS),
763 options=[
764 ('grpc.max_message_length', 50 * 1024 * 1024),
765 ('grpc.max_send_message_length', 50 * 1024 * 1024),
766 ('grpc.max_receive_message_length', 50 * 1024 * 1024),
767 ],
768 interceptors=get_auth_interceptors(aio=True),
769 )
770 backend_pb2_grpc.add_BackendServicer_to_server(BackendServicer(), server)
771 server.add_insecure_port(address)
772
773 loop = asyncio.get_event_loop()
774 for sig in (signal.SIGINT, signal.SIGTERM):
775 loop.add_signal_handler(sig, lambda: asyncio.ensure_future(server.stop(5)))
776
777 await server.start()
778 print("Server started. Listening on: " + address, file=sys.stderr)
779 await server.wait_for_termination()
780
781
782if __name__ == "__main__":

Callers 1

backend.pyFile · 0.70

Calls 3

get_auth_interceptorsFunction · 0.90
startMethod · 0.80
BackendServicerClass · 0.70

Tested by

no test coverage detected