Skip to content

Commit

Permalink
Remove exception block from handle_scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
mrocklin committed Apr 28, 2022
1 parent 0505df8 commit 50c31ef
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions distributed/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1268,21 +1268,17 @@ async def heartbeat(self):

@fail_hard
async def handle_scheduler(self, comm):
try:
await self.handle_stream(comm, every_cycle=[self.ensure_communicating])
except Exception as e:
logger.exception(e)
raise
finally:
if self.reconnect and self.status in Status.ANY_RUNNING:
logger.info("Connection to scheduler broken. Reconnecting...")
self.loop.add_callback(self.heartbeat)
else:
logger.info(
"Connection to scheduler broken. Closing without reporting. Status: %s",
self.status,
)
await self.close(report=False)
await self.handle_stream(comm, every_cycle=[self.ensure_communicating])

if self.reconnect and self.status in Status.ANY_RUNNING:
logger.info("Connection to scheduler broken. Reconnecting...")
self.loop.add_callback(self.heartbeat)
else:
logger.info(
"Connection to scheduler broken. Closing without reporting. Status: %s",
self.status,
)
await self.close(report=False)

async def upload_file(self, comm, filename=None, data=None, load=True):
out_filename = os.path.join(self.local_directory, filename)
Expand Down

0 comments on commit 50c31ef

Please sign in to comment.