Exemple #1
0
 def destroy(self, _table):
     for p in range(_table.partition):
         proc_id = p % len(EggRoll.proc_list)
         i = self.__get_index_by_proc(proc_id)
         stub = self.egg_list[i]
         stub.destroy(kv_pb2.Empty(),
                      metadata=self.__get_meta(_table, str(p)))
Exemple #2
0
 def count(self, _table):
     count = 0
     for p in range(_table.partition):
         proc_id = p % len(EggRoll.proc_list)
         i = self.__get_index_by_proc(proc_id)
         stub = self.egg_list[i]
         count += stub.count(kv_pb2.Empty(), metadata=self.__get_meta(_table, str(p))).value
     return count
Exemple #3
0
    server_conf = file_utils.load_json_conf(server_conf_path)
    _roll_host = server_conf.get("servers").get("roll").get("host")
    _roll_port = server_conf.get("servers").get("roll").get("port")

    if not eggroll_context:
        eggroll_context = EggRollContext()
    _EggRoll(job_id, _roll_host, _roll_port, eggroll_context=eggroll_context)


def _get_meta(_table):
    return ('store_type', _table._type), ('table_name',
                                          _table._name), ('name_space',
                                                          _table._namespace)


empty = kv_pb2.Empty()


class _DTable(object):
    def __init__(self,
                 storage_locator,
                 partitions=1,
                 in_place_computing=False):
        # self.__client = _EggRoll.get_instance()
        self._namespace = storage_locator.namespace
        self._name = storage_locator.name
        self._type = storage_basic_pb2.StorageType.Name(storage_locator.type)
        self._partitions = partitions
        self.schema = {}
        self._in_place_computing = in_place_computing