Exemplo n.º 1
0
def mr_str_to_obj(redis_db, mr_list):
    mr_object_list = []
    for mr in mr_list:
        service_name, resource = mr.split(',')
        deployments = tbot_datastore.read_service_locations(
            redis_db, service_name)
        mr_object_list.append(MR(service_name, resource, deployments))
    return mr_object_list
Exemplo n.º 2
0
def get_all_mrs(redis_db):
    mr_name = 'mr_alloc'
    all_mrs = redis_db.hgetall(mr_name)
    mr_list = list(all_mrs.keys())
    mr_object_list = []
    for mr in mr_list:
        service_name, resource = mr.split(',')
        deployments = tbot_datastore.read_service_locations(
            redis_db, service_name)
        mr_object_list.append(MR(service_name, resource, deployments))
    return mr_object_list
Exemplo n.º 3
0
def read_all_mr_alloc(redis_db):
    mr_name = 'mr_alloc'
    mr_to_score = redis_db.hgetall(mr_name)
    for mr in mr_to_score:
        mr_to_score[mr] = float(mr_to_score[mr])

    mr_allocation_list = {}
    for mr in mr_to_score:
        service_name, resource = mr.split(',')
        deployments = tbot_datastore.read_service_locations(
            redis_db, service_name)
        mr_object = MR(service_name, resource, deployments)
        mr_allocation_list[mr_object] = mr_to_score[mr]

    return mr_allocation_list