示例#1
0
def test_serialize_remote_dask_environment():
    env = environments.RemoteDaskEnvironment(address="test")

    schema = RemoteDaskEnvironmentSchema()
    serialized = schema.dump(env)
    assert serialized
    assert serialized["__version__"] == prefect.__version__
    assert serialized["address"] == "test"
    assert serialized["labels"] == []

    new = schema.load(serialized)
    assert new.address == "test"
    assert new.labels == set()
示例#2
0
def test_serialize_remote_dask_environment_with_labels():
    env = environments.RemoteDaskEnvironment(
        address="test",
        labels=["bob", "alice"],
        executor_kwargs={"not": "present"})

    schema = RemoteDaskEnvironmentSchema()
    serialized = schema.dump(env)
    assert serialized
    assert serialized["__version__"] == prefect.__version__
    assert serialized["address"] == "test"
    assert set(serialized["labels"]) == set(["bob", "alice"])

    new = schema.load(serialized)
    assert new.address == "test"
    assert new.labels == set(["bob", "alice"])
示例#3
0
def test_serialize_remote_dask_environment_with_labels():
    env = environments.RemoteDaskEnvironment(
        address="test",
        labels=["b", "c", "a"],
        executor_kwargs={"not": "present"})

    schema = RemoteDaskEnvironmentSchema()
    serialized = schema.dump(env)
    assert serialized
    assert serialized["__version__"] == prefect.__version__
    assert serialized["address"] == "test"
    # labels should be sorted in the serialized obj
    assert serialized["labels"] == ["a", "b", "c"]

    new = schema.load(serialized)
    assert new.address == "test"
    assert new.labels == {"b", "c", "a"}