Exemplo n.º 1
0
def test_deserialize_dask_on_kubernetes_environment():
    env = environments.kubernetes.DaskOnKubernetesEnvironment(
        base_image="a", python_dependencies=["b", "c"], registry_url="f")
    serialized = DaskOnKubernetesEnvironmentSchema().dump(env)
    deserialized = DaskOnKubernetesEnvironmentSchema().load(serialized)

    assert deserialized.base_image == env.base_image
    assert deserialized.registry_url == env.registry_url
Exemplo n.º 2
0
def test_serialize_dask_on_kubernetes_environment_defaults():
    env = environments.kubernetes.DaskOnKubernetesEnvironment()
    serialized = DaskOnKubernetesEnvironmentSchema().dump(env)
    assert serialized["base_image"] == "python:3.6"
    assert serialized["registry_url"] == None
    assert serialized["image_name"] == None
    assert serialized["image_tag"] == None
    assert serialized["__version__"] == prefect.__version__
    assert serialized["max_workers"] == 1
Exemplo n.º 3
0
def test_serialize_dask_on_kubernetes_environment_no_base_image():
    env = environments.kubernetes.DaskOnKubernetesEnvironment(
        python_dependencies=["b", "c"],
        registry_url="f",
        image_name="g",
        image_tag="h",
        max_workers=5,
    )
    serialized = DaskOnKubernetesEnvironmentSchema().dump(env)
    assert serialized["base_image"] == "python:3.6"
    assert serialized["registry_url"] == "f"
    assert serialized["image_name"] == "g"
    assert serialized["image_tag"] == "h"
    assert serialized["__version__"] == prefect.__version__
    assert serialized["max_workers"] == 5
Exemplo n.º 4
0
def test_deserialize_minimal_dask_on_kubernetes_environment():
    schema = DaskOnKubernetesEnvironmentSchema()
    assert schema.load(schema.dump({"base_image": "a", "registry_url": "b"}))
Exemplo n.º 5
0
def test_deserialize_empty_dask_on_kubernetes_environment():
    schema = DaskOnKubernetesEnvironmentSchema()
    with pytest.raises(marshmallow.ValidationError):
        schema.load(schema.dump({}))