damccorm commented on code in PR #23830:
URL: https://github.com/apache/beam/pull/23830#discussion_r1004943092
##########
sdks/python/apache_beam/ml/inference/base.py:
##########
@@ -426,17 +427,22 @@ def setup(self):
def process(self, batch, inference_args):
start_time = _to_microseconds(self._clock.time_ns())
- result_generator = self._model_handler.run_inference(
+ try:
+ result_generator = self._model_handler.run_inference(
batch, self._model, inference_args)
- predictions = list(result_generator)
+ except BaseException:
+ self._metrics_collector.failed_batches_counter.inc()
+ raise
+ else:
Review Comment:
Right - raising an exception (or in this case, reraising an exception)
always causes function execution to terminate until you handle it (with an
except clause). In this case, the exception will be reraised to the worker
harness level before being retried (so all the code from the else statement on
will be skipped).
--
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]