This is an automated email from the ASF dual-hosted git repository.

zhongjiajie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 4b5c6a2  [Feature-8023][Document] Add example and notice about task 
type Python (#8023) (#713)
4b5c6a2 is described below

commit 4b5c6a259ba4395fae7ce3f575dae92d6ef8a117
Author: Eric Gao <[email protected]>
AuthorDate: Fri Apr 1 22:35:11 2022 +0800

    [Feature-8023][Document] Add example and notice about task type Python 
(#8023) (#713)
---
 docs/en-us/2.0.5/user_doc/guide/task/python.md |  62 +++++++++++++++++++-----
 docs/en-us/dev/user_doc/guide/task/python.md   |  58 +++++++++++++++++++----
 docs/zh-cn/2.0.5/user_doc/guide/task/python.md |  63 ++++++++++++++++++++-----
 docs/zh-cn/dev/user_doc/guide/task/python.md   |  63 ++++++++++++++++++++-----
 img/tasks/demo/python.jpg                      | Bin 0 -> 235373 bytes
 img/tasks/demo/python_custom_param.jpg         | Bin 0 -> 230867 bytes
 img/tasks/demo/python_custom_param_ui_next.jpg | Bin 0 -> 396899 bytes
 img/tasks/demo/python_ui_next.jpg              | Bin 0 -> 450888 bytes
 img/tasks/icons/python.png                     | Bin 0 -> 34066 bytes
 9 files changed, 204 insertions(+), 42 deletions(-)

diff --git a/docs/en-us/2.0.5/user_doc/guide/task/python.md 
b/docs/en-us/2.0.5/user_doc/guide/task/python.md
index d70ef5c..6edb29d 100644
--- a/docs/en-us/2.0.5/user_doc/guide/task/python.md
+++ b/docs/en-us/2.0.5/user_doc/guide/task/python.md
@@ -1,15 +1,55 @@
-# Python
+# Python Node
 
-- Using python nodes, you can directly execute python scripts. For python 
nodes, workers will use `python **` to submit tasks.
+## Overview
 
-> Drag in the 
toolbar![PNG](https://analysys.github.io/easyscheduler_docs_cn/images/toolbar_PYTHON.png)The
 task node to the drawing board, as shown in the following figure:
+Use `Python Task` to create a python-type task and execute python scripts. 
When the worker executes `Python Task`,
+it will generate a temporary python script, and executes the script by the 
Linux user with the same name as the tenant.
 
-<p align="center">
-   <img src="/img/python-en.png" width="80%" />
- </p>
+## Create Task
 
-- Script: Python program developed by the user
-- Environment Name: Specific which Python interpreter would be use and run 
`Script`. If you want to use Python virtualenv, you should create multiply 
environments for each virtualenv.
-- Resources: refers to the list of resource files that need to be called in 
the script
-- User-defined parameter: It is a local user-defined parameter of Python, 
which will replace the content with \${variable} in the script
-- Note: If you import the python file under the resource directory tree, you 
need to add the `__init__.py` file
+- Click Project Management-Project Name-Workflow Definition, and click the 
"Create Workflow" button to enter the DAG editing page.
+- Drag <img src="/img/tasks/icons/python.png" width="15"/> from the toolbar to 
the canvas.
+
+## Task Parameter
+
+- Node name: The node name in a workflow definition is unique.
+- Run flag: Identifies whether this node can be scheduled normally, if it does 
not need to be executed, you can turn on the prohibition switch.
+- Descriptive information: Describe the function of the node.
+- Task priority: When the number of worker threads is insufficient, execute in 
the order of priority from high to low, and tasks with the same priority will 
execute in a first-in first-out order.
+- Worker grouping: Assign tasks to the machines of the worker group to 
execute. If `Default` is selected, randomly select a worker machine for 
execution.
+- Environment Name: Configure the environment name in which to run the script.
+- Number of failed retry attempts: The failure task resubmitting times. It 
supports drop-down and hand-filling.
+- Failed retry interval: The time interval for resubmitting the task after a 
failed task. It supports drop-down and hand-filling.
+- Timeout alarm: Check the timeout alarm and timeout failure. When the task 
exceeds the "timeout period", an alarm email will send and the task execution 
will fail.
+- Script: Python program developed by the user.
+- Resource: Refers to the list of resource files that need to be called in the 
script, and the files uploaded or created by the resource center-file 
management.
+- Custom parameters: It is the user-defined parameters of Python, which will 
replace the content with \${variable} in the script.
+
+## Task Example
+
+### Simply Print
+
+This example simulates a common task that runs by a simple command. The 
example is to print one line in the log file, as shown in the following figure:
+"This is a demo of python task".
+
+![demo-python-simple](/img/tasks/demo/python.jpg)
+
+```python
+print("This is a demo of python task")
+```
+
+### Custom Parameters
+
+This example simulates a custom parameter task. We use parameters for reusing 
existing tasks as template or coping with the dynamic task. In this case,
+we declare a custom parameter named "param_key", with the value "param_val". 
Then we use echo to print the parameter "${param_key}" we just declared.
+After running this example, we would see "param_val" print in the log.
+
+![demo-python-custom-param](/img/tasks/demo/python_custom_param.jpg)
+
+```python
+print("${param_key}")
+```
+
+## Notice
+
+None
diff --git a/docs/en-us/dev/user_doc/guide/task/python.md 
b/docs/en-us/dev/user_doc/guide/task/python.md
index 56df104..31ea986 100644
--- a/docs/en-us/dev/user_doc/guide/task/python.md
+++ b/docs/en-us/dev/user_doc/guide/task/python.md
@@ -1,15 +1,55 @@
 # Python Node
 
-- Using python nodes, you can directly execute python scripts. For python 
nodes, workers use `python **` to submit tasks.
+## Overview
 
-> Drag from the toolbar 
![PNG](https://analysys.github.io/easyscheduler_docs_cn/images/toolbar_PYTHON.png)
 task node to the canvas, as shown in the following figure:
+Use `Python Task` to create a python-type task and execute python scripts. 
When the worker executes `Python Task`,
+it will generate a temporary python script, and executes the script by the 
Linux user with the same name as the tenant.
 
-<p align="center">
-   <img src="/img/python-en.png" width="80%" />
- </p>
+## Create Task
 
+- Click Project Management-Project Name-Workflow Definition, and click the 
"Create Workflow" button to enter the DAG editing page.
+- Drag <img src="/img/tasks/icons/python.png" width="15"/> from the toolbar to 
the canvas.
+
+## Task Parameter
+
+- Node name: The node name in a workflow definition is unique.
+- Run flag: Identifies whether this node can be scheduled normally, if it does 
not need to be executed, you can turn on the prohibition switch.
+- Descriptive information: Describe the function of the node.
+- Task priority: When the number of worker threads is insufficient, execute in 
the order of priority from high to low, and tasks with the same priority will 
execute in a first-in first-out order.
+- Worker grouping: Assign tasks to the machines of the worker group to 
execute. If `Default` is selected, randomly select a worker machine for 
execution.
+- Environment Name: Configure the environment name in which to run the script.
+- Number of failed retry attempts: The failure task resubmitting times. It 
supports drop-down and hand-filling.
+- Failed retry interval: The time interval for resubmitting the task after a 
failed task. It supports drop-down and hand-filling.
+- Timeout alarm: Check the timeout alarm and timeout failure. When the task 
exceeds the "timeout period", an alarm email will send and the task execution 
will fail.
 - Script: Python program developed by the user.
-- Environment Name: Specific Python interpreter path for running the script. 
If you need to use Python **virtualenv**, you should create multiply 
environments for each **virtualenv**.  
-- Resources: Refers to the list of resource files that need to be called in 
the script.
-- User-defined parameter: It is a user-defined local parameter of Python, and 
will replace the content with `${variable}` in the script.
-- Note: If you import the python file under the resource directory tree, you 
need to add the `__init__.py` file.
+- Resource: Refers to the list of resource files that need to be called in the 
script, and the files uploaded or created by the resource center-file 
management.
+- Custom parameters: It is the user-defined parameters of Python, which will 
replace the content with \${variable} in the script.
+
+## Task Example
+
+### Simply Print
+
+This example simulates a common task that runs by a simple command. The 
example is to print one line in the log file, as shown in the following figure:
+"This is a demo of python task".
+
+![demo-python-simple](/img/tasks/demo/python_ui_next.jpg)
+
+```python
+print("This is a demo of python task")
+```
+
+### Custom Parameters
+
+This example simulates a custom parameter task. We use parameters for reusing 
existing tasks as template or coping with the dynamic task. In this case,
+we declare a custom parameter named "param_key", with the value "param_val". 
Then we use echo to print the parameter "${param_key}" we just declared.
+After running this example, we would see "param_val" print in the log.
+
+![demo-python-custom-param](/img/tasks/demo/python_custom_param_ui_next.jpg)
+
+```python
+print("${param_key}")
+```
+
+## Notice
+
+None
diff --git a/docs/zh-cn/2.0.5/user_doc/guide/task/python.md 
b/docs/zh-cn/2.0.5/user_doc/guide/task/python.md
index ec01f2f..b851acf 100644
--- a/docs/zh-cn/2.0.5/user_doc/guide/task/python.md
+++ b/docs/zh-cn/2.0.5/user_doc/guide/task/python.md
@@ -1,15 +1,56 @@
-# Python节点
+# Python 节点
 
-- 使用python节点,可以直接执行python脚本,对于python节点,worker会使用`python **`方式提交任务。
+## Overview
 
-> 
拖动工具栏中的![PNG](https://analysys.github.io/easyscheduler_docs_cn/images/toolbar_PYTHON.png)任务节点到画板中,如下图所示:
+Python 任务类型,用于创建 Python 类型的任务并执行一系列的 Python 脚本。worker 执行该任务的时候,会生成一个临时python脚本,
+并使用与租户同名的 linux 用户执行这个脚本。
 
-<p align="center">
-   <img src="/img/python_edit.png" width="80%" />
- </p>
+## Create Task
 
-- 脚本:用户开发的Python程序
-- 环境名称:执行Python程序的解释器路径,指定运行脚本的解释器。当你需要使用 Python **虚拟环境** 时,可以通过创建不同的环境名称来实现。
-- 资源:是指脚本中需要调用的资源文件列表
-- 自定义参数:是Python局部的用户自定义参数,会替换脚本中以${变量}的内容
-- 注意:若引入资源目录树下的python文件,需添加 `__init__.py` 文件
+- 点击项目管理-项目名称-工作流定义,点击"创建工作流"按钮,进入DAG编辑页面。
+- 工具栏中拖动 <img src="/img/tasks/icons/python.png" width="15"/> 到画板中,即可完成创建。
+
+## Task Parameter
+
+- 任务名称:设置任务的名称。一个工作流定义中的节点名称是唯一的。
+- 运行标志:标识这个节点是否能正常调度,如果不需要执行,可以打开禁止执行开关。
+- 描述:描述该节点的功能。
+- 任务优先级:worker线程数不足时,根据优先级从高到低依次执行,优先级一样时根据先进先出原则执行。
+- Worker分组:任务分配给worker组的机器机执行,选择Default,会随机选择一台worker机执行。
+- 环境名称:配置运行脚本的环境。
+- 失败重试次数:任务失败重新提交的次数,支持下拉和手填。
+- 失败重试间隔:任务失败重新提交任务的时间间隔,支持下拉和手填。
+- 超时告警:勾选超时告警、超时失败,当任务超过"超时时长"后,会发送告警邮件并且任务执行失败.
+- 脚本:用户开发的PYTHON程序。
+- 资源:是指脚本中需要调用的资源文件列表,资源中心-文件管理上传或创建的文件。
+- 自定义参数:是PYTHON局部的用户自定义参数,会替换脚本中以${变量}的内容。
+- 前置任务:选择当前任务的前置任务,会将被选择的前置任务设置为当前任务的上游。
+
+## Task Example
+
+### Simply Print
+
+该样例模拟了常见的简单任务,这些任务只需要简单的一两行命令就能运行起来。我们以打印一行日志为例,该任务仅会在日志文件中打印一行
+"This is a demo of python task"
+
+![demo-python-simple](/img/tasks/demo/python.jpg)
+
+```python
+print("This is a demo of python task")
+```
+
+### Custom Parameters
+
+该样例模拟了自定义参数任务,为了更方便的复用已有的任务,或者面对动态的需求时,我们会使用变量保证脚本的复用性。本例中,我们先在自定义脚本
+中定义了参数 "param_key",并将他的值设置为 "param_val"。接着在"脚本"中使用了 print 函数,将参数 "param_key" 
打印了出来。当我们保存
+并运行任务后,在日志中会看到将参数 "param_key" 对应的值 "param_val" 打印出来。
+
+![demo-python-custom-param](/img/tasks/demo/python_custom_param.jpg)
+
+```python
+print("${param_key}")
+```
+
+## Notice
+
+None
diff --git a/docs/zh-cn/dev/user_doc/guide/task/python.md 
b/docs/zh-cn/dev/user_doc/guide/task/python.md
index 7b4a8f4..e4316ae 100644
--- a/docs/zh-cn/dev/user_doc/guide/task/python.md
+++ b/docs/zh-cn/dev/user_doc/guide/task/python.md
@@ -1,15 +1,56 @@
-# Python节点
+# Python 节点
 
-- 使用python节点,可以直接执行python脚本,对于python节点,worker会使用`python **`方式提交任务。
+## Overview
 
-> 
拖动工具栏中的![PNG](https://analysys.github.io/easyscheduler_docs_cn/images/toolbar_PYTHON.png)任务节点到画板中,如下图所示:
+Python 任务类型,用于创建 Python 类型的任务并执行一系列的 Python 脚本。worker 执行该任务的时候,会生成一个临时python脚本,
+并使用与租户同名的 linux 用户执行这个脚本。
 
-<p align="center">
-   <img src="/img/python_edit.png" width="80%" />
- </p>
+## Create Task
 
-- 脚本:用户开发的Python程序
-- 环境名称:执行Python程序的解释器路径,指定运行脚本的解释器。当你需要使用 Python **虚拟环境** 时,可以通过创建不同的环境名称来实现。 
-- 资源:是指脚本中需要调用的资源文件列表
-- 自定义参数:是Python局部的用户自定义参数,会替换脚本中以${变量}的内容
-- 注意:若引入资源目录树下的python文件,需添加 `__init__.py` 文件
+- 点击项目管理-项目名称-工作流定义,点击"创建工作流"按钮,进入DAG编辑页面。
+- 工具栏中拖动 <img src="/img/tasks/icons/python.png" width="15"/> 到画板中,即可完成创建。
+
+## Task Parameter
+
+- 任务名称:设置任务的名称。一个工作流定义中的节点名称是唯一的。
+- 运行标志:标识这个节点是否能正常调度,如果不需要执行,可以打开禁止执行开关。
+- 描述:描述该节点的功能。
+- 任务优先级:worker线程数不足时,根据优先级从高到低依次执行,优先级一样时根据先进先出原则执行。
+- Worker分组:任务分配给worker组的机器机执行,选择Default,会随机选择一台worker机执行。
+- 环境名称:配置运行脚本的环境。
+- 失败重试次数:任务失败重新提交的次数,支持下拉和手填。
+- 失败重试间隔:任务失败重新提交任务的时间间隔,支持下拉和手填。
+- 超时告警:勾选超时告警、超时失败,当任务超过"超时时长"后,会发送告警邮件并且任务执行失败.
+- 脚本:用户开发的PYTHON程序。
+- 资源:是指脚本中需要调用的资源文件列表,资源中心-文件管理上传或创建的文件。
+- 自定义参数:是PYTHON局部的用户自定义参数,会替换脚本中以${变量}的内容。
+- 前置任务:选择当前任务的前置任务,会将被选择的前置任务设置为当前任务的上游。
+
+## Task Example
+
+### Simply Print
+
+该样例模拟了常见的简单任务,这些任务只需要简单的一两行命令就能运行起来。我们以打印一行日志为例,该任务仅会在日志文件中打印一行
+"This is a demo of python task"
+
+![demo-python-simple](/img/tasks/demo/python_ui_next.jpg)
+
+```python
+print("This is a demo of python task")
+```
+
+### Custom Parameters
+
+该样例模拟了自定义参数任务,为了更方便的复用已有的任务,或者面对动态的需求时,我们会使用变量保证脚本的复用性。本例中,我们先在自定义脚本
+中定义了参数 "param_key",并将他的值设置为 "param_val"。接着在"脚本"中使用了 print 函数,将参数 "param_key" 
打印了出来。当我们保存
+并运行任务后,在日志中会看到将参数 "param_key" 对应的值 "param_val" 打印出来。
+
+![demo-python-custom-param](/img/tasks/demo/python_custom_param_ui_next.jpg)
+
+```python
+print("${param_key}")
+```
+
+## Notice
+
+None
diff --git a/img/tasks/demo/python.jpg b/img/tasks/demo/python.jpg
new file mode 100644
index 0000000..3de8651
Binary files /dev/null and b/img/tasks/demo/python.jpg differ
diff --git a/img/tasks/demo/python_custom_param.jpg 
b/img/tasks/demo/python_custom_param.jpg
new file mode 100644
index 0000000..399ee03
Binary files /dev/null and b/img/tasks/demo/python_custom_param.jpg differ
diff --git a/img/tasks/demo/python_custom_param_ui_next.jpg 
b/img/tasks/demo/python_custom_param_ui_next.jpg
new file mode 100644
index 0000000..de041f0
Binary files /dev/null and b/img/tasks/demo/python_custom_param_ui_next.jpg 
differ
diff --git a/img/tasks/demo/python_ui_next.jpg 
b/img/tasks/demo/python_ui_next.jpg
new file mode 100644
index 0000000..bff7135
Binary files /dev/null and b/img/tasks/demo/python_ui_next.jpg differ
diff --git a/img/tasks/icons/python.png b/img/tasks/icons/python.png
new file mode 100644
index 0000000..9775b28
Binary files /dev/null and b/img/tasks/icons/python.png differ

Reply via email to