AnandInguva commented on code in PR #26261:
URL: https://github.com/apache/beam/pull/26261#discussion_r1165868465
##########
sdks/python/apache_beam/ml/inference/base.py:
##########
@@ -368,20 +369,71 @@ def expand(
# batching DoFn APIs.
| beam.BatchElements(**self._model_handler.batch_elements_kwargs()))
+ run_inference_pardo = beam.ParDo(
+ _RunInferenceDoFn(
+ self._model_handler,
+ self._clock,
+ self._metrics_namespace,
+ self._enable_side_input_loading),
+ self._inference_args,
+ beam.pvalue.AsSingleton(
+ self._model_metadata_pcoll,
+ ) if self._enable_side_input_loading else None).with_resource_hints(
+ **resource_hints)
+
+ if self._with_exception_handling:
+ run_inference_pardo = run_inference_pardo.with_exception_handling(
+ exc_class=self._exc_class,
+ use_subprocess=self._use_subprocess,
+ threshold=self._threshold)
+
return (
batched_elements_pcoll
- | 'BeamML_RunInference' >> (
- beam.ParDo(
- _RunInferenceDoFn(
- self._model_handler,
- self._clock,
- self._metrics_namespace,
- self._enable_side_input_loading),
- self._inference_args,
- beam.pvalue.AsSingleton(
- self._model_metadata_pcoll,
- ) if self._enable_side_input_loading else
- None).with_resource_hints(**resource_hints)))
+ | 'BeamML_RunInference' >> run_inference_pardo)
+
+ def with_exception_handling(
+ self, *, exc_class=Exception, use_subprocess=False, threshold=1):
Review Comment:
Do we want to provide `main_tag` and `dead_letter_tag`?
--
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]