Пример #1
0
def test_scale_up_and_down():
    loop = IOLoop.current()
    cluster = LocalCluster(0,
                           scheduler_port=0,
                           processes=False,
                           silence_logs=False,
                           diagnostics_port=None,
                           loop=loop,
                           start=False)
    c = yield Client(cluster, loop=loop, asynchronous=True)

    assert not cluster.workers

    yield cluster.scale_up(2)
    assert len(cluster.workers) == 2
    assert len(cluster.scheduler.ncores) == 2

    addr = cluster.workers[0].address
    yield cluster.scale_down([addr])

    assert len(cluster.workers) == 1
    assert addr not in cluster.scheduler.ncores

    yield c._close()
    yield cluster._close()
Пример #2
0
def test_scale_up_and_down():
    loop = IOLoop.current()
    cluster = LocalCluster(0,
                           scheduler_port=0,
                           nanny=False,
                           silence_logs=False,
                           diagnostic_port=None,
                           loop=loop,
                           start=False)
    c = Client(cluster, start=False, loop=loop)
    yield c._start()

    assert not cluster.workers

    yield cluster.scale_up(2)
    assert len(cluster.workers) == 2
    assert len(cluster.scheduler.ncores) == 2

    addr = cluster.workers[0].address
    yield cluster.scale_down([addr])

    assert len(cluster.workers) == 1
    assert addr not in cluster.scheduler.ncores

    yield c._shutdown()
    yield cluster._close()
 def test_dask_cv_single(self):
     test_cluster = LocalCluster(1)
     test_client = Client(test_cluster)
     iris = load_iris()
     reg = tree.DecisionTreeClassifier()
     cv_score = test_client.submit(cross_val_score, reg, iris.data,
                                   iris.target)
     self.assertGreater(cv_score.result().mean(), 0)
     test_cluster.scale_up(4)
     _cv_results = {
         'reg_%i':
         test_client.submit(cross_val_score,
                            tree.DecisionTreeClassifier(min_samples_leaf=i),
                            iris.data, iris.target)
         for i in range(5)
     }
     cv_results = test_client.gather(list(_cv_results.values()))
     for cv_result in cv_results:
         self.assertGreaterEqual(cv_result.mean(), 0)
Пример #4
0
def test_scale_up_and_down():
    loop = IOLoop.current()
    cluster = LocalCluster(0, scheduler_port=0, nanny=False, silence_logs=False,
                           diagnostics_port=None, loop=loop, start=False)
    c = Client(cluster, start=False, loop=loop)
    yield c._start()

    assert not cluster.workers

    yield cluster.scale_up(2)
    assert len(cluster.workers) == 2
    assert len(cluster.scheduler.ncores) == 2

    addr = cluster.workers[0].address
    yield cluster.scale_down([addr])

    assert len(cluster.workers) == 1
    assert addr not in cluster.scheduler.ncores

    yield c._shutdown()
    yield cluster._close()