You need to enable JavaScript to run this app.
导航
StartApplicationInstance - 启动作业实例
最近更新时间:2024.11.06 00:31:11首次发布时间:2024.10.31 11:30:33

构造作业信息,创建并启动作业实例

注意事项

  1. 首次启动需要指定 UniqueKey(项目级别唯一) 启动作业实例
  2. 后续启动使用 AppId (AppId 在该接口返回值中)

请求参数

下表仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数

参数
类型
是否必填
示例值
描述
Action
String

StartApplicationInstance

要执行的操作,取值:StartApplicationInstance。

Version
String

2025-01-01

API的版本,取值:2025-01-01。

Id
String

"1827546773634"

作业 AppId

RestoreStrategy
Object

{"Type": "FROM_LATEST"}

作业恢复策略

App
Object

"App": {
"JobType": "FLINK_STREAMING_SQL",
"ProjectId": "test",
"AccountId": "2100211999",
"UserId": "c0c23d5825d0490487317ef35122eddd",
"JobName": "flink-test-job-name",
"DeployRequest": {
"Queue": "o-00g0ouqtg9n7",
"Priority": "5",
"ResourcePool": "flink-resource-pool",
"SchedulePolicy": "GANG",
"ScheduleTimeout": "60"
},
"EngineVersion": "FLINK_VERSION_1_16",
"Jar": "tos://mt-gts/gls/lib/tools.jar",
"MainClass": "com.bytedance.openplatform.flink.DatagenToPrint",
"Args": "--enable_checkpoint true --checkpointMode EXACTLY_ONCE",
"SqlText": "create table orders (\n f0 varchar\n) WITH (\n 'connector' = 'datagen'\n);\n\ninsert into hive.flink.t1\nselect * from orders;",
"Dependency": {
"Jars": [
"tos://b.jar"
]
},
"Conf": {
"pipelineoperator-chaining": "Ps4VP2AVVg",
"enable": "true"
}
}

作业配置

返回参数

下表仅列出本接口特有的返回参数。更多信息请参见返回结构

参数
类型
示例值
描述
Id
String

"184643783847"

作业 AppId

InstanceId
String

"1846352374846"

Job实例 ID

Success
Boolean

true

是否成功

请求示例

POST /?Action=StartApplicationInstance&Version=2025-01-01&ProjectId=%22ahbf3mzf1iih%22 HTTP/1.1
Host: open.volcengineapi.com
Content-Type: application/json; charset=UTF-8
X-Date: 20241028T082003Z
X-Content-Sha256: 287e874e******d653b44d21e
Authorization: HMAC-SHA256 Credential=Adfks******wekfwe/20241028/cn-beijing/flink/request, SignedHeaders=host;x-content-sha256;x-date, Signature=47a7d934ff7b37c03938******cd7b8278a40a1057690c401e92246a0e41085f

{
  "Id": "\"1827546773634\"",
  "RestoreStrategy": {
    "Type": "1. FROM_NEW,全新启动(默认值)\n2. FROM_LATEST 从最新的状态启动\n3. FROM_SAVEPOINT 从指定的savepoint启动",
    "SavepointId": "2ca2ec61-0daf-45e3-a21d-0756d99f5287"
  },
  "App": {
    "ProjectId": "ahbf3mzf1iih",
    "UserId": "c0c23d5825d0490487317ef35122eccd",
    "JobName": "flink-test-job",
    "AccountId": "2100052999",
    "Jar": "tos://mt-gts/gls/lib/tools.jar",
    "MainClass": "com.bytedance.openplatform.flink.DatagenToPrint",
    "Args": "\"--enable_checkpoint true --checkpointMode EXACTLY_ONCE\"",
    "Dependency": {
      "Jars": [
        "[\"tos://a.jar\", \"tos://b.jar\"]"
      ],
      "PyLibraries": [
        "lBHGlXWp"
      ]
    },
    "DeployRequest": {
      "Priority": 5,
      "ResourcePool": "test-resource-pool",
      "SchedulePolicy": "GANG",
      "ScheduleTimeout": "60",
      "Namespace": "o-0080sv6hfmn6",
      "Queue": "\"o-00g0ouqtg9n7\""
    },
    "Conf": {},
    "JobType": "流式作业: \n1. FLINK_STREAMING_JAR\n2. FLINK_STREAMING_SQL \n批式作业:\n1. FLINK_BATCH_SQL \n2. FLINK_BATCH_JAR",
    "EngineVersion": "FLINK_VERSION_1_11\nFLINK_VERSION_1_16",
    "SqlText": "\"create table orders (\\n f0 varchar\\n) WITH (\\n 'connector' = 'datagen'\\n);\\n\\ninsert into hive.flink.t1\\nselect * from orders;\""
  }
}

返回示例

{
  "ResponseMetadata": {
    "RequestId": "202410281620470310740611530B808C",
    "Action": "StartApplicationInstance",
    "Version": "2025-01-01",
    "Service": "flink",
    "Region": "cn-beijing"
  },
  "Result": {
    "Id": "\"184643783847\"",
    "InstanceId": "\"1846352374846\"",
    "Success": true
  }
}

错误码

下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。

状态码
错误码
错误信息
说明
200
default system error
app id is empty or invalid, at the same time, not found app Resource

当前展示的错误信息指示当前传入的 app id 为空或者不存在, 同时通过传入的 app uniqueKey 也无法找到作业的相关信息. 实际使用中,请根据具体的错误信息进行判断,此处仅展示其中一个示例