Пример #1
0
    def __init__(self, config, shard_num, ip_config, server_id):
        self.config = helper.load_config(config)
        self.shard_num = shard_num
        self.server_id = server_id

        if self.config.symmetry:
            self.symmetry = self.config.symmetry
        else:
            self.symmetry = False

        if isinstance(ip_config, str):
            self.ip_addr = helper.load_ip_addr(ip_config)
        elif isinstance(ip_config, list):
            self.ip_addr = ";".join(ip_config)
        else:
            raise TypeError("ip_config should be list of IP address or "
                            "a path of IP configuration file. "
                            "But got %s" % (type(ip_config)))

        self.ntype2files = helper.parse_files(self.config.ntype2files)
        self.node_type_list = list(self.ntype2files.keys())

        self.etype2files = helper.parse_files(self.config.etype2files)
        self.edge_type_list = helper.get_all_edge_type(self.etype2files,
                                                       self.symmetry)

        self._server = GraphPyServer()
        self._server.set_up(self.ip_addr, self.shard_num, self.node_type_list,
                            self.edge_type_list, self.server_id)

        if self.config.nfeat_info:
            for item in self.config.nfeat_info:
                self._server.add_table_feat_conf(*item)
        self._server.start_server()
Пример #2
0
    def __init__(self, config, shard_num, ip_config, server_id,
                 is_block=False):
        """
        Args:
            config: a yaml configure file or a dict of parameters.
            Below are some necessary hyper-parameters:
            ```
                etype2files: "u2e2t:./your_path/edges.txt"
                symmetry: True
                ntype2files: "u:./your_path/node_types.txt,t:./your_path/node_types.txt"

            ```

            shard_num: int, the sharding number of graph data

            ip_config: list of IP address or a path of IP configuration file
            
            For example, the following TXT shows a 4-machine configuration:

                172.31.50.123:8245
                172.31.50.124:8245
                172.31.50.125:8245
                172.31.50.126:8245

            server_id: int 

            is_block: bool, whether to block the server.

        """
        self.config = helper.load_config(config)
        self.shard_num = shard_num
        self.server_id = server_id
        self.is_block = is_block

        if self.config.symmetry:
            self.symmetry = self.config.symmetry
        else:
            self.symmetry = False

        self.ip_addr = helper.load_ip_addr(ip_config)

        self.ntype2files = helper.parse_files(self.config.ntype2files)
        self.node_type_list = list(self.ntype2files.keys())

        self.etype2files = helper.parse_files(self.config.etype2files)
        self.edge_type_list = helper.get_all_edge_type(self.etype2files,
                                                       self.symmetry)

        self._server = GraphPyServer()
        self._server.set_up(self.ip_addr, self.shard_num, self.node_type_list,
                            self.edge_type_list, self.server_id)

        if self.config.nfeat_info:
            for item in self.config.nfeat_info:
                self._server.add_table_feat_conf(*item)
        self._server.start_server(self.is_block)
Пример #3
0
    def __init__(self, config, shard_num, ip_config, client_id):
        """
        Args:
            config: a yaml configure file or a dict of parameters

            shard_num: int, the sharding number of graph data

            ip_config: list of IP address or a path of IP configuration file
            
            For example, the following TXT shows a 4-machine configuration:

                172.31.50.123:8245
                172.31.50.124:8245
                172.31.50.125:8245
                172.31.50.126:8245

            client_id: int 

        """
        self.config = helper.load_config(config)
        self.shard_num = shard_num
        self.client_id = client_id

        if self.config.symmetry:
            self.symmetry = self.config.symmetry
        else:
            self.symmetry = False

        if self.config.node_batch_stream_shuffle_size:
            self.stream_shuffle_size = self.config.node_batch_stream_shuffle_size
        else:
            warnings.warn("node_batch_stream_shuffle_size is not specified, "
                          "default value is 20000")
            self.stream_shuffle_size = 20000

        self.ip_addr = helper.load_ip_addr(ip_config)
        self.server_num = len(self.ip_addr.split(";"))

        if self.config.nfeat_info is not None:
            self.nfeat_info = helper.convert_nfeat_info(self.config.nfeat_info)
        else:
            self.nfeat_info = None

        self.ntype2files = helper.parse_files(self.config.ntype2files)
        self.node_type_list = list(self.ntype2files.keys())

        self.etype2files = helper.parse_files(self.config.etype2files)
        self.edge_type_list = helper.get_all_edge_type(self.etype2files,
                                                       self.symmetry)

        self._client = GraphPyClient()
        self._client.set_up(self.ip_addr, self.shard_num, self.node_type_list,
                            self.edge_type_list, self.client_id)
        self._client.start_client()
Пример #4
0
    def __init__(self, config, shard_num, server_num, ip_config, client_id):
        self.config = helper.load_config(config)
        self.shard_num = shard_num
        self.server_num = server_num
        self.client_id = client_id

        if self.config.symmetry:
            self.symmetry = self.config.symmetry
        else:
            self.symmetry = False

        if self.config.node_batch_stream_shuffle_size:
            self.stream_shuffle_size = self.config.node_batch_stream_shuffle_size
        else:
            warnings.warn("node_batch_stream_shuffle_size is not specified, "
                          "default value is 20000")
            self.stream_shuffle_size = 20000

        if isinstance(ip_config, str):
            self.ip_addr = helper.load_ip_addr(ip_config)
        elif isinstance(ip_config, list):
            self.ip_addr = ";".join(ip_config)
        else:
            raise TypeError("ip_config should be list of IP address or "
                            "a path of IP configuration file. "
                            "But got %s" % (type(ip_config)))

        if self.config.nfeat_info is not None:
            self.nfeat_info = helper.convert_nfeat_info(self.config.nfeat_info)
        else:
            self.nfeat_info = None

        self.ntype2files = helper.parse_files(self.config.ntype2files)
        self.node_type_list = list(self.ntype2files.keys())

        self.etype2files = helper.parse_files(self.config.etype2files)
        self.edge_type_list = helper.get_all_edge_type(self.etype2files,
                                                       self.symmetry)

        self._client = GraphPyClient()
        self._client.set_up(self.ip_addr, self.shard_num, self.node_type_list,
                            self.edge_type_list, self.client_id)
        self._client.start_client()