tvalentyn commented on code in PR #36367:
URL: https://github.com/apache/beam/pull/36367#discussion_r2430902730


##########
sdks/python/apache_beam/runners/worker/sdk_worker.py:
##########
@@ -559,15 +559,18 @@ def discard(self, instruction_id, exception):
     """
     Marks the instruction id as failed shutting down the ``BundleProcessor``.
     """
+    processor = None
     with self._lock:
       self.failed_instruction_ids[instruction_id] = exception
       while len(self.failed_instruction_ids) > MAX_FAILED_INSTRUCTIONS:
         self.failed_instruction_ids.popitem(last=False)
-      processor = self.active_bundle_processors[instruction_id][1]
-      del self.active_bundle_processors[instruction_id]
+      if instruction_id in self.active_bundle_processors:
+        processor = self.active_bundle_processors.pop(instruction_id)[1]

Review Comment:
   it is actually a tuple, not a list.
   
   ```
   self.active_bundle_processors = { }  # type: Dict[str, Tuple[str, 
bundle_processor.BundleProcessor]]  
   
   # sample usage
   
   self.active_bundle_processors[ instruction_id] = bundle_descriptor_id, 
processor
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to