File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -1808,6 +1808,28 @@ async def close(self):
1808
1808
assert not s .workers
1809
1809
1810
1810
1811
+ @gen_cluster (
1812
+ client = True ,
1813
+ nthreads = [("" , 1 )],
1814
+ Worker = Nanny ,
1815
+ worker_kwargs = {"heartbeat_interval" : "1ms" },
1816
+ )
1817
+ async def test_heartbeat_missing_restarts (c , s : Scheduler , n : Nanny ):
1818
+ old_heartbeat_handler = s .handlers ["heartbeat_worker" ]
1819
+ s .handlers ["heartbeat_worker" ] = lambda * args , ** kwargs : {"status" : "missing" }
1820
+
1821
+ assert n .process
1822
+ await n .process .stopped .wait ()
1823
+
1824
+ assert not s .workers
1825
+ s .handlers ["heartbeat_worker" ] = old_heartbeat_handler
1826
+
1827
+ await n .process .running .wait ()
1828
+ assert n .status == Status .running
1829
+
1830
+ await c .wait_for_workers (1 )
1831
+
1832
+
1811
1833
@gen_cluster (nthreads = [])
1812
1834
async def test_bad_local_directory (s ):
1813
1835
try :
Original file line number Diff line number Diff line change @@ -1257,7 +1257,8 @@ async def heartbeat(self):
1257
1257
logger .error (
1258
1258
f"Scheduler was unaware of this worker { self .address !r} . Shutting down."
1259
1259
)
1260
- await self .close ()
1260
+ # Something is out of sync; have the nanny restart us if possible.
1261
+ await self .close (nanny = False )
1261
1262
return
1262
1263
1263
1264
self .scheduler_delay = response ["time" ] - middle
You can’t perform that action at this time.
0 commit comments