编程语言
首页 > 编程语言> > Flink 1.12.2 源码分析 : 官方 Flink Plan Visualizer 使用.

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

作者:互联网

一. 前言

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

在这里插入图片描述

二. 使用

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

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

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

在这里插入图片描述

{
  "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. 解析执行计划

在这里插入图片描述

标签:pact,1.12,Flink,源码,parallelism,type,id,contents,Sink
来源: https://blog.csdn.net/zhanglong_4444/article/details/115803812