damccorm commented on code in PR #41200:
URL: https://github.com/apache/beam/pull/41200#discussion_r4566096531


##########
sdks/python/apache_beam/examples/inference/table_row_inference.py:
##########
@@ -358,8 +425,31 @@ def run(
 
   result = pipeline.run()
 
-  if known_args.mode == 'batch' and not test_pipeline:
+  if test_pipeline:
+    return result

Review Comment:
   In `table_row_inference_benchmark.py`, 
`TableRowInferenceBenchmarkTest.test()` invokes `table_row_inference.run(..., 
test_pipeline=self.pipeline)` where `self.pipeline` is a `TestPipeline` 
instance (`bool(test_pipeline)` is `True`).
   
   Because `test_pipeline` is truthy during the benchmark:
   1. `if not test_pipeline:` (at line 344) evaluates to `False`, so the feeder 
thread (`run_load_pipeline`) is never started.
   2. `if test_pipeline: return result` (here at lines 428-429) returns 
immediately after `pipeline.run()`, skipping 
`result.wait_until_finish(duration=1800000)`, `result.cancel()`, and 
`cleanup_pubsub_resources(...)`.
   
   Could we remove the `not test_pipeline` / `if test_pipeline:` guards 
(matching `pytorch_image_captioning.py`, `pytorch_image_object_detection.py`, 
and `pytorch_imagenet_rightfit.py`) so the feeder and teardown logic run during 
the benchmark?



-- 
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