Skip to content

Commit 7d9f283

Browse files
committed
Fix the bug when calling run() under pipeline's context manager in Beam.
PiperOrigin-RevId: 729199597
1 parent ab4eb7f commit 7d9f283

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tensorflow_data_validation/utils/test_util.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -445,12 +445,13 @@ def _equal(actual_results: Iterable[
445445

446446
options = beam.options.pipeline_options.PipelineOptions(
447447
runtime_type_check=True)
448-
with beam.Pipeline(options=options) as p:
449-
result = p | beam.Create(examples) | generator.ptransform
450-
util.assert_that(result, _make_result_matcher(self, expected_results))
451-
pipeline_result = p.run()
452-
if metrics_verify_fn:
453-
metrics_verify_fn(pipeline_result.metrics())
448+
p = beam.Pipeline(options=options)
449+
result = p | beam.Create(examples) | generator.ptransform
450+
util.assert_that(result, _make_result_matcher(self, expected_results))
451+
pipeline_result = p.run()
452+
pipeline_result.wait_until_finish()
453+
if metrics_verify_fn:
454+
metrics_verify_fn(pipeline_result.metrics())
454455

455456

456457
class CombinerFeatureStatsGeneratorTest(absltest.TestCase):

0 commit comments

Comments
 (0)