Exemplo n.º 1
0
def test_docker_mount_local_artifact_uri(artifact_uri, host_artifact_uri,
                                         container_artifact_uri, should_mount):
    active_run = mock.MagicMock()
    run_info = mock.MagicMock()
    run_info.run_id = "fake_run_id"
    run_info.experiment_id = "fake_experiment_id"
    run_info.artifact_uri = artifact_uri
    active_run.info = run_info
    image = mock.MagicMock()
    image.tags = ["image:tag"]

    docker_command = _get_docker_command(image, active_run)

    docker_volume_expected = "-v {}:{}".format(host_artifact_uri,
                                               container_artifact_uri)
    assert (docker_volume_expected in " ".join(docker_command)) == should_mount
Exemplo n.º 2
0
def test_docker_run_args(docker_args):
    active_run = mock.MagicMock()
    run_info = mock.MagicMock()
    run_info.run_id = "fake_run_id"
    run_info.experiment_id = "fake_experiment_id"
    run_info.artifact_uri = "/tmp/mlruns/artifacts"
    active_run.info = run_info
    image = mock.MagicMock()
    image.tags = ["image:tag"]

    docker_command = _get_docker_command(image, active_run, docker_args, None,
                                         None)

    for flag, value in docker_args.items():
        assert docker_command[docker_command.index(value) -
                              1] == "--{}".format(flag)