功能描述

查询任务执行详情

请求参数

通用参数

字段 类型 必选 描述
bk_app_code string 应用ID
bk_app_secret string 安全密钥(应用 TOKEN),可以通过 蓝鲸智云开发者中心 -> 点击应用ID -> 基本信息 获取
bk_token string 当前用户登录态,bk_token与bk_username必须一个有效,bk_token可以通过Cookie获取
bk_username string 当前用户用户名,应用免登录态验证白名单中的应用,用此字段指定当前用户

接口参数

字段 类型 必选 描述
bk_biz_id string 所属业务ID
task_id string 任务ID
scope string bk_biz_id 检索的作用域。默认为 cmdb_biz,此时检索的是绑定的 CMDB 业务 ID 为 bk_biz_id 的项目;当值为 project 时则检索项目 ID 为 bk_biz_id 的项目

请求参数示例

  1. {
  2. "bk_app_code": "esb_test",
  3. "bk_app_secret": "xxx",
  4. "bk_token": "xxx",
  5. "bk_biz_id": "2",
  6. "task_id": "10"
  7. }

返回结果示例

  1. {
  2. "data": {
  3. "creator": "admin",
  4. "outputs": [
  5. {
  6. "value": "1",
  7. "key": "${job_script_type}",
  8. "name": "脚本类型"
  9. },
  10. {
  11. "value": "127.0.0.1",
  12. "key": "${IP}",
  13. "name": "IP"
  14. },
  15. {
  16. "value": "0",
  17. "key": "${EXIT}",
  18. "name": "EXIT"
  19. }
  20. ],
  21. "start_time": "2019-01-17 04:13:08",
  22. "business_id": 2,
  23. "create_time": "2019-01-17 04:13:03",
  24. "business_name": "蓝鲸",
  25. "id": 10,
  26. "constants": {
  27. "${IP}": {
  28. "source_tag": "var_ip_picker.ip_picker",
  29. "source_info": {},
  30. "name": "IP",
  31. "index": 2,
  32. "custom_type": "ip",
  33. "value": {
  34. "var_ip_custom_value": "127.0.0.1",
  35. "var_ip_method": "custom",
  36. "var_ip_tree": []
  37. },
  38. "show_type": "show",
  39. "source_type": "custom",
  40. "validator": [],
  41. "key": "${IP}",
  42. "desc": "",
  43. "validation": "",
  44. "is_meta": false
  45. },
  46. "${job_script_type}": {
  47. "source_tag": "job_fast_execute_script.job_script_type",
  48. "source_info": {
  49. "node554316ea019a341f8c28cc6a7da9": [
  50. "job_script_type"
  51. ]
  52. },
  53. "name": "脚本类型",
  54. "index": 0,
  55. "custom_type": "",
  56. "value": "1",
  57. "show_type": "show",
  58. "source_type": "component_inputs",
  59. "key": "${job_script_type}",
  60. "validation": "",
  61. "desc": ""
  62. },
  63. "${EXIT}": {
  64. "source_tag": "",
  65. "source_info": {},
  66. "name": "EXIT",
  67. "index": 1,
  68. "custom_type": "input",
  69. "value": "0",
  70. "show_type": "show",
  71. "source_type": "custom",
  72. "validator": [],
  73. "key": "${EXIT}",
  74. "validation": "^.+$",
  75. "desc": ""
  76. }
  77. },
  78. "create_method": "app",
  79. "elapsed_time": 7,
  80. "ex_data": "",
  81. "instance_name": "job输出变量测试_20190117121300",
  82. "end_time": "2019-01-17 04:13:15",
  83. "executor": "admin",
  84. "template_id": "266",
  85. "task_url": "http://bk_sops_host/taskflow/execute/3/?instance_id=15364",
  86. "pipeline_tree": {
  87. "activities": {
  88. "node9b5ae13799d63e179f0ce3088b62": {
  89. "outgoing": "line27bc7b4ccbcf37ddb9d1f6572a04",
  90. "incoming": "line490caa49d2a03e64829693281032",
  91. "name": "timing",
  92. "error_ignorable": false,
  93. "component": {
  94. "code": "sleep_timer",
  95. "data": {
  96. "bk_timing": {
  97. "hook": false,
  98. "value": "2"
  99. }
  100. }
  101. },
  102. "stage_name": "步骤1",
  103. "retryable": true,
  104. "skippable": true,
  105. "type": "ServiceActivity",
  106. "optional": false,
  107. "id": "node9b5ae13799d63e179f0ce3088b62",
  108. "loop": null
  109. },
  110. "node880ded556c6c3c269be3cedc64b6": {
  111. "outgoing": "line490caa49d2a03e64829693281032",
  112. "incoming": "lineb83161d6e0593ad68d9ec73a961b",
  113. "name": "暂停",
  114. "error_ignorable": false,
  115. "component": {
  116. "code": "pause_node",
  117. "data": {}
  118. },
  119. "stage_name": "步骤1",
  120. "retryable": true,
  121. "skippable": true,
  122. "type": "ServiceActivity",
  123. "optional": true,
  124. "id": "node880ded556c6c3c269be3cedc64b6",
  125. "loop": null
  126. }
  127. },
  128. "end_event": {
  129. "type": "EmptyEndEvent",
  130. "outgoing": "",
  131. "incoming": "line27bc7b4ccbcf37ddb9d1f6572a04",
  132. "id": "node5c48f37aa9f0351e8b43ab6a2295",
  133. "name": ""
  134. },
  135. "outputs": [],
  136. "flows": {
  137. "line490caa49d2a03e64829693281032": {
  138. "is_default": false,
  139. "source": "node880ded556c6c3c269be3cedc64b6",
  140. "id": "line490caa49d2a03e64829693281032",
  141. "target": "node9b5ae13799d63e179f0ce3088b62"
  142. },
  143. "lineb83161d6e0593ad68d9ec73a961b": {
  144. "is_default": false,
  145. "source": "noded383bc1d7387391f889c6bab18b8",
  146. "id": "lineb83161d6e0593ad68d9ec73a961b",
  147. "target": "node880ded556c6c3c269be3cedc64b6"
  148. },
  149. "line27bc7b4ccbcf37ddb9d1f6572a04": {
  150. "is_default": false,
  151. "source": "node9b5ae13799d63e179f0ce3088b62",
  152. "id": "line27bc7b4ccbcf37ddb9d1f6572a04",
  153. "target": "node5c48f37aa9f0351e8b43ab6a2295"
  154. }
  155. },
  156. "gateways": {},
  157. "line": [
  158. {
  159. "source": {
  160. "id": "node9b5ae13799d63e179f0ce3088b62",
  161. "arrow": "Right"
  162. },
  163. "target": {
  164. "id": "node5c48f37aa9f0351e8b43ab6a2295",
  165. "arrow": "Left"
  166. },
  167. "id": "line27bc7b4ccbcf37ddb9d1f6572a04"
  168. },
  169. {
  170. "source": {
  171. "id": "node880ded556c6c3c269be3cedc64b6",
  172. "arrow": "Right"
  173. },
  174. "target": {
  175. "id": "node9b5ae13799d63e179f0ce3088b62",
  176. "arrow": "Left"
  177. },
  178. "id": "line490caa49d2a03e64829693281032"
  179. },
  180. {
  181. "source": {
  182. "id": "noded383bc1d7387391f889c6bab18b8",
  183. "arrow": "Right"
  184. },
  185. "id": "lineb83161d6e0593ad68d9ec73a961b",
  186. "target": {
  187. "id": "node880ded556c6c3c269be3cedc64b6",
  188. "arrow": "Left"
  189. }
  190. }
  191. ],
  192. "start_event": {
  193. "type": "EmptyStartEvent",
  194. "outgoing": "lineb83161d6e0593ad68d9ec73a961b",
  195. "incoming": "",
  196. "id": "noded383bc1d7387391f889c6bab18b8",
  197. "name": ""
  198. },
  199. "id": "node7ef6970d06ad3bc092594cb5ec5f",
  200. "constants": {},
  201. "location": [
  202. {
  203. "stage_name": "步骤1",
  204. "name": "暂停",
  205. "y": 135,
  206. "x": 300,
  207. "type": "tasknode",
  208. "id": "node880ded556c6c3c269be3cedc64b6"
  209. },
  210. {
  211. "y": 150,
  212. "x": 1000,
  213. "type": "endpoint",
  214. "id": "node5c48f37aa9f0351e8b43ab6a2295"
  215. },
  216. {
  217. "stage_name": "步骤1",
  218. "name": "timing",
  219. "y": 135,
  220. "x": 595,
  221. "type": "tasknode",
  222. "id": "node9b5ae13799d63e179f0ce3088b62"
  223. },
  224. {
  225. "y": 150,
  226. "x": 80,
  227. "type": "startpoint",
  228. "id": "noded383bc1d7387391f889c6bab18b8"
  229. }
  230. ]
  231. }
  232. },
  233. "result": true
  234. }

返回结果参数说明

字段 类型 描述
result bool true/false 查询成功与否
data dict result=true 时返回数据,详细信息见下面说明
message string result=false 时错误信息

data

字段 类型 描述
id int 任务 ID,即 task_id
name string 任务名称
business_id int 所属业务 ID
business_name string 所属业务名称
template_id int 创建任务所用的流程模板 ID
create_time string 任务创建时间
create_method string 任务创建方式
start_time string 任务执行时间
finish_time string 任务完成时间
elapsed_time int 任务执行耗时(秒)
creator string 任务创建人
executor string 任务执行人
constants dict 输入的全局变量,详情见下面说明
outputs list 任务输出参数,详情见下面说明
task_url str 任务实例链接
pipeline_tree dict 任务实例树

data.constants KEY

全局变量 KEY,${key} 格式

data.constants VALUE

字段 类型 描述
key string 同 KEY
name string 变量名字
index int 变量在模板中的显示顺序
desc string 变量说明
source_type string 变量来源, 取值范围 custom: 自定义变量,component_inputs: 从标准插件输入参数勾选,component_outputs:从标准插件输出结果中勾选
custom_type string source_type=custom 时有效,自定义变量类型, 取值范围 input: 输入框,textarea: 文本框,datetime: 日期时间,int: 整数
source_tag string source_type=component_inputs/component_outputs 时有效,变量的来源标准插件
source_info dict source_type=component_inputs/component_outputs 时有效,变量的来源节点信息

data.outputs[]

字段 类型 描述
name string 输出参数名称
value string、int、bool、dict、list 输出参数值
key string 输出参数 KEY
preset bool 是否是标准插件定义中预设输出变量

data.pipeline_tree

字段 类型 描述
start_event dict 开始节点信息
end_event dict 结束节点信息
activities dict 任务节点(标准插件和子流程)信息
gateways dict 网关节点(并行网关、分支网关和汇聚网关)信息
flows dict 顺序流(节点连线)信息
constants dict 全局变量信息,详情见下面
outputs list 模板输出信息,标记 constants 中的输出字段