From 7d67b3aabf6f20bd2b387b67af4f66540fe845d0 Mon Sep 17 00:00:00 2001
From: hanshuaikang <1758504262@qq.com>
Date: Fri, 25 Aug 2023 15:33:10 +0800
Subject: [PATCH] =?UTF-8?q?docs:=20=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?=
=?UTF-8?q?=E7=9A=84=E6=B3=A8=E9=87=8A=EF=BC=8C=E8=A1=A5=E5=85=85=E6=96=87?=
=?UTF-8?q?=E6=A1=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
bamboo_engine/api.py | 12 +-----
docs/user_guide/engine_api.md | 72 +++++++++++++++++++++++++++++++++++
2 files changed, 74 insertions(+), 10 deletions(-)
diff --git a/bamboo_engine/api.py b/bamboo_engine/api.py
index 6902bd27..315acf83 100644
--- a/bamboo_engine/api.py
+++ b/bamboo_engine/api.py
@@ -662,13 +662,9 @@ def preview_node_inputs(
@_ensure_return_api_result
def get_pipeline_execution_time(runtime: EngineRuntimeInterface, pipeline_id: str):
"""
- 获取节点或者流程的运行时间信息,
- 当entity_id 为节点id时,返回的是节点的运行时间信息,
- 当entity_id 为 root_pipeline_id 时, 返回的是pipeline任务实例的运行时间信息
-
:param runtime: 引擎运行时实例
:type runtime: EngineRuntimeInterface
- :param pipeline_id: 实例id,node_id or pipeline_id
+ :param pipeline_id: pipeline_id
:type pipeline_id: str
:return: 执行结果
:rtype: EngineAPIResult
@@ -689,13 +685,9 @@ def get_pipeline_execution_time(runtime: EngineRuntimeInterface, pipeline_id: st
@_ensure_return_api_result
def get_node_execution_time(runtime: EngineRuntimeInterface, node_id: str):
"""
- 获取节点或者流程的运行时间信息,
- 当entity_id 为节点id时,返回的是节点的运行时间信息,
- 当entity_id 为 root_pipeline_id 时, 返回的是pipeline任务实例的运行时间信息
-
:param runtime: 引擎运行时实例
:type runtime: EngineRuntimeInterface
- :param node_id: 实例id,node_id or pipeline_id
+ :param node_id: node_id
:type node_id: str
:return: 执行结果
:rtype: EngineAPIResult
diff --git a/docs/user_guide/engine_api.md b/docs/user_guide/engine_api.md
index b5015693..690c412f 100644
--- a/docs/user_guide/engine_api.md
+++ b/docs/user_guide/engine_api.md
@@ -43,6 +43,10 @@
- [example](#1201-example)
- [get_node_short_histories](#121-get_node_short_histories)
- [example](#1211-example)
+ - [get_node_execution_time](#122-get_node_execution_time)
+ - [example](#1221-example)
+ - [get_pipeline_execution_time](#123-get_pipeline_execution_time)
+ - [example](#1231-example)
@@ -879,3 +883,71 @@ api.get_node_histories(runtime=runtime, node_id="node_id").data
}
]
```
+
+
+
+### 1.22 get_node_execution_time
+
+> 节点的运行时间指的是节点从开始到结束状态的时间,单位: 秒。 当节点未结束时,表示节点运行到此刻的持续时间。
+```python
+def get_node_execution_time(runtime: EngineRuntimeInterface, node_id: str):
+ """
+ :param runtime: 引擎运行时实例
+ :type runtime: EngineRuntimeInterface
+ :param node_id: node_id
+ :type node_id: str
+ :return: 执行结果
+ :rtype: EngineAPIResult
+ """
+```
+
+
+
+### 1.22.1. example
+
+```python
+runtime = BambooDjangoRuntime()
+api.get_node_execution_time(runtime=runtime, node_id="node_id").data
+
+{
+ "state": "FINISHED", # 节点状态
+ "started_time": datetime.datetime(2021, 3, 10, 11, 10, 9, 350028, tzinfo=), # 节点开始执行时间
+ "archived_time": datetime.datetime(2021, 3, 10, 11, 10, 9, 352609, tzinfo=), # 执行完成(成功或失败)时间
+ "execution_time": 10.0, #执行的秒数
+}
+```
+
+
+
+### 1.23 get_pipeline_execution_time
+
+> 任务的运行时间指的是任务从开始到结束状态的时间,单位: 秒。 当任务未结束时,表示任务运行到此刻的持续时间。
+```python
+def get_pipeline_execution_time(runtime: EngineRuntimeInterface, pipeline_id: str):
+ """
+ 获取节点或者流程的运行时间信息,
+ :param runtime: 引擎运行时实例
+ :type runtime: EngineRuntimeInterface
+ :param pipeline_id: pipeline_id
+ :type pipeline_id: str
+ :return: 执行结果
+ :rtype: EngineAPIResult
+ """
+```
+
+
+
+### 1.23.1. example
+
+```python
+runtime = BambooDjangoRuntime()
+api.get_pipeline_execution_time(runtime=runtime, pipeline_id="pipeline_id").data
+
+{
+ "state": "FINISHED", # 节点状态
+ "started_time": datetime.datetime(2021, 3, 10, 11, 10, 9, 350028, tzinfo=), # 节点开始执行时间
+ "archived_time": datetime.datetime(2021, 3, 10, 11, 10, 9, 352609, tzinfo=), # 执行完成(成功或失败)时间
+ "execution_time": 10.0, #执行的秒数
+}
+```
+