This is an automated email from the ASF dual-hosted git repository.
robertwb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new a460eb14ab5 Minor visibility improvements to render runner. (#24480)
a460eb14ab5 is described below
commit a460eb14ab5b1d05f0dfeb1afd6b427215478d96
Author: Robert Bradshaw <[email protected]>
AuthorDate: Fri Dec 2 10:29:09 2022 -0800
Minor visibility improvements to render runner. (#24480)
Minor visibility improvements to render runner.
* Dashed rather than dotted lines are more visible for side inputs.
* A light fill for all nodes brings out the shape of the pipeline better.
See
python -m apache_beam.examples.wordcount_minimal
--runner=apache_beam.runners.render.RenderRunner --render_output=out.png
---
sdks/python/apache_beam/runners/render.py | 5 +++--
sdks/python/apache_beam/runners/render_test.py | 4 ++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/sdks/python/apache_beam/runners/render.py
b/sdks/python/apache_beam/runners/render.py
index c6475ec4874..1ace7f8c312 100644
--- a/sdks/python/apache_beam/runners/render.py
+++ b/sdks/python/apache_beam/runners/render.py
@@ -80,7 +80,8 @@ except ImportError:
# From the Beam site, circa November 2022.
DEFAULT_EDGE_STYLE = 'color="#ff570b"'
-DEFAULT_TRANSFORM_STYLE = 'shape=rect style="rounded" color="#ff570b"'
+DEFAULT_TRANSFORM_STYLE = (
+ 'shape=rect style="rounded, filled" color="#ff570b" fillcolor="#fff6dd"')
DEFAULT_HIGHLIGHT_STYLE = (
'shape=rect style="rounded, filled" color="#ff570b" fillcolor="#ffdb97"')
@@ -226,7 +227,7 @@ class PipelineRenderer:
output_label = name if len(transform.outputs) > 1 else ''
for consumer, is_side_input in pcoll_leaf_consumers[output]:
# Can't yield this here as the consumer might not be in this cluster.
- edge_style = 'dotted' if is_side_input else 'solid'
+ edge_style = 'dashed' if is_side_input else 'solid'
edge_attributes = ' '.join([
f'label="{output_label}" style={edge_style}',
DEFAULT_EDGE_STYLE,
diff --git a/sdks/python/apache_beam/runners/render_test.py
b/sdks/python/apache_beam/runners/render_test.py
index bcfd4cb66c3..5872e003aec 100644
--- a/sdks/python/apache_beam/runners/render_test.py
+++ b/sdks/python/apache_beam/runners/render_test.py
@@ -44,13 +44,13 @@ class RenderRunnerTest(unittest.TestCase):
pcoll = p | beam.Impulse() | beam.FlatMap(lambda x: [1, 2, 3])
dot = render.PipelineRenderer(p.to_runner_api(), default_options).to_dot()
self.assertEqual(dot.count('->'), 1)
- self.assertNotIn('dotted', dot)
+ self.assertNotIn('dashed', dot)
_ = pcoll | beam.Map(
lambda x, side: x * side, side=beam.pvalue.AsList(pcoll))
dot = render.PipelineRenderer(p.to_runner_api(), default_options).to_dot()
self.assertEqual(dot.count('->'), 3)
- self.assertIn('dotted', dot)
+ self.assertIn('dashed', dot)
def test_composite_collapse(self):
p = beam.Pipeline()