[ 
https://issues.apache.org/jira/browse/BEAM-14255?focusedWorklogId=770836&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-770836
 ]

ASF GitHub Bot logged work on BEAM-14255:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 16/May/22 13:38
            Start Date: 16/May/22 13:38
    Worklog Time Spent: 10m 
      Work Description: 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
   ```





Issue Time Tracking
-------------------

    Worklog Id:     (was: 770836)
    Time Spent: 1h 20m  (was: 1h 10m)

> Drop the clock abastraction and just use time.time for time measurements
> ------------------------------------------------------------------------
>
>                 Key: BEAM-14255
>                 URL: https://issues.apache.org/jira/browse/BEAM-14255
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-py-core
>            Reporter: Ryan Thompson
>            Assignee: Ryan Thompson
>            Priority: P2
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Right now the TFX-BSL Runinference library uses an abstract clock class to 
> get microsecond precision, but time.time should give an adequate precision.
>  
> Investigate removing the clock abstraction and just using time.time.
>  
> Alternatively, comment why the abstraction is useful.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to