예제 #1
0
파일: fluent.py 프로젝트: iPieter/kiwi
def set_experiment(experiment_name):
    """
    Set given experiment as active experiment. If experiment does not exist, create an experiment
    with provided name.

    :param experiment_name: Name of experiment to be activated.
    """
    client = MlflowClient()
    experiment = client.get_experiment_by_name(experiment_name)
    exp_id = experiment.experiment_id if experiment else None
    if exp_id is None:  # id can be 0
        print("INFO: '{}' does not exist. Creating a new experiment".format(
            experiment_name))
        exp_id = client.create_experiment(experiment_name)
    elif experiment.lifecycle_stage == LifecycleStage.DELETED:
        raise MlflowException(
            "Cannot set a deleted experiment '%s' as the active experiment."
            " You can restore the experiment, or permanently delete the "
            " experiment to create a new one." % experiment.name)
    global _active_experiment_id
    _active_experiment_id = exp_id
예제 #2
0
def test_run_local_experiment_specification(experiment_name):
    invoke_cli_runner(cli.run, [
        TEST_PROJECT_DIR,
        "-e",
        "greeter",
        "-P",
        "name=test",
        "--experiment-name",
        experiment_name,
    ])

    client = MlflowClient()
    experiment_id = client.get_experiment_by_name(
        experiment_name).experiment_id

    invoke_cli_runner(cli.run, [
        TEST_PROJECT_DIR,
        "-e",
        "greeter",
        "-P",
        "name=test",
        "--experiment-id",
        experiment_id,
    ])