MCPcopy
hub / github.com/dmlc/dgl / start_server

Function start_server

python/dgl/distributed/rpc_server.py:11–150  ·  view source on GitHub ↗

Start DGL server, which will be shared with all the rpc services. This is a blocking function -- it returns only when the server shutdown. Parameters ---------- server_id : int Current server ID (starts from 0). ip_config : str Path of IP configuration file.

(
    server_id,
    ip_config,
    num_servers,
    num_clients,
    server_state,
    max_queue_size=MAX_QUEUE_SIZE,
)

Source from the content-addressed store, hash-verified

9
10
11def start_server(
12 server_id,
13 ip_config,
14 num_servers,
15 num_clients,
16 server_state,
17 max_queue_size=MAX_QUEUE_SIZE,
18):
19 """Start DGL server, which will be shared with all the rpc services.
20
21 This is a blocking function -- it returns only when the server shutdown.
22
23 Parameters
24 ----------
25 server_id : int
26 Current server ID (starts from 0).
27 ip_config : str
28 Path of IP configuration file.
29 num_servers : int
30 Server count on each machine.
31 num_clients : int
32 Total number of clients that will be connected to the server.
33 Note that, we do not support dynamic connection for now. It means
34 that when all the clients connect to server, no client will can be added
35 to the cluster.
36 server_state : ServerSate object
37 Store in main data used by server.
38 max_queue_size : int
39 Maximal size (bytes) of server queue buffer (~20 GB on default).
40 Note that the 20 GB is just an upper-bound because DGL uses zero-copy and
41 it will not allocate 20GB memory at once.
42 """
43 assert server_id >= 0, (
44 "server_id (%d) cannot be a negative number." % server_id
45 )
46 assert num_servers > 0, (
47 "num_servers (%d) must be a positive number." % num_servers
48 )
49 assert num_clients >= 0, (
50 "num_client (%d) cannot be a negative number." % num_clients
51 )
52 assert max_queue_size > 0, (
53 "queue_size (%d) cannot be a negative number." % max_queue_size
54 )
55 # Register signal handler.
56 rpc.register_sig_handler()
57 # Register some basic services
58 rpc.register_service(
59 rpc.CLIENT_REGISTER,
60 rpc.ClientRegisterRequest,
61 rpc.ClientRegisterResponse,
62 )
63 rpc.register_service(rpc.SHUT_DOWN_SERVER, rpc.ShutDownRequest, None)
64 rpc.register_service(
65 rpc.GET_NUM_CLIENT,
66 rpc.GetNumberClientsRequest,
67 rpc.GetNumberClientsResponse,
68 )

Callers 1

startMethod · 0.70

Calls 7

DGLErrorClass · 0.85
formatMethod · 0.80
appendMethod · 0.80
keysMethod · 0.45
getMethod · 0.45
itemsMethod · 0.45
process_requestMethod · 0.45

Tested by

no test coverage detected