监控REST API

译者:flink.sojb.cn

Flink有一个监控API,可用于查询正在运行的作业的状态和统计信息,以及最近完成的作业。此监视API由Flink自己的仪表板使用,但也可用于自定义监视工具。

监控API是一个REST-ful API,它接受HTTP请求并使用JSON数据进行响应。

概览

监视API由作为Dispatcher一部分运行的Web服务器提供支持。默认情况下,此服务器在post处侦听8081,可以在flink-conf.yamlvia中配置rest.port。请注意,监视API Web服务器和Web仪表板Web服务器当前是相同的,因此在同一端口上一起运行。但是,它们会响应不同的HTTP URL。

对于多个Dispatchers(用于高可用性),每个Dispatcher将运行其自己的监视API实例,该实例提供有关已完成和正在运行的作业的信息,同时Dispatcher被选为集群Leader。

开发

REST API后台位于flink-runtime项目中。核心类是org.apache.flink.runtime.webmonitor.WebMonitorEndpoint设置服务器和请求路由。

我们使用NettyNetty Router库来处理REST请求和转换URL。之所以做出这样的选择是因为这种组合具有轻量级依赖性,并且Netty HTTP的性能非常好。

要添加新请求,Required

  • 添加一个新MessageHeaders类,作为新请求的接口,
  • 添加一个新AbstractRestHandler类,根据添加的类处理请求MessageHeaders
  • 添加处理程序org.apache.flink.runtime.webmonitor.WebMonitorEndpoint#initializeHandlers()

一个很好的例子就是org.apache.flink.runtime.rest.handler.job.JobExceptionsHandler使用了org.apache.flink.runtime.rest.messages.JobExceptionsHeaders

API

REST API是版本化的,通过在url前加上版本前缀,可以查询特定版本。前缀始终是形式v[version_number]。例如,要访问/foo/bar一个版本1 将查询/v1/foo/bar

如果未指定版本,Flink将默认为支持请求的最旧版本。

查询不受支持/不存在的版本将返回404错误。

注意如果群集在传统模式下运行,则REST API版本控制无效。对于这种情况,请参阅下面的遗留API。

调度员

/cluster

动作: DELETE

响应代码: 200 OK

关闭群集

请求:

  1. {}

响应:

  1. {}

/config

动作: GET

响应代码: 200 OK

返回WebUI的配置。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:DashboardConfiguration",
  4. "properties" : {
  5. "refresh-interval" : {
  6. "type" : "integer"
  7. },
  8. "timezone-name" : {
  9. "type" : "string"
  10. },
  11. "timezone-offset" : {
  12. "type" : "integer"
  13. },
  14. "flink-version" : {
  15. "type" : "string"
  16. },
  17. "flink-revision" : {
  18. "type" : "string"
  19. }
  20. }
  21. }

/jars

动作: GET

响应代码: 200 OK

返回先前通过’/ jars / upload’上传的所有jar的列表。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:webmonitor:handlers:JarListInfo",
  4. "properties" : {
  5. "address" : {
  6. "type" : "string"
  7. },
  8. "files" : {
  9. "type" : "array",
  10. "items" : {
  11. "type" : "object",
  12. "id" : "urn:jsonschema:org:apache:flink:runtime:webmonitor:handlers:JarListInfo:JarFileInfo",
  13. "properties" : {
  14. "id" : {
  15. "type" : "string"
  16. },
  17. "name" : {
  18. "type" : "string"
  19. },
  20. "uploaded" : {
  21. "type" : "integer"
  22. },
  23. "entry" : {
  24. "type" : "array",
  25. "items" : {
  26. "type" : "object",
  27. "id" : "urn:jsonschema:org:apache:flink:runtime:webmonitor:handlers:JarListInfo:JarEntryInfo",
  28. "properties" : {
  29. "name" : {
  30. "type" : "string"
  31. },
  32. "description" : {
  33. "type" : "string"
  34. }
  35. }
  36. }
  37. }
  38. }
  39. }
  40. }
  41. }
  42. }

/jars/upload

动作: POST

响应代码: 200 OK

将jar上传到集群。jar必须作为多部分数据发送。确保“Content-Type”标头设置为“application / x-java-archive”,因为某些http库默认情况下不添加标头。使用’curl’你可以通过’curl -X POST -H“上传jar。期望:” - F“jarfile =#path / to / flink-job.jar”http:// hostname:port / jars / upload’。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:webmonitor:handlers:JarUploadResponseBody",
  4. "properties" : {
  5. "filename" : {
  6. "type" : "string"
  7. },
  8. "status" : {
  9. "type" : "string",
  10. "enum" : [ "success" ]
  11. }
  12. }
  13. }

/jars/:jarid

动作: DELETE

响应代码: 200 OK

删除之前通过’/ jars / upload’上传的jar。

路径参数:

  • jarid - 标识jar的字符串值。上传jar时会返回一个路径,其中文件名是ID。此值等同于上载的jar(/ jars)列表中的id字段。

请求:

  1. {}

响应:

  1. {}

/jars/:jarid /plan

动作: GET

响应代码: 200 OK

返回先前通过’/ jars / upload’上传的jar中包含的作业的数据流计划。

路径参数:

  • jarid - 标识jar的字符串值。上传jar时会返回一个路径,其中文件名是ID。此值等同于上载的jar(/ jars)列表中的id字段。

查询参数:

  • entry-class(可选):字符串值,指定入口点类的完全限定名称。覆盖jar文件清单中定义的类。
  • parallelism (可选):正整数值,指定作业所需的并行度。
  • program-args (可选):字符串值,指定程序或计划的参数。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:JobPlanInfo",
  4. "properties" : {
  5. "plan" : {
  6. "type" : "any"
  7. }
  8. }
  9. }

/jars/:jarid /run

动作: POST

响应代码: 200 OK

通过运行先前通过’/ jars / upload’上传的jar来提交作业。

路径参数:

  • jarid - 标识jar的字符串值。上传jar时会返回一个路径,其中文件名是ID。此值等同于上载的jar(/ jars)列表中的id字段。

查询参数:

  • program-args (可选):字符串值,指定程序或计划的参数。
  • entry-class(可选):字符串值,指定入口点类的完全限定名称。覆盖jar文件清单中定义的类。
  • parallelism (可选):正整数值,指定作业所需的并行度。
  • allowNonRestoredState (可选):布尔值,指定如果保存点包含无法映射回作业的状态,是否应拒绝作业提交。
  • savepointPath (可选):字符串值,指定要从中还原作业的保存点的路径。

请求:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:webmonitor:handlers:JarRunRequestBody",
  4. "properties" : {
  5. "entryClass" : {
  6. "type" : "string"
  7. },
  8. "programArgs" : {
  9. "type" : "string"
  10. },
  11. "parallelism" : {
  12. "type" : "integer"
  13. },
  14. "allowNonRestoredState" : {
  15. "type" : "boolean"
  16. },
  17. "savepointPath" : {
  18. "type" : "string"
  19. }
  20. }
  21. }

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:webmonitor:handlers:JarRunResponseBody",
  4. "properties" : {
  5. "jobid" : {
  6. "type" : "any"
  7. }
  8. }
  9. }

/jobmanager/config

动作: GET

响应代码: 200 OK

返回群集配置。

请求:

  1. {}

响应:

  1. {
  2. "type" : "array",
  3. "items" : {
  4. "type" : "object",
  5. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:ClusterConfigurationInfoEntry",
  6. "properties" : {
  7. "key" : {
  8. "type" : "string"
  9. },
  10. "value" : {
  11. "type" : "string"
  12. }
  13. }
  14. }
  15. }

/jobmanager/metrics

动作: GET

响应代码: 200 OK

提供对JobManager指标的访问。

查询参数

  • get (可选):以逗号分隔的字符串值列表,用于选择特定指标。

请求:

  1. {}

响应:

  1. {
  2. "type" : "any"
  3. }

/jobs

动作: GET

响应代码: 200 OK

返回所有作业及其当前状态的概述。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:messages:webmonitor:JobIdsWithStatusOverview",
  4. "properties" : {
  5. "jobs" : {
  6. "type" : "array",
  7. "items" : {
  8. "type" : "object",
  9. "id" : "urn:jsonschema:org:apache:flink:runtime:messages:webmonitor:JobIdsWithStatusOverview:JobIdWithStatus",
  10. "properties" : {
  11. "id" : {
  12. "type" : "any"
  13. },
  14. "status" : {
  15. "type" : "string",
  16. "enum" : [ "CREATED", "RUNNING", "FAILING", "FAILED", "CANCELLING", "CANCELED", "FINISHED", "RESTARTING", "SUSPENDING", "SUSPENDED", "RECONCILING" ]
  17. }
  18. }
  19. }
  20. }
  21. }
  22. }

/jobs

动作: POST

响应代码: 202 Accepted

提交工作。此调用主要供Flink客户端使用。此调用需要一个multipart / form-data请求,其中包含序列化JobGraph,jar和分布式缓存工件的文件上载以及JSON有效负载的名为“request”的属性。

请求:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:JobSubmitRequestBody",
  4. "properties" : {
  5. "jobGraphFileName" : {
  6. "type" : "string"
  7. },
  8. "jobJarFileNames" : {
  9. "type" : "array",
  10. "items" : {
  11. "type" : "string"
  12. }
  13. },
  14. "jobArtifactFileNames" : {
  15. "type" : "array",
  16. "items" : {
  17. "type" : "object",
  18. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:JobSubmitRequestBody:DistributedCacheFile",
  19. "properties" : {
  20. "entryName" : {
  21. "type" : "string"
  22. },
  23. "fileName" : {
  24. "type" : "string"
  25. }
  26. }
  27. }
  28. }
  29. }
  30. }

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:JobSubmitResponseBody",
  4. "properties" : {
  5. "jobUrl" : {
  6. "type" : "string"
  7. }
  8. }
  9. }

/jobs/metrics

动作: GET

响应代码: 200 OK

提供对聚合作业指标的访问。

查询参数

  • get (可选):以逗号分隔的字符串值列表,用于选择特定指标。
  • agg(可选):应该计算的以逗号分隔的聚合模式列表。可用的聚合是:“min,max,sum,avg”。
  • jobs (可选):以逗号分隔的32个字符的十六进制字符串列表,用于选择特定的作业。

请求:

  1. {}

响应:

  1. {
  2. "type" : "any"
  3. }

/jobs/overview

动作: GET

响应代码: 200 OK

返回所有作业的概述。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:messages:webmonitor:MultipleJobsDetails",
  4. "properties" : {
  5. "jobs" : {
  6. "type" : "array",
  7. "items" : {
  8. "type" : "any"
  9. }
  10. }
  11. }
  12. }

/jobs/:jobid

动作: GET

响应代码: 200 OK

返回作业的详细信息。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:JobDetailsInfo",
  4. "properties" : {
  5. "jid" : {
  6. "type" : "any"
  7. },
  8. "name" : {
  9. "type" : "string"
  10. },
  11. "isStoppable" : {
  12. "type" : "boolean"
  13. },
  14. "state" : {
  15. "type" : "string",
  16. "enum" : [ "CREATED", "RUNNING", "FAILING", "FAILED", "CANCELLING", "CANCELED", "FINISHED", "RESTARTING", "SUSPENDING", "SUSPENDED", "RECONCILING" ]
  17. },
  18. "start-time" : {
  19. "type" : "integer"
  20. },
  21. "end-time" : {
  22. "type" : "integer"
  23. },
  24. "duration" : {
  25. "type" : "integer"
  26. },
  27. "now" : {
  28. "type" : "integer"
  29. },
  30. "timestamps" : {
  31. "type" : "object",
  32. "additionalProperties" : {
  33. "type" : "integer"
  34. }
  35. },
  36. "vertices" : {
  37. "type" : "array",
  38. "items" : {
  39. "type" : "object",
  40. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:JobDetailsInfo:JobVertexDetailsInfo",
  41. "properties" : {
  42. "id" : {
  43. "type" : "any"
  44. },
  45. "name" : {
  46. "type" : "string"
  47. },
  48. "parallelism" : {
  49. "type" : "integer"
  50. },
  51. "status" : {
  52. "type" : "string",
  53. "enum" : [ "CREATED", "SCHEDULED", "DEPLOYING", "RUNNING", "FINISHED", "CANCELING", "CANCELED", "FAILED", "RECONCILING" ]
  54. },
  55. "start-time" : {
  56. "type" : "integer"
  57. },
  58. "end-time" : {
  59. "type" : "integer"
  60. },
  61. "duration" : {
  62. "type" : "integer"
  63. },
  64. "tasks" : {
  65. "type" : "object",
  66. "additionalProperties" : {
  67. "type" : "integer"
  68. }
  69. },
  70. "metrics" : {
  71. "type" : "object",
  72. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:metrics:IOMetricsInfo",
  73. "properties" : {
  74. "read-bytes" : {
  75. "type" : "integer"
  76. },
  77. "read-bytes-complete" : {
  78. "type" : "boolean"
  79. },
  80. "write-bytes" : {
  81. "type" : "integer"
  82. },
  83. "write-bytes-complete" : {
  84. "type" : "boolean"
  85. },
  86. "read-records" : {
  87. "type" : "integer"
  88. },
  89. "read-records-complete" : {
  90. "type" : "boolean"
  91. },
  92. "write-records" : {
  93. "type" : "integer"
  94. },
  95. "write-records-complete" : {
  96. "type" : "boolean"
  97. }
  98. }
  99. }
  100. }
  101. }
  102. },
  103. "status-counts" : {
  104. "type" : "object",
  105. "additionalProperties" : {
  106. "type" : "integer"
  107. }
  108. },
  109. "plan" : {
  110. "type" : "string"
  111. }
  112. }
  113. }

/jobs/:jobid

动作: PATCH

响应代码: 202 Accepted

终止工作。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。

查询参数:

  • mode(可选):指定终止模式的字符串值。支持的值包括:“取消,停止”。

请求:

  1. {}

响应:

  1. {}

/jobs/:jobid /accumulators

动作: GET

响应代码: 200 OK

返回作业的所有任务的累加器,汇总在各个子任务中。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。

查询参数:

  • includeSerializedValue (可选):布尔值,指定序列化用户任务累加器是否应包含在响应中。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:JobAccumulatorsInfo",
  4. "properties" : {
  5. "job-accumulators" : {
  6. "type" : "array",
  7. "items" : {
  8. "type" : "any"
  9. }
  10. },
  11. "user-task-accumulators" : {
  12. "type" : "array",
  13. "items" : {
  14. "type" : "object",
  15. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:JobAccumulatorsInfo:UserTaskAccumulator",
  16. "properties" : {
  17. "name" : {
  18. "type" : "string"
  19. },
  20. "type" : {
  21. "type" : "string"
  22. },
  23. "value" : {
  24. "type" : "string"
  25. }
  26. }
  27. }
  28. },
  29. "serialized-user-task-accumulators" : {
  30. "type" : "object",
  31. "additionalProperties" : {
  32. "type" : "any"
  33. }
  34. }
  35. }
  36. }

/jobs/:jobid /checkpoints

动作: GET

响应代码: 200 OK

返回作业的检查点统计信息。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:CheckpointingStatistics",
  4. "properties" : {
  5. "counts" : {
  6. "type" : "object",
  7. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:CheckpointingStatistics:Counts",
  8. "properties" : {
  9. "restored" : {
  10. "type" : "integer"
  11. },
  12. "total" : {
  13. "type" : "integer"
  14. },
  15. "in_progress" : {
  16. "type" : "integer"
  17. },
  18. "completed" : {
  19. "type" : "integer"
  20. },
  21. "failed" : {
  22. "type" : "integer"
  23. }
  24. }
  25. },
  26. "summary" : {
  27. "type" : "object",
  28. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:CheckpointingStatistics:Summary",
  29. "properties" : {
  30. "state_size" : {
  31. "type" : "object",
  32. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:MinMaxAvgStatistics",
  33. "properties" : {
  34. "min" : {
  35. "type" : "integer"
  36. },
  37. "max" : {
  38. "type" : "integer"
  39. },
  40. "avg" : {
  41. "type" : "integer"
  42. }
  43. }
  44. },
  45. "end_to_end_duration" : {
  46. "type" : "object",
  47. "$ref" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:MinMaxAvgStatistics"
  48. },
  49. "alignment_buffered" : {
  50. "type" : "object",
  51. "$ref" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:MinMaxAvgStatistics"
  52. }
  53. }
  54. },
  55. "latest" : {
  56. "type" : "object",
  57. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:CheckpointingStatistics:LatestCheckpoints",
  58. "properties" : {
  59. "completed" : {
  60. "type" : "object",
  61. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:CheckpointStatistics:CompletedCheckpointStatistics",
  62. "properties" : {
  63. "id" : {
  64. "type" : "integer"
  65. },
  66. "status" : {
  67. "type" : "string",
  68. "enum" : [ "IN_PROGRESS", "COMPLETED", "FAILED" ]
  69. },
  70. "is_savepoint" : {
  71. "type" : "boolean"
  72. },
  73. "trigger_timestamp" : {
  74. "type" : "integer"
  75. },
  76. "latest_ack_timestamp" : {
  77. "type" : "integer"
  78. },
  79. "state_size" : {
  80. "type" : "integer"
  81. },
  82. "end_to_end_duration" : {
  83. "type" : "integer"
  84. },
  85. "alignment_buffered" : {
  86. "type" : "integer"
  87. },
  88. "num_subtasks" : {
  89. "type" : "integer"
  90. },
  91. "num_acknowledged_subtasks" : {
  92. "type" : "integer"
  93. },
  94. "tasks" : {
  95. "type" : "object",
  96. "additionalProperties" : {
  97. "type" : "object",
  98. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:TaskCheckpointStatistics",
  99. "properties" : {
  100. "id" : {
  101. "type" : "integer"
  102. },
  103. "status" : {
  104. "type" : "string",
  105. "enum" : [ "IN_PROGRESS", "COMPLETED", "FAILED" ]
  106. },
  107. "latest_ack_timestamp" : {
  108. "type" : "integer"
  109. },
  110. "state_size" : {
  111. "type" : "integer"
  112. },
  113. "end_to_end_duration" : {
  114. "type" : "integer"
  115. },
  116. "alignment_buffered" : {
  117. "type" : "integer"
  118. },
  119. "num_subtasks" : {
  120. "type" : "integer"
  121. },
  122. "num_acknowledged_subtasks" : {
  123. "type" : "integer"
  124. }
  125. }
  126. }
  127. },
  128. "external_path" : {
  129. "type" : "string"
  130. },
  131. "discarded" : {
  132. "type" : "boolean"
  133. }
  134. }
  135. },
  136. "savepoint" : {
  137. "type" : "object",
  138. "$ref" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:CheckpointStatistics:CompletedCheckpointStatistics"
  139. },
  140. "failed" : {
  141. "type" : "object",
  142. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:CheckpointStatistics:FailedCheckpointStatistics",
  143. "properties" : {
  144. "id" : {
  145. "type" : "integer"
  146. },
  147. "status" : {
  148. "type" : "string",
  149. "enum" : [ "IN_PROGRESS", "COMPLETED", "FAILED" ]
  150. },
  151. "is_savepoint" : {
  152. "type" : "boolean"
  153. },
  154. "trigger_timestamp" : {
  155. "type" : "integer"
  156. },
  157. "latest_ack_timestamp" : {
  158. "type" : "integer"
  159. },
  160. "state_size" : {
  161. "type" : "integer"
  162. },
  163. "end_to_end_duration" : {
  164. "type" : "integer"
  165. },
  166. "alignment_buffered" : {
  167. "type" : "integer"
  168. },
  169. "num_subtasks" : {
  170. "type" : "integer"
  171. },
  172. "num_acknowledged_subtasks" : {
  173. "type" : "integer"
  174. },
  175. "tasks" : {
  176. "type" : "object",
  177. "additionalProperties" : {
  178. "type" : "object",
  179. "$ref" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:TaskCheckpointStatistics"
  180. }
  181. },
  182. "failure_timestamp" : {
  183. "type" : "integer"
  184. },
  185. "failure_message" : {
  186. "type" : "string"
  187. }
  188. }
  189. },
  190. "restored" : {
  191. "type" : "object",
  192. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:CheckpointingStatistics:RestoredCheckpointStatistics",
  193. "properties" : {
  194. "id" : {
  195. "type" : "integer"
  196. },
  197. "restore_timestamp" : {
  198. "type" : "integer"
  199. },
  200. "is_savepoint" : {
  201. "type" : "boolean"
  202. },
  203. "external_path" : {
  204. "type" : "string"
  205. }
  206. }
  207. }
  208. }
  209. },
  210. "history" : {
  211. "type" : "array",
  212. "items" : {
  213. "type" : "object",
  214. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:CheckpointStatistics",
  215. "properties" : {
  216. "id" : {
  217. "type" : "integer"
  218. },
  219. "status" : {
  220. "type" : "string",
  221. "enum" : [ "IN_PROGRESS", "COMPLETED", "FAILED" ]
  222. },
  223. "is_savepoint" : {
  224. "type" : "boolean"
  225. },
  226. "trigger_timestamp" : {
  227. "type" : "integer"
  228. },
  229. "latest_ack_timestamp" : {
  230. "type" : "integer"
  231. },
  232. "state_size" : {
  233. "type" : "integer"
  234. },
  235. "end_to_end_duration" : {
  236. "type" : "integer"
  237. },
  238. "alignment_buffered" : {
  239. "type" : "integer"
  240. },
  241. "num_subtasks" : {
  242. "type" : "integer"
  243. },
  244. "num_acknowledged_subtasks" : {
  245. "type" : "integer"
  246. },
  247. "tasks" : {
  248. "type" : "object",
  249. "additionalProperties" : {
  250. "type" : "object",
  251. "$ref" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:TaskCheckpointStatistics"
  252. }
  253. }
  254. }
  255. }
  256. }
  257. }
  258. }

/jobs/:jobid /checkpoints/config

动作: GET

响应代码: 200 OK

返回检查点配置。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:CheckpointConfigInfo",
  4. "properties" : {
  5. "mode" : {
  6. "type" : "any"
  7. },
  8. "interval" : {
  9. "type" : "integer"
  10. },
  11. "timeout" : {
  12. "type" : "integer"
  13. },
  14. "min_pause" : {
  15. "type" : "integer"
  16. },
  17. "max_concurrent" : {
  18. "type" : "integer"
  19. },
  20. "externalization" : {
  21. "type" : "object",
  22. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:CheckpointConfigInfo:ExternalizedCheckpointInfo",
  23. "properties" : {
  24. "enabled" : {
  25. "type" : "boolean"
  26. },
  27. "delete_on_cancellation" : {
  28. "type" : "boolean"
  29. }
  30. }
  31. }
  32. }
  33. }

/jobs/:jobid /checkpoints/details/:checkpointid

动作: GET

响应代码: 200 OK

返回检查点的详细信息。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。
  • checkpointid - 标识检查点的长值。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:CheckpointStatistics",
  4. "properties" : {
  5. "id" : {
  6. "type" : "integer"
  7. },
  8. "status" : {
  9. "type" : "string",
  10. "enum" : [ "IN_PROGRESS", "COMPLETED", "FAILED" ]
  11. },
  12. "is_savepoint" : {
  13. "type" : "boolean"
  14. },
  15. "trigger_timestamp" : {
  16. "type" : "integer"
  17. },
  18. "latest_ack_timestamp" : {
  19. "type" : "integer"
  20. },
  21. "state_size" : {
  22. "type" : "integer"
  23. },
  24. "end_to_end_duration" : {
  25. "type" : "integer"
  26. },
  27. "alignment_buffered" : {
  28. "type" : "integer"
  29. },
  30. "num_subtasks" : {
  31. "type" : "integer"
  32. },
  33. "num_acknowledged_subtasks" : {
  34. "type" : "integer"
  35. },
  36. "tasks" : {
  37. "type" : "object",
  38. "additionalProperties" : {
  39. "type" : "object",
  40. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:TaskCheckpointStatistics",
  41. "properties" : {
  42. "id" : {
  43. "type" : "integer"
  44. },
  45. "status" : {
  46. "type" : "string",
  47. "enum" : [ "IN_PROGRESS", "COMPLETED", "FAILED" ]
  48. },
  49. "latest_ack_timestamp" : {
  50. "type" : "integer"
  51. },
  52. "state_size" : {
  53. "type" : "integer"
  54. },
  55. "end_to_end_duration" : {
  56. "type" : "integer"
  57. },
  58. "alignment_buffered" : {
  59. "type" : "integer"
  60. },
  61. "num_subtasks" : {
  62. "type" : "integer"
  63. },
  64. "num_acknowledged_subtasks" : {
  65. "type" : "integer"
  66. }
  67. }
  68. }
  69. }
  70. }
  71. }

/jobs/:jobid /checkpoints/details/:checkpointid /subtasks/:vertexid

动作: GET

响应代码: 200 OK

返回任务及其子任务的检查点统计信息。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。
  • checkpointid - 标识检查点的长值。
  • vertexid - 标识作业顶点的32个字符的十六进制字符串值。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:TaskCheckpointStatisticsWithSubtaskDetails",
  4. "properties" : {
  5. "id" : {
  6. "type" : "integer"
  7. },
  8. "status" : {
  9. "type" : "string",
  10. "enum" : [ "IN_PROGRESS", "COMPLETED", "FAILED" ]
  11. },
  12. "latest_ack_timestamp" : {
  13. "type" : "integer"
  14. },
  15. "state_size" : {
  16. "type" : "integer"
  17. },
  18. "end_to_end_duration" : {
  19. "type" : "integer"
  20. },
  21. "alignment_buffered" : {
  22. "type" : "integer"
  23. },
  24. "num_subtasks" : {
  25. "type" : "integer"
  26. },
  27. "num_acknowledged_subtasks" : {
  28. "type" : "integer"
  29. },
  30. "summary" : {
  31. "type" : "object",
  32. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:TaskCheckpointStatisticsWithSubtaskDetails:Summary",
  33. "properties" : {
  34. "state_size" : {
  35. "type" : "object",
  36. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:MinMaxAvgStatistics",
  37. "properties" : {
  38. "min" : {
  39. "type" : "integer"
  40. },
  41. "max" : {
  42. "type" : "integer"
  43. },
  44. "avg" : {
  45. "type" : "integer"
  46. }
  47. }
  48. },
  49. "end_to_end_duration" : {
  50. "type" : "object",
  51. "$ref" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:MinMaxAvgStatistics"
  52. },
  53. "checkpoint_duration" : {
  54. "type" : "object",
  55. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:TaskCheckpointStatisticsWithSubtaskDetails:CheckpointDuration",
  56. "properties" : {
  57. "sync" : {
  58. "type" : "object",
  59. "$ref" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:MinMaxAvgStatistics"
  60. },
  61. "async" : {
  62. "type" : "object",
  63. "$ref" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:MinMaxAvgStatistics"
  64. }
  65. }
  66. },
  67. "alignment" : {
  68. "type" : "object",
  69. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:TaskCheckpointStatisticsWithSubtaskDetails:CheckpointAlignment",
  70. "properties" : {
  71. "buffered" : {
  72. "type" : "object",
  73. "$ref" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:MinMaxAvgStatistics"
  74. },
  75. "duration" : {
  76. "type" : "object",
  77. "$ref" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:MinMaxAvgStatistics"
  78. }
  79. }
  80. }
  81. }
  82. },
  83. "subtasks" : {
  84. "type" : "array",
  85. "items" : {
  86. "type" : "object",
  87. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:checkpoints:SubtaskCheckpointStatistics",
  88. "properties" : {
  89. "index" : {
  90. "type" : "integer"
  91. },
  92. "status" : {
  93. "type" : "string"
  94. }
  95. }
  96. }
  97. }
  98. }
  99. }

/jobs/:jobid /config

动作: GET

响应代码: 200 OK

返回作业的配置。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。

请求:

  1. {}

响应:

  1. {
  2. "type" : "any"
  3. }

/jobs/:jobid /exceptions

动作: GET

响应代码: 200 OK

返回作业已观察到的不可恢复的异常。截断标志定义是否发生了更多异常,但未列出,因为否则响应会变得太大。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:JobExceptionsInfo",
  4. "properties" : {
  5. "root-exception" : {
  6. "type" : "string"
  7. },
  8. "timestamp" : {
  9. "type" : "integer"
  10. },
  11. "all-exceptions" : {
  12. "type" : "array",
  13. "items" : {
  14. "type" : "object",
  15. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:JobExceptionsInfo:ExecutionExceptionInfo",
  16. "properties" : {
  17. "exception" : {
  18. "type" : "string"
  19. },
  20. "task" : {
  21. "type" : "string"
  22. },
  23. "location" : {
  24. "type" : "string"
  25. },
  26. "timestamp" : {
  27. "type" : "integer"
  28. }
  29. }
  30. }
  31. },
  32. "truncated" : {
  33. "type" : "boolean"
  34. }
  35. }
  36. }

/jobs/:jobid /execution-result

动作: GET

响应代码: 200 OK

返回作业执行的结果。允许访问作业的执行时间以及此作业创建的所有累加器。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:JobExecutionResultResponseBody",
  4. "properties" : {
  5. "status" : {
  6. "type" : "object",
  7. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:queue:QueueStatus",
  8. "required" : true,
  9. "properties" : {
  10. "id" : {
  11. "type" : "string",
  12. "required" : true,
  13. "enum" : [ "IN_PROGRESS", "COMPLETED" ]
  14. }
  15. }
  16. },
  17. "job-execution-result" : {
  18. "type" : "any"
  19. }
  20. }
  21. }

/jobs/:jobid /metrics

动作: GET

响应代码: 200 OK

提供对作业指标的访问。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。

查询参数:

  • get (可选):以逗号分隔的字符串值列表,用于选择特定指标。

请求:

  1. {}

响应:

  1. {
  2. "type" : "any"
  3. }

/jobs/:jobid /plan

动作: GET

响应代码: 200 OK

返回作业的数据流计划。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:JobPlanInfo",
  4. "properties" : {
  5. "plan" : {
  6. "type" : "any"
  7. }
  8. }
  9. }

/jobs/:jobid /rescaling

动作: PATCH

响应代码: 200 OK

触发重新调整作业。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。

查询参数:

  • parallelism (强制项):正整数值,指定所需的并行度。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:handler:async:TriggerResponse",
  4. "properties" : {
  5. "request-id" : {
  6. "type" : "any"
  7. }
  8. }
  9. }

/jobs/:jobid /rescaling/:triggerid

动作: GET

响应代码: 200 OK

返回重新缩放 算子操作的状态。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。
  • triggerid - 32个字符的十六进制字符串,用于标识异步 算子操作触发器ID。返回ID然后触发 算子操作。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:handler:async:AsynchronousOperationResult",
  4. "properties" : {
  5. "status" : {
  6. "type" : "object",
  7. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:queue:QueueStatus",
  8. "properties" : {
  9. "id" : {
  10. "type" : "string",
  11. "required" : true,
  12. "enum" : [ "IN_PROGRESS", "COMPLETED" ]
  13. }
  14. }
  15. },
  16. "operation" : {
  17. "type" : "any"
  18. }
  19. }
  20. }

/jobs/:jobid /savepoints

动作: POST

响应代码: 202 Accepted

触发保存点,然后可选择取消作业。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。

请求:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:savepoints:SavepointTriggerRequestBody",
  4. "properties" : {
  5. "target-directory" : {
  6. "type" : "string"
  7. },
  8. "cancel-job" : {
  9. "type" : "boolean"
  10. }
  11. }
  12. }

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:handler:async:TriggerResponse",
  4. "properties" : {
  5. "request-id" : {
  6. "type" : "any"
  7. }
  8. }
  9. }

/jobs/:jobid /savepoints/:triggerid

动作: GET

响应代码: 200 OK

返回保存点 算子操作的状态。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。
  • triggerid - 32个字符的十六进制字符串,用于标识异步 算子操作触发器ID。返回ID然后触发 算子操作。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:handler:async:AsynchronousOperationResult",
  4. "properties" : {
  5. "status" : {
  6. "type" : "object",
  7. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:queue:QueueStatus",
  8. "properties" : {
  9. "id" : {
  10. "type" : "string",
  11. "required" : true,
  12. "enum" : [ "IN_PROGRESS", "COMPLETED" ]
  13. }
  14. }
  15. },
  16. "operation" : {
  17. "type" : "any"
  18. }
  19. }
  20. }

/jobs/:jobid /vertices/:vertexid

动作: GET

响应代码: 200 OK

返回任务的详细信息,并为每个子任务提供摘要。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。
  • vertexid - 标识作业顶点的32个字符的十六进制字符串值。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:JobVertexDetailsInfo",
  4. "properties" : {
  5. "id" : {
  6. "type" : "any"
  7. },
  8. "name" : {
  9. "type" : "string"
  10. },
  11. "parallelism" : {
  12. "type" : "integer"
  13. },
  14. "now" : {
  15. "type" : "integer"
  16. },
  17. "subtasks" : {
  18. "type" : "array",
  19. "items" : {
  20. "type" : "object",
  21. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:JobVertexDetailsInfo:VertexTaskDetail",
  22. "properties" : {
  23. "subtask" : {
  24. "type" : "integer"
  25. },
  26. "status" : {
  27. "type" : "string",
  28. "enum" : [ "CREATED", "SCHEDULED", "DEPLOYING", "RUNNING", "FINISHED", "CANCELING", "CANCELED", "FAILED", "RECONCILING" ]
  29. },
  30. "attempt" : {
  31. "type" : "integer"
  32. },
  33. "host" : {
  34. "type" : "string"
  35. },
  36. "start_time" : {
  37. "type" : "integer"
  38. },
  39. "end-time" : {
  40. "type" : "integer"
  41. },
  42. "duration" : {
  43. "type" : "integer"
  44. },
  45. "metrics" : {
  46. "type" : "object",
  47. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:metrics:IOMetricsInfo",
  48. "properties" : {
  49. "read-bytes" : {
  50. "type" : "integer"
  51. },
  52. "read-bytes-complete" : {
  53. "type" : "boolean"
  54. },
  55. "write-bytes" : {
  56. "type" : "integer"
  57. },
  58. "write-bytes-complete" : {
  59. "type" : "boolean"
  60. },
  61. "read-records" : {
  62. "type" : "integer"
  63. },
  64. "read-records-complete" : {
  65. "type" : "boolean"
  66. },
  67. "write-records" : {
  68. "type" : "integer"
  69. },
  70. "write-records-complete" : {
  71. "type" : "boolean"
  72. }
  73. }
  74. }
  75. }
  76. }
  77. }
  78. }
  79. }

/jobs/:jobid /vertices/:vertexid /accumulators

动作: GET

响应代码: 200 OK

返回在所有子任务中聚合的任务的用户定义累加器。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。
  • vertexid - 标识作业顶点的32个字符的十六进制字符串值。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:JobVertexAccumulatorsInfo",
  4. "properties" : {
  5. "id" : {
  6. "type" : "string"
  7. },
  8. "user-accumulators" : {
  9. "type" : "array",
  10. "items" : {
  11. "type" : "object",
  12. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:UserAccumulator",
  13. "properties" : {
  14. "name" : {
  15. "type" : "string"
  16. },
  17. "type" : {
  18. "type" : "string"
  19. },
  20. "value" : {
  21. "type" : "string"
  22. }
  23. }
  24. }
  25. }
  26. }
  27. }

/jobs/:jobid /vertices/:vertexid /backpressure

动作: GET

响应代码: 200 OK

返回作业的背压信息,并在必要时启动背压采样。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。
  • vertexid - 标识作业顶点的32个字符的十六进制字符串值。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:JobVertexBackPressureInfo",
  4. "properties" : {
  5. "status" : {
  6. "type" : "string",
  7. "enum" : [ "deprecated", "ok" ]
  8. },
  9. "backpressure-level" : {
  10. "type" : "string",
  11. "enum" : [ "ok", "low", "high" ]
  12. },
  13. "end-timestamp" : {
  14. "type" : "integer"
  15. },
  16. "subtasks" : {
  17. "type" : "array",
  18. "items" : {
  19. "type" : "object",
  20. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:JobVertexBackPressureInfo:SubtaskBackPressureInfo",
  21. "properties" : {
  22. "subtask" : {
  23. "type" : "integer"
  24. },
  25. "backpressure-level" : {
  26. "type" : "string",
  27. "enum" : [ "ok", "low", "high" ]
  28. },
  29. "ratio" : {
  30. "type" : "number"
  31. }
  32. }
  33. }
  34. }
  35. }
  36. }

/jobs/:jobid /vertices/:vertexid /metrics

动作: GET

响应代码: 200 OK

提供对任务指标的访问。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。
  • vertexid - 标识作业顶点的32个字符的十六进制字符串值。

查询参数:

  • get (可选):以逗号分隔的字符串值列表,用于选择特定指标。

请求:

  1. {}

响应:

  1. {
  2. "type" : "any"
  3. }

/jobs/:jobid /vertices/:vertexid /subtasks/accumulators

动作: GET

响应代码: 200 OK

返回任务的所有子任务的所有用户定义的累加器。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。
  • vertexid - 标识作业顶点的32个字符的十六进制字符串值。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:SubtasksAllAccumulatorsInfo",
  4. "properties" : {
  5. "id" : {
  6. "type" : "any"
  7. },
  8. "parallelism" : {
  9. "type" : "integer"
  10. },
  11. "subtasks" : {
  12. "type" : "array",
  13. "items" : {
  14. "type" : "object",
  15. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:SubtasksAllAccumulatorsInfo:SubtaskAccumulatorsInfo",
  16. "properties" : {
  17. "subtask" : {
  18. "type" : "integer"
  19. },
  20. "attempt" : {
  21. "type" : "integer"
  22. },
  23. "host" : {
  24. "type" : "string"
  25. },
  26. "user-accumulators" : {
  27. "type" : "array",
  28. "items" : {
  29. "type" : "object",
  30. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:UserAccumulator",
  31. "properties" : {
  32. "name" : {
  33. "type" : "string"
  34. },
  35. "type" : {
  36. "type" : "string"
  37. },
  38. "value" : {
  39. "type" : "string"
  40. }
  41. }
  42. }
  43. }
  44. }
  45. }
  46. }
  47. }
  48. }

/jobs/:jobid /vertices/:vertexid /subtasks/metrics

动作: GET

响应代码: 200 OK

提供对聚合子任务度量标准的访问。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。
  • vertexid - 标识作业顶点的32个字符的十六进制字符串值。

查询参数:

  • get (可选):以逗号分隔的字符串值列表,用于选择特定指标。
  • agg(可选):应该计算的以逗号分隔的聚合模式列表。可用的聚合是:“min,max,sum,avg”。
  • subtasks (可选):以逗号分隔的整数范围列表(例如“1,3,5-9”)以选择特定的子任务。

请求:

  1. {}

响应:

  1. {
  2. "type" : "any"
  3. }

/jobs/:jobid /vertices/:vertexid /subtasks/:subtaskindex

动作: GET

响应代码: 200 OK

返回子任务的当前或最新执行尝试的详细信息。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。
  • vertexid - 标识作业顶点的32个字符的十六进制字符串值。
  • subtaskindex - 标识子任务的正整数值。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:SubtaskExecutionAttemptDetailsInfo",
  4. "properties" : {
  5. "subtask" : {
  6. "type" : "integer"
  7. },
  8. "status" : {
  9. "type" : "string",
  10. "enum" : [ "CREATED", "SCHEDULED", "DEPLOYING", "RUNNING", "FINISHED", "CANCELING", "CANCELED", "FAILED", "RECONCILING" ]
  11. },
  12. "attempt" : {
  13. "type" : "integer"
  14. },
  15. "host" : {
  16. "type" : "string"
  17. },
  18. "start-time" : {
  19. "type" : "integer"
  20. },
  21. "end-time" : {
  22. "type" : "integer"
  23. },
  24. "duration" : {
  25. "type" : "integer"
  26. },
  27. "metrics" : {
  28. "type" : "object",
  29. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:metrics:IOMetricsInfo",
  30. "properties" : {
  31. "read-bytes" : {
  32. "type" : "integer"
  33. },
  34. "read-bytes-complete" : {
  35. "type" : "boolean"
  36. },
  37. "write-bytes" : {
  38. "type" : "integer"
  39. },
  40. "write-bytes-complete" : {
  41. "type" : "boolean"
  42. },
  43. "read-records" : {
  44. "type" : "integer"
  45. },
  46. "read-records-complete" : {
  47. "type" : "boolean"
  48. },
  49. "write-records" : {
  50. "type" : "integer"
  51. },
  52. "write-records-complete" : {
  53. "type" : "boolean"
  54. }
  55. }
  56. }
  57. }
  58. }

/jobs/:jobid /vertices/:vertexid /subtasks/:subtaskindex /attempts/:attempt

动作: GET

响应代码: 200 OK

返回子任务执行尝试的详细信息。在发生故障/恢复时会发生多次执行尝试。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。
  • vertexid - 标识作业顶点的32个字符的十六进制字符串值。
  • subtaskindex - 标识子任务的正整数值。
  • attempt - 标识执行尝试的正整数值。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:SubtaskExecutionAttemptDetailsInfo",
  4. "properties" : {
  5. "subtask" : {
  6. "type" : "integer"
  7. },
  8. "status" : {
  9. "type" : "string",
  10. "enum" : [ "CREATED", "SCHEDULED", "DEPLOYING", "RUNNING", "FINISHED", "CANCELING", "CANCELED", "FAILED", "RECONCILING" ]
  11. },
  12. "attempt" : {
  13. "type" : "integer"
  14. },
  15. "host" : {
  16. "type" : "string"
  17. },
  18. "start-time" : {
  19. "type" : "integer"
  20. },
  21. "end-time" : {
  22. "type" : "integer"
  23. },
  24. "duration" : {
  25. "type" : "integer"
  26. },
  27. "metrics" : {
  28. "type" : "object",
  29. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:metrics:IOMetricsInfo",
  30. "properties" : {
  31. "read-bytes" : {
  32. "type" : "integer"
  33. },
  34. "read-bytes-complete" : {
  35. "type" : "boolean"
  36. },
  37. "write-bytes" : {
  38. "type" : "integer"
  39. },
  40. "write-bytes-complete" : {
  41. "type" : "boolean"
  42. },
  43. "read-records" : {
  44. "type" : "integer"
  45. },
  46. "read-records-complete" : {
  47. "type" : "boolean"
  48. },
  49. "write-records" : {
  50. "type" : "integer"
  51. },
  52. "write-records-complete" : {
  53. "type" : "boolean"
  54. }
  55. }
  56. }
  57. }
  58. }

/jobs/:jobid /vertices/:vertexid /subtasks/:subtaskindex /attempts/:attempt/accumulators

动作: GET

响应代码: 200 OK

返回子任务执行尝试的累加器。在发生故障/恢复时会发生多次执行尝试。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。
  • vertexid - 标识作业顶点的32个字符的十六进制字符串值。
  • subtaskindex - 标识子任务的正整数值。
  • attempt - 标识执行尝试的正整数值。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:SubtaskExecutionAttemptAccumulatorsInfo",
  4. "properties" : {
  5. "subtask" : {
  6. "type" : "integer"
  7. },
  8. "attempt" : {
  9. "type" : "integer"
  10. },
  11. "id" : {
  12. "type" : "string"
  13. },
  14. "user-accumulators" : {
  15. "type" : "array",
  16. "items" : {
  17. "type" : "object",
  18. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:UserAccumulator",
  19. "properties" : {
  20. "name" : {
  21. "type" : "string"
  22. },
  23. "type" : {
  24. "type" : "string"
  25. },
  26. "value" : {
  27. "type" : "string"
  28. }
  29. }
  30. }
  31. }
  32. }
  33. }

/jobs/:jobid /vertices/:vertexid /subtasks/:subtaskindex /metrics

动作: GET

响应代码: 200 OK

提供对子任务度量标准的访问。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。
  • vertexid - 标识作业顶点的32个字符的十六进制字符串值。
  • subtaskindex - 标识子任务的正整数值。

查询参数:

  • get (可选):以逗号分隔的字符串值列表,用于选择特定指标。

请求:

  1. {}

响应:

  1. {
  2. "type" : "any"
  3. }

/jobs/:jobid /vertices/:vertexid / subtasktimes

动作: GET

响应代码: 200 OK

返回任务的所有子任务的时间相关信息。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。
  • vertexid - 标识作业顶点的32个字符的十六进制字符串值。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:SubtasksTimesInfo",
  4. "properties" : {
  5. "id" : {
  6. "type" : "string"
  7. },
  8. "name" : {
  9. "type" : "string"
  10. },
  11. "now" : {
  12. "type" : "integer"
  13. },
  14. "subtasks" : {
  15. "type" : "array",
  16. "items" : {
  17. "type" : "object",
  18. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:SubtasksTimesInfo:SubtaskTimeInfo",
  19. "properties" : {
  20. "subtask" : {
  21. "type" : "integer"
  22. },
  23. "host" : {
  24. "type" : "string"
  25. },
  26. "duration" : {
  27. "type" : "integer"
  28. },
  29. "timestamps" : {
  30. "type" : "object",
  31. "additionalProperties" : {
  32. "type" : "integer"
  33. }
  34. }
  35. }
  36. }
  37. }
  38. }
  39. }

/jobs/:jobid /vertices/:vertexid / taskmanagers

动作: GET

响应代码: 200 OK

返回TaskManager聚合的任务信息。

路径参数:

  • jobid - 标识作业的32个字符的十六进制字符串值。
  • vertexid - 标识作业顶点的32个字符的十六进制字符串值。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:JobVertexTaskManagersInfo",
  4. "properties" : {
  5. "id" : {
  6. "type" : "any"
  7. },
  8. "name" : {
  9. "type" : "string"
  10. },
  11. "now" : {
  12. "type" : "integer"
  13. },
  14. "taskmanagers" : {
  15. "type" : "array",
  16. "items" : {
  17. "type" : "object",
  18. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:JobVertexTaskManagersInfo:TaskManagersInfo",
  19. "properties" : {
  20. "host" : {
  21. "type" : "string"
  22. },
  23. "status" : {
  24. "type" : "string",
  25. "enum" : [ "CREATED", "SCHEDULED", "DEPLOYING", "RUNNING", "FINISHED", "CANCELING", "CANCELED", "FAILED", "RECONCILING" ]
  26. },
  27. "start-time" : {
  28. "type" : "integer"
  29. },
  30. "end-time" : {
  31. "type" : "integer"
  32. },
  33. "duration" : {
  34. "type" : "integer"
  35. },
  36. "metrics" : {
  37. "type" : "object",
  38. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:metrics:IOMetricsInfo",
  39. "properties" : {
  40. "read-bytes" : {
  41. "type" : "integer"
  42. },
  43. "read-bytes-complete" : {
  44. "type" : "boolean"
  45. },
  46. "write-bytes" : {
  47. "type" : "integer"
  48. },
  49. "write-bytes-complete" : {
  50. "type" : "boolean"
  51. },
  52. "read-records" : {
  53. "type" : "integer"
  54. },
  55. "read-records-complete" : {
  56. "type" : "boolean"
  57. },
  58. "write-records" : {
  59. "type" : "integer"
  60. },
  61. "write-records-complete" : {
  62. "type" : "boolean"
  63. }
  64. }
  65. },
  66. "status-counts" : {
  67. "type" : "object",
  68. "additionalProperties" : {
  69. "type" : "integer"
  70. }
  71. }
  72. }
  73. }
  74. }
  75. }
  76. }

/overview

动作: GET

响应代码: 200 OK

返回Flink集群的概述。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:handler:legacy:messages:ClusterOverviewWithVersion",
  4. "properties" : {
  5. "taskmanagers" : {
  6. "type" : "integer"
  7. },
  8. "slots-total" : {
  9. "type" : "integer"
  10. },
  11. "slots-available" : {
  12. "type" : "integer"
  13. },
  14. "jobs-running" : {
  15. "type" : "integer"
  16. },
  17. "jobs-finished" : {
  18. "type" : "integer"
  19. },
  20. "jobs-cancelled" : {
  21. "type" : "integer"
  22. },
  23. "jobs-failed" : {
  24. "type" : "integer"
  25. },
  26. "flink-version" : {
  27. "type" : "string"
  28. },
  29. "flink-commit" : {
  30. "type" : "string"
  31. }
  32. }
  33. }

/savepoint-disposal

动作: POST

响应代码: 200 OK

触发保存点的废弃处理。

请求:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:savepoints:SavepointDisposalRequest",
  4. "properties" : {
  5. "savepoint-path" : {
  6. "type" : "string"
  7. }
  8. }
  9. }

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:handler:async:TriggerResponse",
  4. "properties" : {
  5. "request-id" : {
  6. "type" : "any"
  7. }
  8. }
  9. }

/savepoint-disposal/:triggerid

动作: GET

响应代码: 200 OK

返回保存点处理 算子操作的状态。

路径参数:

  • triggerid - 32个字符的十六进制字符串,用于标识异步 算子操作触发器ID。返回ID然后触发 算子操作。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:handler:async:AsynchronousOperationResult",
  4. "properties" : {
  5. "status" : {
  6. "type" : "object",
  7. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:queue:QueueStatus",
  8. "properties" : {
  9. "id" : {
  10. "type" : "string",
  11. "required" : true,
  12. "enum" : [ "IN_PROGRESS", "COMPLETED" ]
  13. }
  14. }
  15. },
  16. "operation" : {
  17. "type" : "any"
  18. }
  19. }
  20. }

/ taskmanagers

动作: GET

响应代码: 200 OK

返回所有TaskManager的概述。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:taskmanager:TaskManagersInfo",
  4. "properties" : {
  5. "taskmanagers" : {
  6. "type" : "array",
  7. "items" : {
  8. "type" : "object",
  9. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:taskmanager:TaskManagerInfo",
  10. "properties" : {
  11. "id" : {
  12. "type" : "any"
  13. },
  14. "path" : {
  15. "type" : "string"
  16. },
  17. "dataPort" : {
  18. "type" : "integer"
  19. },
  20. "timeSinceLastHeartbeat" : {
  21. "type" : "integer"
  22. },
  23. "slotsNumber" : {
  24. "type" : "integer"
  25. },
  26. "freeSlots" : {
  27. "type" : "integer"
  28. },
  29. "hardware" : {
  30. "type" : "object",
  31. "id" : "urn:jsonschema:org:apache:flink:runtime:instance:HardwareDescription",
  32. "properties" : {
  33. "cpuCores" : {
  34. "type" : "integer"
  35. },
  36. "physicalMemory" : {
  37. "type" : "integer"
  38. },
  39. "freeMemory" : {
  40. "type" : "integer"
  41. },
  42. "managedMemory" : {
  43. "type" : "integer"
  44. }
  45. }
  46. }
  47. }
  48. }
  49. }
  50. }
  51. }

/ taskmanagers /metrics

动作: GET

响应代码: 200 OK

提供对聚合TaskManager指标的访问。

查询参数

  • get (可选):以逗号分隔的字符串值列表,用于选择特定指标。
  • agg(可选):应该计算的以逗号分隔的聚合模式列表。可用的聚合是:“min,max,sum,avg”。
  • taskmanagers (可选):以逗号分隔的32个字符的十六进制字符串列表,用于选择特定的TaskManager。

请求:

  1. {}

响应:

  1. {
  2. "type" : "any"
  3. }

/ taskmanagers /:taskmanagerid

动作: GET

响应代码: 200 OK

返回TaskManager的详细信息。

路径参数:

  • taskmanagerid - 标识TaskManager的32个字符的十六进制字符串。

请求:

  1. {}

响应:

  1. {
  2. "type" : "object",
  3. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:taskmanager:TaskManagerDetailsInfo",
  4. "properties" : {
  5. "id" : {
  6. "type" : "any"
  7. },
  8. "path" : {
  9. "type" : "string"
  10. },
  11. "dataPort" : {
  12. "type" : "integer"
  13. },
  14. "timeSinceLastHeartbeat" : {
  15. "type" : "integer"
  16. },
  17. "slotsNumber" : {
  18. "type" : "integer"
  19. },
  20. "freeSlots" : {
  21. "type" : "integer"
  22. },
  23. "hardware" : {
  24. "type" : "object",
  25. "id" : "urn:jsonschema:org:apache:flink:runtime:instance:HardwareDescription",
  26. "properties" : {
  27. "cpuCores" : {
  28. "type" : "integer"
  29. },
  30. "physicalMemory" : {
  31. "type" : "integer"
  32. },
  33. "freeMemory" : {
  34. "type" : "integer"
  35. },
  36. "managedMemory" : {
  37. "type" : "integer"
  38. }
  39. }
  40. },
  41. "metrics" : {
  42. "type" : "object",
  43. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:taskmanager:TaskManagerMetricsInfo",
  44. "properties" : {
  45. "heapUsed" : {
  46. "type" : "integer"
  47. },
  48. "heapCommitted" : {
  49. "type" : "integer"
  50. },
  51. "heapMax" : {
  52. "type" : "integer"
  53. },
  54. "nonHeapUsed" : {
  55. "type" : "integer"
  56. },
  57. "nonHeapCommitted" : {
  58. "type" : "integer"
  59. },
  60. "nonHeapMax" : {
  61. "type" : "integer"
  62. },
  63. "directCount" : {
  64. "type" : "integer"
  65. },
  66. "directUsed" : {
  67. "type" : "integer"
  68. },
  69. "directMax" : {
  70. "type" : "integer"
  71. },
  72. "mappedCount" : {
  73. "type" : "integer"
  74. },
  75. "mappedUsed" : {
  76. "type" : "integer"
  77. },
  78. "mappedMax" : {
  79. "type" : "integer"
  80. },
  81. "memorySegmentsAvailable" : {
  82. "type" : "integer"
  83. },
  84. "memorySegmentsTotal" : {
  85. "type" : "integer"
  86. },
  87. "garbageCollectors" : {
  88. "type" : "array",
  89. "items" : {
  90. "type" : "object",
  91. "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:taskmanager:TaskManagerMetricsInfo:GarbageCollectorInfo",
  92. "properties" : {
  93. "name" : {
  94. "type" : "string"
  95. },
  96. "count" : {
  97. "type" : "integer"
  98. },
  99. "time" : {
  100. "type" : "integer"
  101. }
  102. }
  103. }
  104. }
  105. }
  106. }
  107. }
  108. }

/ taskmanagers /:taskmanagerid /metrics

动作: GET

响应代码: 200 OK

提供对TaskManager指标的访问。

路径参数:

  • taskmanagerid - 标识TaskManager的32个字符的十六进制字符串。

查询参数:

  • get (可选):以逗号分隔的字符串值列表,用于选择特定指标。

请求:

  1. {}

响应:

  1. {
  2. "type" : "any"
  3. }

仅当群集在传统模式下运行时,此部分才相关。

以下是可用请求列表,其中包含示例JSON响应。所有请求都是样本表单http://hostname:8081/jobs,下面我们仅列出URL 的路径部分。

尖括号中的值是变量,例如http://hostname:8081/jobs/<jobid>/exceptions必须请求例如http://hostname:8081/jobs/7684be6004e4e955c2a558a9bc463f65/exceptions

  • /config
  • /overview
  • /jobs/overview
  • /jobs/<jobid>
  • /jobs/<jobid>/vertices
  • /jobs/<jobid>/config
  • /jobs/<jobid>/exceptions
  • /jobs/<jobid>/accumulators
  • /jobs/<jobid>/vertices/<vertexid>
  • /jobs/<jobid>/vertices/<vertexid>/subtasktimes
  • /jobs/<jobid>/vertices/<vertexid>/taskmanagers
  • /jobs/<jobid>/vertices/<vertexid>/accumulators
  • /jobs/<jobid>/vertices/<vertexid>/subtasks/accumulators
  • /jobs/<jobid>/vertices/<vertexid>/subtasks/<subtasknum>
  • /jobs/<jobid>/vertices/<vertexid>/subtasks/<subtasknum>/attempts/<attempt>
  • /jobs/<jobid>/vertices/<vertexid>/subtasks/<subtasknum>/attempts/<attempt>/accumulators
  • /jobs/<jobid>/plan
  • /jars/upload
  • /jars
  • /jars/:jarid
  • /jars/:jarid/plan
  • /jars/:jarid/run

一般

/config

有关监视API和服务器设置的一些信息。

样本结果:

  1. { "refresh-interval": 3000, "timezone-offset": 3600000, "timezone-name": "Central European Time", "flink-version": "1.7-SNAPSHOT", "flink-revision": "8124545 @ 16.09.2015 @ 15:38:42 CEST" }

/overview

Flink集群状态的简单摘要。

样本结果:

  1. { "taskmanagers": 17, "slots-total": 68, "slots-available": 68, "jobs-running": 0, "jobs-finished": 3, "jobs-cancelled": 1, "jobs-failed": 0 }

工作概览

/jobs/overview

使用小摘要概述所有作业。

样本结果:

  1. { "jobs":[ { "jid": "7684be6004e4e955c2a558a9bc463f65", "name": "Flink Java Job at Wed Sep 16 18:08:21 CEST 2015", "state": "FINISHED", "start-time": 1442419702857, "end-time": 1442419975312, "duration":272455, "last-modification": 1442419975312, "tasks": { "total": 6, "pending": 0, "running": 0, "finished": 6, "canceling": 0, "canceled": 0, "failed": 0 } }, { "jid": "49306f94d0920216b636e8dd503a6409", "name": "Flink Java Job at Wed Sep 16 18:16:39 CEST 2015", ... }] }

正在运行或已完成的工作的详细信息

/jobs/<jobid>

一个作业的摘要,列出数据流计划,状态,状态转换的时间戳,每个顶点( 算子)的聚合信息。

样本结果:

  1. { "jid": "ab78dcdbb1db025539e30217ec54ee16", "name": "WordCount Example", "state":"FINISHED", "start-time":1442421277536, "end-time":1442421299791, "duration":22255, "now":1442421991768, "timestamps": { "CREATED": 1442421277536, "RUNNING": 1442421277609, "FAILING": 0, "FAILED": 0, "CANCELLING": 0, "CANCELED": 0, "FINISHED": 1442421299791, "RESTARTING": 0 }, "vertices": [ { "id": "19b5b24062c48a06e4eac65422ac3317", "name": "CHAIN DataSource (at getTextDataSet(WordCount.java:142) ...", "parallelism": 2, "status": "FINISHED", "start-time": 1442421277609, "end-time": 1442421299469, "duration": 21860, "tasks": { "CREATED": 0, "SCHEDULED": 0, "DEPLOYING": 0, "RUNNING": 0, "FINISHED": 2, "CANCELING": 0, "CANCELED": 0, "FAILED": 0 }, "metrics": { "read-bytes": 0, "write-bytes": 37098, "read-records": 0, "write-records": 3312 } }, { "id": "f00c89b349b5c998cfd9fe2a06e50fd0", "name":"Reduce (SUM(1), at main(WordCount.java:67)", "parallelism": 2, .... }, { "id": "0a36cbc29102d7bc993d0a9bf23afa12", "name": "DataSink (CsvOutputFormat (path: /tmp/abzs, delimiter: ))", ... } ], "status-counts": { "CREATED": 0, "SCHEDULED": 0, "DEPLOYING": 0, "RUNNING": 0, "FINISHED": 3, "CANCELING": 0, "CANCELED": 0, "FAILED": 0 }, "plan": { // see plan details below } }

/jobs/<jobid>/vertices

目前一样 /jobs/<jobid>

/jobs/<jobid>/config

作业使用的用户定义的执行配置。

样本结果:

  1. { "jid": "ab78dcdbb1db025539e30217ec54ee16", "name": "WordCount Example", "execution-config": { "execution-mode": "PIPELINED", "restart-strategy": "Restart deactivated", "job-parallelism": -1, "object-reuse-mode": false } }

/jobs/<jobid>/exceptions

工作中观察到的不可恢复的异常。该truncated标志定义是否发生了更多异常,但未列出,因为否则响应会变得太大。

样本结果:

  1. { "root-exception": "java.io.IOException: File already exists:/tmp/abzs/2\n\tat org.apache.flink.core.fs.local.LocalFileSystem. ...", "all-exceptions": [ { "exception": "java.io.IOException: File already exists:/tmp/abzs/1\n\tat org.apache.flink...", "task": "DataSink (CsvOutputFormat (path: /tmp/abzs, delimiter: )) (1/2)", "location": "localhost:49220" }, { "exception": "java.io.IOException: File already exists:/tmp/abzs/2\n\tat org.apache.flink...", "task": "DataSink (CsvOutputFormat (path: /tmp/abzs, delimiter: )) (2/2)", "location": "localhost:49220" } ], "truncated":false }

/jobs/<jobid>/accumulators

聚合的用户累加器加上作业累加器。

样本结果:

  1. { "job-accumulators":[], "user-task-accumulators": [ { "name": "avglen", "type": "DoubleCounter", "value": "DoubleCounter 61.5162972" }, { "name": "genwords", "type": "LongCounter", "value": "LongCounter 37500000" } ] }

/jobs/<jobid>/vertices/<vertexid>

有关一个特定顶点的信息,以及每个子任务的摘要。

样本结果:

  1. { "id": "dceafe2df1f57a1206fcb907cb38ad97", "name": "CHAIN DataSource -> Map -> FlatMap -> Combine(SUM(1))", "parallelism": 2, "now": 1442424002154, "subtasks": [ { "subtask":0, "status": "FINISHED", "attempt": 0, "host": "localhost", "start-time": 1442421093762, "end-time": 1442421386680, "duration": 292918, "metrics": { "read-bytes": 0, "write-bytes": 12684375, "read-records": 0, "write-records": 1153125 } }, { "subtask": 1, "status": "FINISHED", "attempt": 0, "host": "localhost", "start-time": 1442421093774, "end-time": 1442421386267, "duration": 292493, "metrics": { "read-bytes": 0, "write-bytes": 12684375, "read-records": 0, "write-records": 1153125 } } ] }

/jobs/<jobid>/vertices/<vertexid>/subtasktimes

此请求返回给定顶点的所有子任务的状态转换的时间戳。例如,这些可用于在子任务之间创建时间线比较。

样本结果:

  1. { "id": "dceafe2df1f57a1206fcb907cb38ad97", "name": "CHAIN DataSource -> Map -> Combine(SUM(1))", "now":1442423745088, "subtasks": [ { "subtask": 0, "host": "localhost", "duration": 292924, "timestamps": { "CREATED": 1442421093741, "SCHEDULED": 1442421093756, "DEPLOYING": 1442421093762, "RUNNING": 1442421094026, "FINISHED": 1442421386680, "CANCELING": 0, "CANCELED": 0, "FAILED": 0 } }, { "subtask": 1, "host": "localhost", "duration": 292494, "timestamps": { "CREATED": 1442421093741, "SCHEDULED": 1442421093773, "DEPLOYING": 1442421093774, "RUNNING": 1442421094013, "FINISHED": 1442421386267, "CANCELING": 0, "CANCELED": 0, "FAILED": 0 } } ] }

/jobs/<jobid>/vertices/<vertexid>/taskmanagers

一个特定顶点的TaskManager统计信息。这是由返回的子任务统计信息的聚合/jobs/<jobid>/vertices/<vertexid>

样本结果:

  1. { "id": "fe20bcc29b87cdc76589ca42114c2499", "name": "Reduce (SUM(1), at main(WordCount.java:72)", "now": 1454348282653, "taskmanagers": [ { "host": "ip-10-0-43-227:35413", "status": "FINISHED", "start-time": 1454347870991, "end-time": 1454347872111, "duration": 1120, "metrics": { "read-bytes": 32503056, "write-bytes": 9637041, "read-records": 2906087, "write-records": 849467 }, "status-counts": { "CREATED": 0, "SCHEDULED": 0, "DEPLOYING": 0, "RUNNING": 0, "FINISHED": 18, "CANCELING": 0, "CANCELED": 0, "FAILED": 0 } },{ "host": "ip-10-0-43-227:41486", "status": "FINISHED", "start-time": 1454347871001, "end-time": 1454347872395, "duration": 1394, "metrics": { "read-bytes": 32389499, "write-bytes": 9608829, "read-records": 2895999, "write-records": 846948 }, "status-counts": { "CREATED": 0, "SCHEDULED": 0, "DEPLOYING": 0, "RUNNING": 0, "FINISHED": 18, "CANCELING": 0, "CANCELED": 0, "FAILED": 0 } } ] }

/jobs/<jobid>/vertices/<vertexid>/accumulators

用于特定顶点的聚合的用户定义累加器。

样本结果:

  1. { "id": "dceafe2df1f57a1206fcb907cb38ad97", "user-accumulators": [ { "name": "avglen", "type": "DoubleCounter", "value": "DoubleCounter 123.03259440000001" }, { "name": "genwords", "type": "LongCounter", "value": "LongCounter 75000000" } ] }

/jobs/<jobid>/vertices/<vertexid>/subtasks/accumulators

获取给定顶点的所有子任务的所有用户定义的累加器。这些是由请求以聚合形式返回的各个累加器/jobs/<jobid>/vertices/<vertexid>/accumulators

样本结果:

  1. { "id": "dceafe2df1f57a1206fcb907cb38ad97", "parallelism": 2, "subtasks": [ { "subtask": 0, "attempt": 0, "host": "localhost", "user-accumulators": [ { "name": "genwords", "type": "LongCounter", "value": "LongCounter 62500000" }, { "name": "genletters", "type": "LongCounter", "value": "LongCounter 1281589525" } ] }, { "subtask": 1, "attempt": 0, "host": "localhost", "user-accumulators": [ { "name": "genwords", "type": "LongCounter", "value": "LongCounter 12500000" }, { "name": "genletters", "type": "LongCounter", "value": "LongCounter 256317905" } ] } ] }

/jobs/<jobid>/vertices/<vertexid>/subtasks/<subtasknum>

特定子任务的当前或最新执行尝试的摘要。请参阅下面的示例。

/jobs/<jobid>/vertices/<vertexid>/subtasks/<subtasknum>/attempts/<attempt>

特定子任务的特定执行尝试的摘要。在发生故障/恢复时会发生多次执行尝试。

样本结果:

  1. { "subtask": 0, "status": "FINISHED", "attempt": 0, "host": "localhost", "start-time": 1442421093762, "end-time": 1442421386680, "duration": 292918, "metrics": { "read-bytes": 0, "write-bytes": 12684375, "read-records": 0, "write-records": 1153125 } }

/jobs/<jobid>/vertices/<vertexid>/subtasks/<subtasknum>/attempts/<attempt>/accumulators

在一次特定执行尝试期间为一个特定子任务收集累加器(在故障/恢复的情况下发生多次尝试)。

样本结果:

  1. { "subtask": 0, "attempt": 0, "id": "b22f94d91bf41ddb", "user-accumulators": [ { "name": "genwords", "type":"LongCounter", "value":"LongCounter 62500000" }, { "name": "genletters", "type": "LongCounter", "value": "LongCounter 1281589525" }, { "name": "avglen", "type": "DoubleCounter", "value": "DoubleCounter 102.527162" } ] }

/jobs/<jobid>/plan

作业的数据流计划。该计划也包含在工作总结(/jobs/<jobid>)中。

样本结果:

  1. { "jid":"ab78dcdbb1db025539e30217ec54ee16", "name":"WordCount Example", "nodes": [ { "id": "f00c89b349b5c998cfd9fe2a06e50fd0", "parallelism": 2, "operator": "GroupReduce", "operator_strategy": "Sorted Group Reduce", "description": "Reduce (SUM(1), at main(WordCount.java:67)", "inputs": [ { "num": 0, "id":"19b5b24062c48a06e4eac65422ac3317", "ship_strategy": "Hash Partition on [0]", "local_strategy":"Sort (combining) on [0:ASC]", "exchange":"pipelined" } ], "optimizer_properties": { "global_properties": [ { "name":"Partitioning", "value":"HASH_PARTITIONED" }, { "name":"Partitioned on", "value":"[0]" }, { "name":"Partitioning Order", "value":"(none)" }, { "name":"Uniqueness", "value":"not unique" } ], "local_properties": [ { "name":"Order", "value":"[0:ASC]" }, { "name":"Grouped on", "value":"[0]" }, { "name":"Uniqueness", "value":"not unique" } ], "estimates": [ { "name":"Est. Output Size", "value":"(unknown)" }, { "name":"Est. Cardinality", "value":"(unknown)" } ], "costs": [ { "name":"Network", "value":"(unknown)" }, { "name":"Disk I/O", "value":"(unknown)" }, { "name":"CPU", "value":"(unknown)" }, { "name":"Cumulative Network", "value":"(unknown)" }, { "name":"Cumulative Disk I/O", "value":"(unknown)" }, { "name":"Cumulative CPU","value":"(unknown)" } ], "compiler_hints": [ { "name":"Output Size (bytes)", "value":"(none)" }, { "name":"Output Cardinality", "value":"(none)" }, { "name":"Avg. Output Record Size (bytes)", "value":"(none)" }, { "name":"Filter Factor", "value":"(none)" } ] } }, { "id": "19b5b24062c48a06e4eac65422ac3317", "parallelism": 2, "operator": "Data Source -> FlatMap -> GroupCombine", "operator_strategy":" (none) -> FlatMap -> Sorted Combine", "description":"DataSource (at getTextDataSet(WordCount.java:142) (org.apache.flink.api.java.io.TextInputFormat)) -> FlatMap (FlatMap at main(WordCount.java:67)) -> Combine(SUM(1), at main(WordCount.java:67)", "optimizer_properties": { ... } }, { "id": "0a36cbc29102d7bc993d0a9bf23afa12", "parallelism": 2, "operator": "Data Sink", "operator_strategy": "(none)", "description": "DataSink (CsvOutputFormat (path: /tmp/abzs, delimiter: ))", "inputs":[ { "num": 0, "id": "f00c89b349b5c998cfd9fe2a06e50fd0", "ship_strategy": "Forward", "exchange": "pipelined" } ], "optimizer_properties": { ... } } ] }

取消工作

取消工作

DELETE要求/jobs/:jobid/cancel

触发取消工作,成功的结果是{}

使用Savepoint取消作业

保存点成功后触发保存点并取消作业。

GET请求/jobs/:jobid/cancel-with-savepoint/触发保存点到默认保存点目录并取消作业。

GET请求/jobs/:jobid/cancel-with-savepoint/target-directory/:targetDirectory触发保存点到给定目标目录并取消作业。

由于保存点可能需要一些时间才能完成,因此异步执行此 算子操作。此请求的结果是正在进行的取消的位置。

样本触发结果:

  1. { "status": "accepted", "request-id": 1, "location": "/jobs/:jobid/cancel-with-savepoint/in-progress/1" }
监测进展

取消的进度必须由用户监控

  1. /jobs/:jobid/cancel-with-savepoint/in-progress/:requestId

触发结果返回请求ID。

进行中
  1. { "status": "in-progress", "request-id": 1 }
成功
  1. { "status": "success", "request-id": 1, "savepoint-path": "<savepointPath>" }

savepointPath点到保存点的外部路径,其可用于恢复保存点。

失败
  1. { "status": "failed", "request-id": 1, "cause": "<error message>" }

提交程序

可以通过REST API和Web前端上传,运行和列出Flink程序。

上传新的JAR文件

发送POST请求,/jars/upload将您的jar文件作为多部分数据发送到该jarfile文件下。还要确保多部分数据包含Content-Type文件本身,某些http库默认情况下不添加标头。

多部分有效负载应该开始

  1. ------BoundaryXXXX
  2. Content-Disposition: form-data; name="jarfile"; filename="YourFileName.jar"
  3. Content-Type: application/x-java-archive

运行程序(POST)

发送POST请求/jars/:jarid/run。该jarid参数是配置的Web前端上载目录(配置Keysweb.upload.dir)中程序JAR的文件名。

您可以指定以下查询参数(全部可选):

  • 程序参数program-args=arg1 arg2 arg3
  • 要执行的主要类entry-class=EntryClassName.class
  • 默认并行度parallelism=4
  • 要从中恢复的保存点路径savepointPath=hdfs://path/to/savepoint
  • 允许非恢复状态allowNonRestoredState=true

如果呼叫成功,您将收到包含已提交作业的ID的响应。

示例:使用保存点运行程序

请求:

  1. POST: /jars/MyProgram.jar/run?savepointPath=/my-savepoints/savepoint-1bae02a80464&allowNonRestoredState=true

响应:

  1. {"jobid": "869a9868d49c679e7355700e0857af85"}