File tree Expand file tree Collapse file tree 1 file changed +24
-15
lines changed Expand file tree Collapse file tree 1 file changed +24
-15
lines changed Original file line number Diff line number Diff line change @@ -80,18 +80,27 @@ async def main():
80
80
81
81
@pytest .mark .asyncio
82
82
async def test_dask_generator ():
83
- with Engine () as engine :
84
- async def gen ():
85
- for i in range (10 ):
86
- yield i
87
-
88
- job = DaskJob (gen )
89
- await engine .submit_async (job )
90
- await job .wait_until_status ("running" )
91
- assert job .status == "running"
92
- g = job .result ()
93
- i = 0
94
- async for x in g :
95
- assert x == i
96
- i += 1
97
- assert job .status == "done"
83
+ port = PortManager .find_free_port ()
84
+ cluster = LocalCluster (
85
+ dashboard_address = f":{ port } " ,
86
+ asynchronous = True ,
87
+ processes = False ,
88
+ )
89
+ client = Client (cluster )
90
+ engine = Engine ()
91
+ engine .dask_client = client
92
+
93
+ async def gen ():
94
+ for i in range (10 ):
95
+ yield i
96
+
97
+ job = DaskJob (gen )
98
+ await engine .submit_async (job )
99
+ await job .wait_until_status ("running" )
100
+ assert job .status == "running"
101
+ g = job .result ()
102
+ i = 0
103
+ async for x in g :
104
+ assert x == i
105
+ i += 1
106
+ assert job .status == "done"
You can’t perform that action at this time.
0 commit comments