Let's be explicit with asserts; there was a bug in histogram
[python_utils.git] / executors.py
index 34528a33c2d10236cd7527fe53ffd027fa8020ca..b4cb06b4c9ad80816f0bb13e05e23863846fa8c1 100644 (file)
@@ -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.'
                 )