コード例 #1
0
def open(pool_uuid, cont_uuid, flag):
    """Open a container and return a daosdm() object"""

    if flag not in ['r', 'w']:
        raise error

    container = pydaos.Cont(pool_uuid, cont_uuid)

    kvstore = container.rootkv()

    # pylint: disable=redefined-variable-type
    if flag == 'w':
        db = daosdm_rw(kvstore)
    else:
        db = daosdm(kvstore)
# pylint: enable=redefined-variable-type
    return db
コード例 #2
0
DIMENSIONS = int(os.getenv("DIMENSIONS", "500"))
NUMBER_OF_CENTERS = int(os.getenv("NUMBER_OF_CENTERS", "20"))
NUMBER_OF_ITERATIONS = int(os.getenv("NUMBER_OF_ITERATIONS", "10"))
NUMBER_OF_KMEANS_ITERATIONS = int(
    os.getenv("NUMBER_OF_KMEANS_ITERATIONS", "10"))

SEED = 42
MODE = 'uniform'

DAOS_POOL_UUID = os.environ["DAOS_POOL"]
DAOS_CONT_UUID = os.environ["DAOS_CONT"]

#############################################
#############################################

DAOS_CONT = pydaos.Cont(DAOS_POOL_UUID, DAOS_CONT_UUID)
DAOS_KV = DAOS_CONT.rootkv()

NP_FROMSTRING_DTYPE = np.dtype('float64')
NP_FROMSTRING_SHAPES = list()


def generate_points(num_points, dim, mode, seed):
    # Random generation distributions
    rand = {
        'normal': lambda k: np.random.normal(0, 1, k),
        'uniform': lambda k: np.random.random(k),
    }
    r = rand[mode]
    np.random.seed(seed)
    mat = np.array([r(dim) for __ in range(num_points)])