damccorm commented on code in PR #28546:
URL: https://github.com/apache/beam/pull/28546#discussion_r1332049852
##########
sdks/python/apache_beam/yaml/yaml_transform_unit_test.py:
##########
@@ -950,43 +948,6 @@ def
test_ensure_errors_consumed_no_output_in_error_handling(self):
with self.assertRaisesRegex(ValueError, r"Missing output.*"):
ensure_errors_consumed(spec)
- def test_expand_pipeline_with_string_spec(self):
- with new_pipeline() as p:
- spec = '''
- pipeline:
- type: chain
- transforms:
- - type: Create
- config:
- elements: [1,2,3]
- - type: PyMap
- config:
- fn: 'lambda x: x*x'
- '''
- result = expand_pipeline(p, spec)
-
- self.assertIsInstance(result, PCollection)
- self.assertEqual(str(result), 'PCollection[Map(lambda x: x*x).None]')
-
- def test_expand_pipeline_with_spec(self):
- with new_pipeline() as p:
- spec = '''
- pipeline:
- type: chain
- transforms:
- - type: Create
- config:
- elements: [1,2,3]
- - type: PyMap
Review Comment:
Is there a reason to cut these tests? Can we keep them with a non-Py Map?
##########
sdks/python/apache_beam/yaml/yaml_provider.py:
##########
@@ -508,19 +510,14 @@ def _parse_window_spec(spec):
# TODO: Triggering, etc.
return beam.WindowInto(window_fn)
+ def log_and_return(x):
+ logging.info(x)
+ return x
+
return InlineProvider(
dict({
'Create': create,
- 'PyMap': lambda fn: beam.Map(
- python_callable.PythonCallableWithSource(fn)),
- 'PyMapTuple': lambda fn: beam.MapTuple(
- python_callable.PythonCallableWithSource(fn)),
- 'PyFlatMap': lambda fn: beam.FlatMap(
- python_callable.PythonCallableWithSource(fn)),
- 'PyFlatMapTuple': lambda fn: beam.FlatMapTuple(
- python_callable.PythonCallableWithSource(fn)),
- 'PyFilter': lambda keep: beam.Filter(
- python_callable.PythonCallableWithSource(keep)),
+ 'LogForTesting': lambda: beam.Map(log_and_return),
Review Comment:
```suggestion
'Log': lambda: beam.Map(log_and_return),
```
any reason to call it `ForTesting`? Seems universally useful
--
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]