Data stored in one DGL server. In a distributed setting, DGL partitions all data associated with the graph (e.g., node and edge features, graph structure, etc.) to multiple partitions, each handled by one DGL server. Hence, the ServerState class includes all the data associated with
| 6 | |
| 7 | |
| 8 | class ServerState: |
| 9 | """Data stored in one DGL server. |
| 10 | |
| 11 | In a distributed setting, DGL partitions all data associated with the graph |
| 12 | (e.g., node and edge features, graph structure, etc.) to multiple partitions, |
| 13 | each handled by one DGL server. Hence, the ServerState class includes all |
| 14 | the data associated with a graph partition. |
| 15 | |
| 16 | Under some setup, users may want to deploy servers in a heterogeneous way |
| 17 | -- servers are further divided into special groups for fetching/updating |
| 18 | node/edge data and for sampling/querying on graph structure respectively. |
| 19 | In this case, the ServerState can be configured to include only node/edge |
| 20 | data or graph structure. |
| 21 | |
| 22 | Each machine can have multiple server and client processes, but only one |
| 23 | server is the *master* server while all the others are backup servers. All |
| 24 | clients and backup servers share the state of the master server via shared |
| 25 | memory, which means the ServerState class must be serializable and large |
| 26 | bulk data (e.g., node/edge features) must be stored in NDArray to leverage |
| 27 | shared memory. |
| 28 | |
| 29 | Attributes |
| 30 | ---------- |
| 31 | kv_store : KVServer |
| 32 | reference for KVServer |
| 33 | graph : DGLGraph |
| 34 | Graph structure of one partition |
| 35 | total_num_nodes : int |
| 36 | Total number of nodes |
| 37 | total_num_edges : int |
| 38 | Total number of edges |
| 39 | partition_book : GraphPartitionBook |
| 40 | Graph Partition book |
| 41 | use_graphbolt : bool |
| 42 | Whether to use graphbolt for dataloading. |
| 43 | """ |
| 44 | |
| 45 | def __init__(self, kv_store, local_g, partition_book, use_graphbolt=False): |
| 46 | self._kv_store = kv_store |
| 47 | self._graph = local_g |
| 48 | self.partition_book = partition_book |
| 49 | self._roles = {} |
| 50 | self._use_graphbolt = use_graphbolt |
| 51 | |
| 52 | @property |
| 53 | def roles(self): |
| 54 | """Roles of the client processes""" |
| 55 | return self._roles |
| 56 | |
| 57 | @property |
| 58 | def kv_store(self): |
| 59 | """Get data store.""" |
| 60 | return self._kv_store |
| 61 | |
| 62 | @kv_store.setter |
| 63 | def kv_store(self, kv_store): |
| 64 | self._kv_store = kv_store |
| 65 |