Pipeline pipeline = ... build my pipeline ...
String dotString = PipelineDotRenderer.toDotString(pipeline);

Now that you have a string containing a DOT[1] graph. You can use any graph
layout application/library[2] to visualize it. For example with graphviz[3]
(after saving the dotString to /tmp/file.png):
dot -Tpng -o /tmp/file.png /tmp/file.dot
Open /tmp/file.png with any image viewer.

1: https://en.wikipedia.org/wiki/DOT_(graph_description_language)
2:
https://en.wikipedia.org/wiki/DOT_(graph_description_language)#Layout_programs
3: https://en.wikipedia.org/wiki/Graphviz

On Thu, Nov 21, 2019 at 1:33 AM Rustam Mehmandarov <[email protected]>
wrote:

> Hi, Luke!
>
> Thanks a lot! Do you have a short code example of how the renderers work
> in Beam?
>
> Rustam
>
> On Mon, Nov 11, 2019, 17:16 Luke Cwik <[email protected]> wrote:
>
>> Have you tried the PipelineDotRenderer[1]?
>>
>> It can create a dot graph of both a Java pipeline object and also the
>> proto pipeline representation. It isn't very sophisticated so feel free to
>> contribute to improve upon it.
>>
>> 1:
>> https://github.com/apache/beam/blob/95297dd82bd2fd3986900093cc1797c806c859e6/runners/core-construction-java/src/main/java/org/apache/beam/runners/core/construction/renderer/PipelineDotRenderer.java#L28
>>
>> On Sat, Nov 9, 2019 at 1:40 PM Rustam Mehmandarov <[email protected]>
>> wrote:
>>
>>> Hi all,
>>>
>>> I am looking for a way to get the pipeline graph for Beam Java API,
>>> something similar to the info that is used to visualise the pipeline when
>>> submitting the job to Dataflow. Any help is greatly appreciated.
>>>
>>> Thanks,
>>> Rustam
>>>
>>

Reply via email to