damccorm commented on code in PR #29938:
URL: https://github.com/apache/beam/pull/29938#discussion_r1450917235
##########
sdks/python/apache_beam/ml/transforms/base_test.py:
##########
@@ -588,5 +590,51 @@ def test_with_same_local_artifact_location(self):
artifact_location=artifact_location)
+class MLTransformDLQTest(unittest.TestCase):
+ def setUp(self) -> None:
+ self.artifact_location = tempfile.mkdtemp()
+
+ def tearDown(self):
+ shutil.rmtree(self.artifact_location)
+
+ def test_dlq_with_embeddings(self):
+ with beam.Pipeline() as p:
+ good, bad = (
+ p
+ | beam.Create([{
+ 'x': 1
+ },
+ {
+ 'x': 3,
+ },
+ {
+ 'x': 'Hello'
+ }
+ ],
+ )
+ | base.MLTransform(
+ write_artifact_location=self.artifact_location).with_transform(
+ FakeEmbeddingsManager(
+ columns=['x'])).with_exception_handling())
+
+ good_expected_elements = [{'x': 'olleH'}]
+
+ assert_that(
+ good,
+ equal_to(good_expected_elements),
+ label='good',
+ )
+
+ # batching happens in RunInference hence elements
+ # are in lists in the bad pcoll.
Review Comment:
Ah got it, I misunderstood. Feel free to ignore this comment
--
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]