예제 #1
0
def test_from_specification_errors():
    bad_spec = skein.ApplicationSpec.from_yaml("""
        name: bad_spec
        services:
          bad:
            resources:
              memory: 1 GiB
              vcores: 1
            script: exit 1
        """)
    with pytest.raises(ValueError):
        YarnCluster.from_specification(bad_spec)

    with pytest.raises(TypeError):
        YarnCluster.from_specification(object())
예제 #2
0
def test_from_specification(skein_client, conda_env, tmpdir, loop):
    spec = _make_specification(environment=conda_env,
                               worker_memory='512 MB',
                               scheduler_memory='512 MB',
                               name=APPNAME)
    fn = os.path.join(str(tmpdir), 'spec.yaml')
    with open(fn, 'w') as f:
        f.write(spec.to_yaml())

    with YarnCluster.from_specification(fn, skein_client=skein_client) as cluster:
        with Client(cluster, loop=loop):
            pass

    check_is_shutdown(skein_client, cluster.app_id)
예제 #3
0
def test_from_specification(skein_client, conda_env, tmpdir):
    spec = _make_specification(
        environment=conda_env,
        worker_memory="512 MiB",
        scheduler_memory="512 MiB",
        name="dask-yarn-test-from-specification",
    )
    fn = os.path.join(str(tmpdir), "spec.yaml")
    with open(fn, "w") as f:
        f.write(spec.to_yaml())

    with YarnCluster.from_specification(fn,
                                        skein_client=skein_client) as cluster:
        with Client(cluster):
            pass

    check_is_shutdown(skein_client, cluster.app_id)