Ejemplo n.º 1
0
def register_experiment(stub):
    obj = api_pb2.ObjectiveSpec(type=1,
                                goal=0.09,
                                objective_metric_name="loss")
    algo = api_pb2.AlgorithmSpec(algorithm_name="random")
    feasible_space = api_pb2.FeasibleSpace(min="1", max="5")
    parameter_specs = api_pb2.ExperimentSpec.ParameterSpecs()
    parameter_specs.parameters.add(name="lr",
                                   parameter_type=api_pb2.DOUBLE,
                                   feasible_space=feasible_space)
    exp_spec = api_pb2.ExperimentSpec(
        objective=obj,
        algorithm=algo,
        trial_template="run-mnist",
        metrics_collector_spec="metrics-collector",
        parallel_trial_count=2,
        max_trial_count=9)
    exp_status = api_pb2.ExperimentStatus(
        condition=1,
        start_time="2019-04-28T14:09:15Z",
        completion_time="2019-04-28T16:09:15Z")
    exp = api_pb2.Experiment(spec=exp_spec,
                             name=TEST_EXPERIMENT,
                             status=exp_status)
    try:
        stub.RegisterExperiment(
            api_pb2.RegisterExperimentRequest(experiment=exp), 10)
        logger.info("Register experiment %s successfully" % TEST_EXPERIMENT)
    except:
        logger.error("Failed to Register experiment", exc_info=True)
        raise
Ejemplo n.º 2
0
def update_experiment_status(stub):
  try:
    new = api_pb2.ExperimentStatus(condition=2,start_time="2019-04-28T17:09:15Z",completion_time="2019-04-28T18:09:15Z")
    stub.UpdateExperimentStatus(api_pb2.UpdateExperimentStatusRequest(experiment_name=TEST_EXPERIMENT, new_status=new),10)
    logger.info("Update status of experiment %s successfully" % TEST_EXPERIMENT)
  except:
    logger.error("Fail to update status of experiment", exc_info=True)
    raise