Esempio n. 1
0
def get_metric_logs(logs_dir, metric_names):
    mc = MetricsCollector(metric_names)
    observation_log = mc.parse_file(logs_dir)
    dict_observation_log = json_format.MessageToDict(observation_log)
    return dict_observation_log["metricLogs"]
Esempio n. 2
0
    parser.add_argument("-w", "--worker_id", type=str, default="")
    parser.add_argument("-d", "--log_dir", type=str, default="/log")
    opt = parser.parse_args()
    return opt


if __name__ == '__main__':
    logger = getLogger(__name__)
    handler = StreamHandler()
    handler.setLevel(INFO)
    logger.setLevel(INFO)
    logger.addHandler(handler)
    logger.propagate = False
    opt = parse_options()
    mlset = api_pb2.MetricsLogSet(worker_id=opt.worker_id, metrics_logs=[])
    mc = MetricsCollector(opt.manager_addr, opt.manager_port, opt.study_id,
                          opt.worker_id)
    mls = mc.parse_file(opt.log_dir)
    for ml in mls:
        mla = mlset.metrics_logs.add()
        mla.name = ml.name
        for v in ml.values:
            va = mla.values.add()
            va.time = v.time
            va.value = v.value
    channel = grpc.beta.implementations.insecure_channel(
        opt.manager_addr, opt.manager_port)
    with api_pb2.beta_create_Manager_stub(channel) as client:
        logger.info("In " + mlset.worker_id + " " +
                    str(len(mlset.metrics_logs)) +
                    " metrics will be reported.")
        client.ReportMetricsLogs(
Esempio n. 3
0

if __name__ == '__main__':
    logger = getLogger(__name__)
    handler = StreamHandler()
    handler.setLevel(INFO)
    logger.setLevel(INFO)
    logger.addHandler(handler)
    logger.propagate = False
    opt = parse_options()
    manager_server = opt.manager_server_addr.split(':')
    if len(manager_server) != 2:
        raise Exception("Invalid katib manager service address: %s" %
                        opt.manager_server_addr)

    WaitOtherMainProcesses(completed_marked_dir=opt.dir_path)

    mc = MetricsCollector(opt.metric_names.split(';'))
    observation_log = mc.parse_file(opt.dir_path)

    channel = grpc.beta.implementations.insecure_channel(
        manager_server[0], int(manager_server[1]))

    with api_pb2.beta_create_DBManager_stub(channel) as client:
        logger.info("In " + opt.trial_name + " " +
                    str(len(observation_log.metric_logs)) +
                    " metrics will be reported.")
        client.ReportObservationLog(api_pb2.ReportObservationLogRequest(
            trial_name=opt.trial_name, observation_log=observation_log),
                                    timeout=timeout_in_seconds)
Esempio n. 4
0
File: main.py Progetto: wstian/katib
                        default="katib-manager")
    parser.add_argument("-p", "--manager_port", type=int, default=6789)
    parser.add_argument("-t", "--trial_name", type=str, default="")
    parser.add_argument("-d", "--log_dir", type=str, default="/log")
    parser.add_argument("-m", "--metric_names", type=str, default="")
    opt = parser.parse_args()
    return opt


if __name__ == '__main__':
    logger = getLogger(__name__)
    handler = StreamHandler()
    handler.setLevel(INFO)
    logger.setLevel(INFO)
    logger.addHandler(handler)
    logger.propagate = False
    opt = parse_options()

    mc = MetricsCollector(opt.metric_names.split(','))
    observation_log = mc.parse_file(opt.log_dir)

    channel = grpc.beta.implementations.insecure_channel(
        opt.manager_addr, opt.manager_port)
    with api_pb2.beta_create_Manager_stub(channel) as client:
        logger.info("In " + opt.trial_name + " " +
                    str(len(observation_log.metric_logs)) +
                    " metrics will be reported.")
        client.ReportObservationLog(
            api_pb2.ReportObservationLogRequest(
                trial_name=opt.trial_name, observation_log=observation_log),
            10)