文档首页> 数据湖探索 DLI> API参考> Flink作业相关API> 生成Flink SQL作业的静态流图
更新时间:2024-03-15 GMT+08:00

生成Flink SQL作业的静态流图

功能介绍

该API用于生成Flink SQL作业的静态流图。

URI

  • URI格式

    POST /v3/{project_id}/streaming/jobs/{job_id}/gen-graph

  • 参数说明
    表1 URI参数说明

    参数名称

    是否必选

    参数类型

    说明

    project_id

    String

    项目编号,用于资源隔离。获取方式请参考获取项目ID

请求消息

表2 请求参数说明

参数名称

是否必选

参数类型

说明

sql_body

String

SQL。

cu_number

Integer

CU总数。

manager_cu_number

Integer

管理单元CU数。

parallel_number

Integer

最大并行度。

tm_cus

Integer

单个taskManagerCU数量。

tm_slot_num

Integer

单个taskManager Slot数量。

operator_config

String

算子的配置。

static_estimator

Boolean

是否静态资源预估。

job_type

String

作业类型。

只支持flink_opensource_sql_job类型作业。

graph_type

String

流图类型。当前支持以下两种流图类型。

  • 简化流图:simple_graph
  • 静态流图:job_graph

static_estimator_config

String

每个算子的流量/命中率配置,json格式的字符串。

flink_version

String

Flink版本。当前只支持1.10和1.12。

响应消息

表3 响应参数说明

参数名称

是否必选

参数类型

说明

is_success

Boolean

执行请求是否成功。“true”表示请求执行成功。

message

String

系统提示信息,执行成功时,信息可能为空。

error_code

String

错误码。

stream_graph

String

静态流图的描述信息。

请求示例

生成Flink SQL作业的静态流图,流图的类型为静态流图。

{
   "cu_number": 4,
   "manager_cu_number": 1,
   "parallel_number": 4,
   "tm_cus": 1,
   "tm_slot_num": 1,
   "sql_body": "",
   "operator_config": "",
   "static_estimator": true,
   "job_type": "flink_opensource_sql_job",
   "graph_type": "job_graph"
 }

响应示例

{
    "is_success": true,
    "message": "",
    "error_code": "",
    "stream_graph": "{\n  \"nodes\" : [ {\n    \"id\" : 1,\n    \"operator_id\" : \"bc764cd8ddf7a0cff126f51c16239658\",\n    \"type\" : \"Source\",\n    
 \"contents\" : \"kafkaSource\",\n    \"parallelism\" : 1\n  }, {\n    \"id\" : 2,\n    \"operator_id\" : \"0a448493b4782967b150582570326227\",\n    \"type\" : \"select\",\n    \"contents\" : \"car_id, car_owner, car_brand, car_speed\",\n    \"parallelism\" : 1,\n    \"predecessors\" : [ {\n      \"id\" : 1\n    } ]\n  }, {\n    \"id\" : 4,\n    \"operator_id\" : \"6d2677a0ecc3fd8df0b72ec675edf8f4\",\n    \"type\" : \"Sink\",\n    \"contents\" : \"kafkaSink\",\n    \"parallelism\" : 1,\n    \"predecessors\" : [ {\n      \"id\" : 2\n    } ]\n  } ]\n}"
}

状态码

状态码如表4所示。

表4 状态码

状态码

描述

200

操作成功。

400

输入参数无效。

错误码

调用接口出错后,将不会返回上述结果,而是返回错误码和错误信息,更多介绍请参见错误码