yeandy commented on code in PR #17671:
URL: https://github.com/apache/beam/pull/17671#discussion_r873727966
##########
sdks/python/apache_beam/ml/inference/base.py:
##########
@@ -193,13 +197,12 @@ def process(self, batch):
examples = batch
keys = None
- start_time = self._clock.get_current_time_in_microseconds()
+ start_time = _to_microseconds(self._clock.time())
result_generator = self._inference_runner.run_inference(
examples, self._model)
predictions = list(result_generator)
- inference_latency = self._clock.get_current_time_in_microseconds(
- ) - start_time
+ inference_latency = _to_microseconds(self._clock.time()) - start_time
Review Comment:
nit: to match the pattern used to compute `load_model_latency_ms`
```suggestion
end_time = _to_microseconds(self._clock.time())
inference_latency = end_time - start_time
```
##########
sdks/python/apache_beam/ml/inference/base.py:
##########
@@ -158,19 +163,18 @@ def __init__(self, model_loader: ModelLoader, clock=None):
self._inference_runner.get_metrics_namespace())
self._clock = clock
if not clock:
- self._clock = _ClockFactory.make_clock()
+ self._clock = time
Review Comment:
```suggestion
self._clock = time if not clock else clock
```
--
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]