Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: 删除多余的注释,补充文档 #175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions bamboo_engine/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
72 changes: 72 additions & 0 deletions docs/user_guide/engine_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

<!-- /TOC -->

Expand Down Expand Up @@ -879,3 +883,71 @@ api.get_node_histories(runtime=runtime, node_id="node_id").data
}
]
```

<a id="toc_anchor" name="#122-get_node_execution_time"></a>

### 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
"""
```

<a id="toc_anchor" name="#1221-example"></a>

### 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=<UTC>), # 节点开始执行时间
"archived_time": datetime.datetime(2021, 3, 10, 11, 10, 9, 352609, tzinfo=<UTC>), # 执行完成(成功或失败)时间
"execution_time": 10.0, #执行的秒数
}
```

<a id="toc_anchor" name="#123-get_node_execution_time"></a>

### 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
"""
```

<a id="toc_anchor" name="#1231-example"></a>

### 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=<UTC>), # 节点开始执行时间
"archived_time": datetime.datetime(2021, 3, 10, 11, 10, 9, 352609, tzinfo=<UTC>), # 执行完成(成功或失败)时间
"execution_time": 10.0, #执行的秒数
}
```