From 2a8421294eef412a81e02ed9f01992cad26e4893 Mon Sep 17 00:00:00 2001 From: Neil Flood Date: Sat, 19 Oct 2024 10:36:39 +1000 Subject: [PATCH] Guard when workerBarrier is None (#118) --- rios/cmdline/rios_computeworker.py | 3 ++- rios/structures.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rios/cmdline/rios_computeworker.py b/rios/cmdline/rios_computeworker.py index 5274e24..c43977a 100755 --- a/rios/cmdline/rios_computeworker.py +++ b/rios/cmdline/rios_computeworker.py @@ -81,7 +81,8 @@ def riosRemoteComputeWorker(workerID, host, port, authkey): blockListByWorker = dataChan.workerInitData.get('blockListByWorker', None) blockList = blockListByWorker[workerID] - if not controls.concurrency.singleBlockComputeWorkers: + if (not controls.concurrency.singleBlockComputeWorkers and + hasattr(workerBarrier, 'wait')): # Wait at the barrier, so nothing proceeds until all workers have had # a chance to start computeBarrierTimeout = controls.concurrency.computeBarrierTimeout diff --git a/rios/structures.py b/rios/structures.py index 14b85be..5977a93 100644 --- a/rios/structures.py +++ b/rios/structures.py @@ -967,7 +967,8 @@ def shutdown(self): """ if hasattr(self, 'server'): self.server.stop_event.set() - self.workerBarrier.abort() + if self.workerBarrier is not None: + self.workerBarrier.abort() futures.wait([self.serverThread]) self.threadPool.shutdown()