From 7ff2af6fe7bffea90dc4a31c93140c189917c659 Mon Sep 17 00:00:00 2001 From: Scott Date: Wed, 2 Feb 2022 13:47:36 -0800 Subject: Let's be explicit with asserts; there was a bug in histogram caused by assert foo when foo was an int with valid valid 0. --- executors.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'executors.py') diff --git a/executors.py b/executors.py index 34528a3..b4cb06b 100644 --- a/executors.py +++ b/executors.py @@ -345,7 +345,7 @@ class RemoteExecutorStatus: self.in_flight_bundles_by_worker[worker].remove(uuid) if not was_cancelled: start = self.start_per_bundle[uuid] - assert start + assert start is not None bundle_latency = ts - start x = self.finished_bundle_timings_per_worker.get(worker, list()) x.append(bundle_latency) @@ -740,7 +740,7 @@ class RemoteExecutor(BaseExecutor): worker = None while worker is None: worker = self.find_available_worker_or_block(avoid_machine) - assert worker + assert worker is not None # Ok, found a worker. bundle.worker = worker @@ -840,7 +840,7 @@ class RemoteExecutor(BaseExecutor): self, p: Optional[subprocess.Popen], bundle: BundleDetails, depth: int ) -> Any: machine = bundle.machine - assert p + assert p is not None pid = p.pid if depth > 3: logger.error( @@ -984,7 +984,7 @@ class RemoteExecutor(BaseExecutor): # Tell the original to stop if we finished first. if not was_cancelled: orig_bundle = bundle.src_bundle - assert orig_bundle + assert orig_bundle is not None logger.debug( f'{bundle}: Notifying original {orig_bundle.uuid} we beat them to it.' ) -- cgit v1.3