|
4 | 4 | from dask.distributed import Client
|
5 | 5 | from distributed.utils import TimeoutError
|
6 | 6 |
|
| 7 | +from dask_kubernetes.operator.objects import DaskCluster |
7 | 8 | from dask_kubernetes.operator import KubeCluster, make_cluster_spec
|
8 | 9 | from dask_kubernetes.exceptions import SchedulerStartupError
|
9 | 10 |
|
@@ -95,13 +96,22 @@ def test_multiple_clusters_simultaneously_same_loop(kopf_runner, docker_image):
|
95 | 96 | assert client2.submit(lambda x: x + 1, 10).result() == 11
|
96 | 97 |
|
97 | 98 |
|
98 |
| -def test_cluster_from_name(kopf_runner, docker_image, ns): |
| 99 | +@pytest.mark.asyncio |
| 100 | +async def test_cluster_from_name(kopf_runner, docker_image, ns): |
99 | 101 | with kopf_runner:
|
100 |
| - with KubeCluster( |
101 |
| - name="abc", namespace=ns, image=docker_image, n_workers=1 |
| 102 | + async with KubeCluster( |
| 103 | + name="abc", |
| 104 | + namespace=ns, |
| 105 | + image=docker_image, |
| 106 | + n_workers=1, |
| 107 | + asynchronous=True, |
102 | 108 | ) as firstcluster:
|
103 |
| - with KubeCluster.from_name("abc", namespace=ns) as secondcluster: |
| 109 | + async with KubeCluster.from_name( |
| 110 | + "abc", namespace=ns, asynchronous=True |
| 111 | + ) as secondcluster: |
104 | 112 | assert firstcluster == secondcluster
|
| 113 | + cluster = await DaskCluster.get("abc", namespace=ns) |
| 114 | + assert cluster.status["phase"] == "Running" |
105 | 115 |
|
106 | 116 |
|
107 | 117 | def test_cluster_scheduler_info_updated(kopf_runner, docker_image, ns):
|
|
0 commit comments