Flink 1.12.2 源码分析 : 官方 Flink Plan Visualizer 使用.

2021/4/18 1:25:22

本文主要是介绍Flink 1.12.2 源码分析 : 官方 Flink Plan Visualizer 使用.,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

一. 前言

官方提供了获取执行计划的WEB页面. 入口 : https://flink.apache.org/visualizer/

在这里插入图片描述

二. 使用

2.1. 获取执行计划json字符串.

获取执行计划的json字符串很简单. 就是在代码里面加一个输出就行了.

System.out.println(env.getExecutionPlan());

在这里插入图片描述

  • 获取的json字符串如下 :
{
  "nodes" : [ {
    "id" : 1,
    "type" : "Source: Socket Stream",
    "pact" : "Data Source",
    "contents" : "Source: Socket Stream",
    "parallelism" : 1
  }, {
    "id" : 2,
    "type" : "Flat Map",
    "pact" : "Operator",
    "contents" : "Flat Map",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1,
      "ship_strategy" : "REBALANCE",
      "side" : "second"
    } ]
  }, {
    "id" : 4,
    "type" : "Window(TumblingProcessingTimeWindows(5000), ProcessingTimeTrigger, ReduceFunction$1, PassThroughWindowFunction)",
    "pact" : "Operator",
    "contents" : "Window(TumblingProcessingTimeWindows(5000), ProcessingTimeTrigger, ReduceFunction$1, PassThroughWindowFunction)",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2,
      "ship_strategy" : "HASH",
      "side" : "second"
    } ]
  }, {
    "id" : 5,
    "type" : "Sink: Print to Std. Out",
    "pact" : "Data Sink",
    "contents" : "Sink: Print to Std. Out",
    "parallelism" : 1,
    "predecessors" : [ {
      "id" : 4,
      "ship_strategy" : "REBALANCE",
      "side" : "second"
    } ]
  } ]
}

2.2. 解析执行计划

  • 打开官方提供的解析执行计划的地址 : https://flink.apache.org/visualizer/

在这里插入图片描述

  • 这样就获取到了StreamGraph . 右上角的按钮对应的 放大,缩小,重置 . 根据需要进行操作…
    在这里插入图片描述


这篇关于Flink 1.12.2 源码分析 : 官方 Flink Plan Visualizer 使用.的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程