云服务器内容精选

  • 响应示例 [ { "is_success": "true", "message": "作业提交请求下发成功" }, { "is_success": "true", "message": "作业提交请求下发成功" }, { "is_success": "true", "message": "作业提交请求下发成功" }, { "is_success": "true", "message": "作业提交请求下发成功" } ]
  • 请求消息 表2 请求参数说明 参数名称 是否必选 参数类型 说明 job_ids 是 Array of Long 批量作业ID。 作业ID可以通过创建作业接口或者查询作业接口获取。 resume_savepoint 否 Boolean 是否将作业从最近创建的保存点恢复。 当“resume_savepoint”为“true”时,表示作业从最近创建的保存点恢复。 当“resume_savepoint”为“false”时,表示不恢复正常启动。 默认为“false”。
  • 响应示例 { "message": "", "is_success": true, "error_code": "", "stream_graph": "{\n \"jid\" : \"44334c4259f6714bddef1ac525364052\",\n \"name\" : \"InternalJob_1715392878428\",\n \"nodes\" : [ {\n \"id\" : \"0a448493b4782967b150582570326227\",\n \"parallelism\" : 1,\n \"operator\" : \"\",\n \"operator_strategy\" : \"\",\n \"description\" : \"Sink: Sink(table=[default_catalog.default_database.sink_table], fields=[name, num])\",\n \"chain_operators_id\" : [ \"0a448493b4782967b150582570326227\" ],\n \"inputs\" : [ {\n \"num\" : 0,\n \"id\" : \"bc764cd8ddf7a0cff126f51c16239658\",\n \"ship_strategy\" : \"FORWARD\",\n \"exchange\" : \"pipelined_bounded\"\n } ],\n \"optimizer_properties\" : {}\n }, {\n \"id\" : \"bc764cd8ddf7a0cff126f51c16239658\",\n \"parallelism\" : 2,\n \"operator\" : \"\",\n \"operator_strategy\" : \"\",\n \"description\" : \"Source: TableSourceScan(table=[[default_catalog, default_database, orders]], fields=[name, num])\",\n \"chain_operators_id\" : [ \"bc764cd8ddf7a0cff126f51c16239658\" ],\n \"optimizer_properties\" : {}\n } ],\n \"operator_list\" : [ {\n \"id\" : \"0a448493b4782967b150582570326227\",\n \"name\" : \"Sink: Sink(table=[default_catalog.default_database.sink_table], fields=[name, num])\",\n \"type\" : \"Sink\",\n \"contents\" : \"Sink(table=[default_catalog.default_database.sink_table], fields=[name, num])\",\n \"parallelism\" : 1,\n \"tags\" : \"[SINK]\",\n \"input_operators_id\" : [ \"bc764cd8ddf7a0cff126f51c16239658\" ]\n }, {\n \"id\" : \"bc764cd8ddf7a0cff126f51c16239658\",\n \"name\" : \"Source: TableSourceScan(table=[[default_catalog, default_database, orders]], fields=[name, num])\",\n \"type\" : \"Source\",\n \"contents\" : \"TableSourceScan(table=[[default_catalog, default_database, orders]], fields=[name, num])\",\n \"parallelism\" : 2,\n \"tags\" : \"[PROCESS, UDF]\",\n \"input_operators_id\" : [ ]\n } ]\n}" } 为了便于查看返回体信息,我们将stream_graph格式化后如下所示: "jid": "65b6a7b0c1ad95b1722a92b49d2f6eba", "name": "InternalJob_1715392245413", "nodes": [ { "id": "0a448493b4782967b150582570326227", "parallelism": 1, "operator": "", "operator_strategy": "", "description": "Sink: Sink(table=[default_catalog.default_database.sink_table], fields=[name, num])", "chain_operators_id": [ "0a448493b4782967b150582570326227" ], "inputs": [ { "num": 0, "id": "bc764cd8ddf7a0cff126f51c16239658", "ship_strategy": "FORWARD", "exchange": "pipelined_bounded" } ], "optimizer_properties": { } }, { "id": "bc764cd8ddf7a0cff126f51c16239658", "parallelism": 2, "operator": "", "operator_strategy": "", "description": "Source: TableSourceScan(table=[[default_catalog, default_database, orders]], fields=[name, num])", "chain_operators_id": [ "bc764cd8ddf7a0cff126f51c16239658" ], "optimizer_properties": { } } ], "operator_list": [ { "id": "0a448493b4782967b150582570326227", "name": "Sink: Sink(table=[default_catalog.default_database.sink_table], fields=[name, num])", "type": "Sink", "contents": "Sink(table=[default_catalog.default_database.sink_table], fields=[name, num])", "parallelism": 1, "tags": "[SINK]", "input_operators_id": [ "bc764cd8ddf7a0cff126f51c16239658" ] }, { "id": "bc764cd8ddf7a0cff126f51c16239658", "name": "Source: TableSourceScan(table=[[default_catalog, default_database, orders]], fields=[name, num])", "type": "Source", "contents": "TableSourceScan(table=[[default_catalog, default_database, orders]], fields=[name, num])", "parallelism": 2, "tags": "[PROCESS, UDF]", "input_operators_id": [ ] } ] }
  • 请求消息 表2 请求参数说明 参数名称 是否必选 参数类型 说明 sql_body 是 String SQL。 cu_number 否 Integer 是在作业编辑页面配置的作业占用资源总CU数,需配置与实际占用资源一致,作业实际占用资源根据算子并行数按需申请。 cu_number = 管理单元 + (算子总并行数 / 单TM Slot数) * 单TM所占CU数 manager_cu_number 否 Integer 管理单元CU数。 parallel_number 否 Integer 最大并行度。 并行数为作业每个算子的并行数,适度增加并行数会提高作业整体算力,但也须考虑线程增多带来的切换开销,上限是计算单元CU数的4倍,最佳实践为计算单元CU数的1-2倍。 tm_cus 否 Integer 单个taskManagerCU数量。 tm_slot_num 否 Integer 单个taskManager Slot数量。 operator_config 否 String 算子的配置。 可先行调用该接口获取算子ID,即响应消息中stream_graph包含的operator_list中的id即为算子ID。 static_estimator 否 Boolean 是否静态资源预估。 配置为true时,即根据算子ID和流量预估作业消耗资源。 static_estimator_config 否 String 每个算子的流量/命中率配置,json格式的字符串。 当static_estimator为true时需要配置该参数,配置时传入算子ID和算子流量配置。 可先行调用该接口获取算子ID,即响应消息中stream_graph包含的operator_list中的id即为算子ID。 算子流量根据用户业务实际情况预估。 job_type 否 String 作业类型。 只支持flink_opensource_sql_job类型作业。 graph_type 否 String 流图类型。当前支持以下两种流图类型。 简化流图:simple_graph 静态流图:job_graph flink_version 否 String Flink版本。当前只支持1.10和1.12。
  • 请求示例 生成Flink SQL作业的静态流图,流图的类型为静态流图。 { "job_type": "flink_opensource_sql_job", "graph_type": "job_graph", "sql_body": "create table orders(\r\n name string,\r\n num int\r\n) with (\r\n 'connector' = 'datagen',\r\n 'rows-per-second' = '1', --每秒生成一条数据\r\n 'fields.name.kind' = 'random', --为字段user_id指定random生成器\r\n 'fields.name.length' = '5' --限制user_id长度为3\r\n);\r\n \r\nCREATE TABLE sink_table (\r\n name string,\r\n num int\r\n) WITH (\r\n 'connector' = 'print'\r\n);\r\nINSERT into sink_table SELECT * FROM orders;", "cu_number": 2, "manager_cu_number": 1, "parallel_number": 2, "tm_cus": 1, "tm_slot_num": 0, "operator_config": "", "static_estimator": true, "flink_version": "1.12", "static_estimator_config": "{\"operator_list\":[{\"id\":\"0a448493b4782967b150582570326227\",\"output_rate\":1000},{\"id\":\"bc764cd8ddf7a0cff126f51c16239658\",\"output_rate\":1000}]}" }
  • 响应示例 作业类型为:flink_jar_job,参考响应样例如下: { "is_success": "true", "message": "作业详情查询成功", "job_detail": { "job_id": 104, "user_id": "011c99a26ae84a1bb963a75e7637d3fd", "queue_name": "flinktest", "project_id": "330e068af1334c9782f4226acc00a2e2", "name": "jptest", "desc": "", "sql_body": "", "run_mode": "exclusive_cluster", "job_type": "flink_jar_job", "job_config": { "checkpoint_enabled": false, "checkpoint_interval": 10, "checkpoint_mode": "exactly_once", "log_enabled": false, "obs_bucket": null, "root_id": -1, "edge_group_ids": null, "graph_editor_enabled": false, "graph_editor_data": "", "manager_cu_number": 1, "executor_number": null, "executor_cu_number": null, "cu_number": 2, "parallel_number": 1, "smn_topic": null, "restart_when_exception": false, "idle_state_retention": 3600, "config_url": null, "udf_jar_url": null, "dirty_data_strategy": null, "entrypoint": "FemaleInfoCollection.jar", "dependency_jars": [ "FemaleInfoCollection.jar", "ObsBatchTest.jar" ], "dependency_files": [ "FemaleInfoCollection.jar", "ReadFromResource" ] }, "main_class": null, "entrypoint_args": null, "execution_graph": null, "status": "job_init", "status_desc": "", "create_time": 1578466221525, "update_time": 1578467395713, "start_time": null } } 作业类型为:flink_opensource_sql_job,参考响应样例如下: { "is_success": "true", "message": "The job information query succeeds.", "job_detail": { "job_type": "flink_opensource_sql_job", "status_desc": "", "create_time": 1637632872828, "sql_body": "xxx", "savepoint_path": null, "main_class": null, "queue_name": "xie_container_general", "execution_graph": "xxx", "start_time": 1638433497621, "update_time": 1638449337993, "job_config": { "checkpoint_enabled": true, "checkpoint_interval": 600, "checkpoint_mode": "exactly_once", "log_enabled": true, "obs_bucket": "dli-test", "root_id": -1, "edge_group_ids": null, "graph_editor_enabled": false, "graph_editor_data": "", "manager_cu_number": 1, "executor_number": null, "executor_cu_number": null, "cu_number": 2, "parallel_number": 3, "smn_topic": "", "restart_when_exception": true, "resume_checkpoint": true, "resume_max_num": -1, "checkpoint_path": null, "idle_state_retention": 3600, "config_url": null, "udf_jar_url": "test/flink_test-1.0-SNAPSHOT-jar-with-dependencies.jar", "dirty_data_strategy": "0", "entrypoint": "test/flink_test-1.0-SNAPSHOT-jar-with-dependencies.jar", "dependency_jars": null, "dependency_files": null, "tm_cus": 1, "tm_slot_num": 3, "image": null, "feature": null, "flink_version": null, "operator_config": "xxx", "static_estimator_config": "xxx", "runtime_config": null }, "user_id": "xxx", "project_id": "xxx", "run_mode": "exclusive_cluster", "job_id": 90634, "name": "test_guoquan", "desc": "", "entrypoint_args": null, "status": "job_cancel_success" } }
  • 响应消息 表2 响应参数说明 参数名称 是否必选 参数类型 说明 is_success 否 String 执行请求是否成功。“true”表示请求执行成功。 message 否 String 系统提示信息,执行成功时,信息可能为空。 job_detail 否 Object 作业详情。请参见表3。 表3 job_detail参数说明 参数名称 是否必选 参数类型 说明 job_id 否 Long 作业ID。 name 否 String 作业名称。长度限制:0-57个字符。 desc 否 String 作业描述。长度限制:0-512个字符。 job_type 否 String 作业类型。 flink_sql_job:flink sql作业 flink_opensource_sql_job:flink opensource sql作业 flink_sql_edge_job:flink sql边缘作业 flink_jar_job:flink自定义作业 status 否 String 作业状态。 作业的状态如下: job_init:草稿 job_submitting:提交中 job_submit_fail:提交失败 job_running:运行中(开始计费,提交作业后,返回正常结果) job_running_exception:运行异常(停止计费。作业发生运行时异常,停止运行作业) job_downloading:下载中 job_idle:空闲 job_canceling:停止中 job_cancel_success:已停止 job_cancel_fail:停止失败 job_savepointing:保存点创建中 job_arrearage_stopped:因欠费被停止(结束计费。用户账户欠费,作业停止) job_arrearage_recovering:欠费作业恢复中(用户账户欠费,账户充值,作业恢复中) job_finish:已完成 status_desc 否 String 作业状态描述。 create_time 否 Long 作业创建时间。 start_time 否 Long 作业启动时间。 user_id 否 String 作业所属用户标识。 queue_name 否 String 队列名称。长度限制:1-128个字符。 project_id 否 String 作业所属项目标识。 sql_body 否 String Stream SQL语句。 savepoint_path 否 String 手动产生的Checkpoint的保存路径。 run_mode 否 String 作业运行模式。 shared_cluster:共享 exclusive_cluster:独享 edge_node:边缘节点 job_config 否 Object 作业配置, 具体参数说明请参见表4。 main_class 否 String jar包主类。例如,org.apache.spark.examples.streaming.JavaQueueStream entrypoint_args 否 String jar包作业运行参数,多个参数之间空格分隔。 execution_graph 否 String 作业执行计划。 update_time 否 Long 作业更新时间。 user_name 否 String 用户名,当“show_detail”为“false”时独有。 duration 否 Long 作业运行时长。 单位ms,“show_detail”为“false”时独有。 root_id 否 Long 父作业ID。“show_detail”为“false”时独有。 graph_editor_enabled 否 Boolean 作业的流图是否可编辑。“true”表示作业的流图可以编辑,“false”表示作业的流图不可以编辑。 has_savepoint 否 Boolean 作业是否有保存点。“true”表示作业有保存点,“false”表示作业没有保存点。 edge_group_ids 否 Array of Strings 边缘计算组ID列表。多个ID以逗号分隔。 restart_times 否 Integer 重启次数。 表4 job_config参数说明 参数名称 是否必选 参数类型 说明 checkpoint_enabled 否 Boolean 是否开启作业自动快照功能。 true:开启 false:关闭 默认为“false”。 checkpoint_interval 否 Integer 快照时间间隔。 单位为秒,默认值为“10”。 checkpoint_mode 否 String 快照模式,。两种可选: exactly_once:数据只被消费一次。 at_least_once:数据至少被消费一次。 默认值为“exactly_once”。 log_enabled 否 Boolean 是否启用日志存储。默认为“false”。 obs_bucket 否 String OBS桶名。 root_id 否 Integer 父作业ID。 edge_group_ids 否 Array of Strings 边缘计算组ID列表。多个ID以逗号分隔。 manager_cu_number 否 Integer 管理单元CU数。默认为“1”。 graph_editor_enabled 否 Boolean 流图编辑开关。默认为“false”。 graph_editor_data 否 String 流图编辑数据。默认为null。 executor_number 否 Integer 作业使用计算节点个数。 executor_cu_number 否 Integer 计算节点cu数。 cu_number 否 Integer 用户为作业选择的CU数量。 “show_detail”为“true”时独有。 最小值:2 最大值:400 默认为“2”。 parallel_number 否 Integer 用户设置的作业并行数。 “show_detail”为“true”时独有。 最小值:1 最大值:2000 默认为“1”。 smn_topic 否 String SMN主题名。当作业异常时,向该SMN主题推送告警信息。 restart_when_exception 否 Boolean 是否开启异常重启功能。 resume_checkpoint 否 Boolean 异常自动重启时,是否从最新checkpoint恢复。默认值为“false”。 resume_max_num 否 Integer 异常重试最大次数。-1代表无限。 checkpoint_path 否 String 检查点保存路径。 idle_state_retention 否 Integer 空闲状态过期周期。 config_url 否 String 用户上传的config包OBS路径。 udf_jar_url 否 String 用户已上传到DLI资源管理系统的程序包名,用户sql作业的udf jar通过该参数传入。 dirty_data_strategy 否 String 作业脏数据策略。 “2:obsDir”:保存,obsDir表示脏数据存储路径。 “1”:抛出异常。 “0”:忽略。 entrypoint 否 String 用户已上传到DLI资源管理系统的程序包名,用户自定义作业主类所在的jar包。 dependency_jars 否 Array of Strings 用户已上传到DLI资源管理系统的程序包名,用户自定义作业的其他依赖包。 dependency_files 否 Array of Strings 用户已上传到DLI资源管理系统的资源包名,用户自定义作业的依赖文件。 tm_cus 否 int 单TM所占CU数。 tm_slot_num 否 int 单TM Slot数。 image 否 String 自定义镜像。格式为:组织名/镜像名:镜像版本。 当用户设置“feature”为“custom”时,该参数生效。用户可通过与“feature”参数配合使用,指定作业运行使用自定义的Flink镜像。关于如何使用自定义镜像,请参考《数据湖探索用户指南》。 feature 否 String 自定义作业特性。表示用户作业使用的Flink镜像类型。 basic:表示使用DLI提供的基础Flink镜像。 custom:表示使用用户自定义的Flink镜像。 flink_version 否 String Flink版本。当用户设置“feature”为“basic”时,该参数生效。用户可通过与“feature”参数配合使用,指定作业运行使用的DLI基础Flink镜像的版本。 operator_config 否 String 各算子并行度参数,以json的形式展示各算子id和并行度。 static_estimator_config 否 String 静态流图资源预估参数,以json的形式展示。 runtime_config 否 String Flink作业运行时自定义优化参数。 real_cu_number 否 Integer 实际使用的CU数。默认值为“0”,表示此时以“cu_number”的值为准。
  • 示例 请求样例 { "job_ids": [298765, 298766] } 响应样例 { "is_success": true, "message": "消息内容", "metrics": { "jobs": [ { "job_id": 0, "metrics": { "sources": [ { "name": "Source: KafKa_6070_KAFKA_SOURCE", "records": 0, "corrupted_records": 0 } ], "sinks": [ { "name": "Source: KafKa_6070_KAFKA_SOURCE", "records": 0, "corrupted_records": 0 } ], "total_read_rate": 100, "total_write_rate": 100 } } ] } }
  • 响应消息 表3 响应参数说明 参数名称 是否必选 参数类型 说明 is_success 否 Boolean 请求是否成功。 message 否 String 消息内容。 metrics 否 Object 作业列表信息。具体请参考表4。 表4 payload参数说明 参数名称 是否必选 参数类型 说明 jobs 否 Array of Objects 所有作业监控信息。具体请参考表5。 表5 jobs参数说明 参数名称 是否必选 参数类型 说明 job_id 否 Long 作业ID。 metrics 否 Object 作业的所有输入输出监控信息。具体请参考表6。 表6 metrics参数说明 参数名称 是否必选 参数类型 说明 sources 否 Array of Objects 所有输入流。请参见表7。 sinks 否 Array of Objects 所有输出流。请参见表7。 total_read_rate 否 Double 总输入速率。 total_write_rate 否 Double 总输出速率。 表7 source/sinks参数说明 参数名称 是否必选 参数类型 说明 name 否 String 输入流或输出流名称。 records 否 Long 总记录数。 corrupted_records 否 Long 脏数据记录数。