Skip to content

Commit e806f90

Browse files
committed
try..except only around correct_state
1 parent fe94bd8 commit e806f90

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

distributed/deploy/spec.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,14 +469,15 @@ async def _close(self):
469469
await super()._close()
470470

471471
async def __aenter__(self):
472+
await self
472473
try:
473-
await self
474474
await self._correct_state()
475-
assert self.status == Status.running
476-
return self
477475
except Exception:
476+
# One or more Servers failed to start. Close the healthy workers and reraise
478477
await self.close()
479478
raise
479+
assert self.status == Status.running
480+
return self
480481

481482
def _threads_per_worker(self) -> int:
482483
"""Return the number of threads per worker for new workers"""

0 commit comments

Comments
 (0)