Browse Source

[doc] Modified parameter doc files. (#10659)

3.0.0/version-upgrade
sneh-wha 2 years ago committed by caishunfeng
parent
commit
7ae28de1f1
  1. 58
      docs/docs/en/guide/parameter/built-in.md
  2. 2
      docs/docs/en/guide/parameter/context.md
  3. 2
      docs/docs/en/guide/parameter/global.md
  4. 24
      docs/docs/en/guide/parameter/local.md
  5. 10
      docs/docs/en/guide/parameter/priority.md

58
docs/docs/en/guide/parameter/built-in.md

@ -2,24 +2,11 @@
## Basic Built-in Parameter
<table>
<tr><th>Variable</th><th>Declaration Method</th><th>Meaning</th></tr>
<tr>
<td>system.biz.date</td>
<td>${system.biz.date}</td>
<td>The day before the schedule time of the daily scheduling instance, the format is yyyyMMdd</td>
</tr>
<tr>
<td>system.biz.curdate</td>
<td>${system.biz.curdate}</td>
<td>The schedule time of the daily scheduling instance, the format is yyyyMMdd</td>
</tr>
<tr>
<td>system.datetime</td>
<td>${system.datetime}</td>
<td>The schedule time of the daily scheduling instance, the format is yyyyMMddHHmmss</td>
</tr>
</table>
| Variable | Declaration Method | Meaning |
| ---- | ---- | -----------------------------|
| system.biz.date | `${system.biz.date}` | The day before the schedule time of the daily scheduling instance, the format is `yyyyMMdd` |
| system.biz.curdate | `${system.biz.curdate}` | The schedule time of the daily scheduling instance, the format is `yyyyMMdd` |
| system.datetime | `${system.datetime}` | The schedule time of the daily scheduling instance, the format is `yyyyMMddHHmmss` |
## Extended Built-in Parameter
@ -27,22 +14,21 @@
- Benchmark variable defines as `$[...]` format, time format `$[yyyyMMddHHmmss]` can be decomposed and combined arbitrarily, such as: `$[yyyyMMdd]`, `$[HHmmss]`, `$[yyyy-MM-dd]`, etc.
- Or define by the 2 following ways:
- Or define by the following two ways:
1. Use add_month(yyyyMMdd, offset) function to add or minus number of months
the first parameter of this function is [yyyyMMdd], represents the time format
the second parameter is offset, represents the number of months the user wants to add or minus
* Next N years:$[add_months(yyyyMMdd,12*N)]
* N years before:$[add_months(yyyyMMdd,-12*N)]
* Next N months:$[add_months(yyyyMMdd,N)]
* N months before:$[add_months(yyyyMMdd,-N)]
*********************************************************************************************************
1. Add or minus numbers directly after the time format
* Next N weeks:$[yyyyMMdd+7*N]
* First N weeks:$[yyyyMMdd-7*N]
* Next N days:$[yyyyMMdd+N]
* N days before:$[yyyyMMdd-N]
* Next N hours:$[HHmmss+N/24]
* First N hours:$[HHmmss-N/24]
* Next N minutes:$[HHmmss+N/24/60]
* First N minutes:$[HHmmss-N/24/60]
1. Use add_month(yyyyMMdd, offset) function to add or minus number of months.
The first parameter of this function is [yyyyMMdd], represents the time format and the second parameter is offset, represents the number of months the user wants to add or minus.
- Next N years:`$[add_months(yyyyMMdd,12*N)]`
- N years before:`$[add_months(yyyyMMdd,-12*N)]`
- Next N months:`$[add_months(yyyyMMdd,N)]`
- N months before:`$[add_months(yyyyMMdd,-N)]`
2. Add or minus numbers directly after the time format.
- Next N weeks:`$[yyyyMMdd+7*N]`
- First N weeks:`$[yyyyMMdd-7*N]`
- Next N days:`$[yyyyMMdd+N]`
- N days before:`$[yyyyMMdd-N]`
- Next N hours:`$[HHmmss+N/24]`
- First N hours:`$[HHmmss-N/24]`
- Next N minutes:`$[HHmmss+N/24/60]`
- First N minutes:`$[HHmmss-N/24/60]`

2
docs/docs/en/guide/parameter/context.md

@ -1,4 +1,4 @@
# Refer to Parameter Context
# Parameter Context
DolphinScheduler provides the ability to refer to each other between parameters, including local parameters refer to global parameters and upstream and downstream parameter transfer. Due to the existence of references, it involves the priority of parameters when the parameter names are the same. see also [Parameter Priority](priority.md)

2
docs/docs/en/guide/parameter/global.md

@ -8,6 +8,8 @@ Global parameters are parameters that are valid for all task nodes of the entire
The specific use method can be determined according to the actual production situation. This example uses a shell task to print out the date value of yesterday.
## Example
### Create a Shell task
Create a shell task and enter `echo ${dt}` in the script content. In this case, dt is the global parameter we need to declare. As shown below:

24
docs/docs/en/guide/parameter/local.md

@ -6,11 +6,11 @@ Parameters configured on the task definition page, the scope of this parameter i
## Usage
* If you want to use parameter in single task, see [local parameter with custom parameter](#use-local-parameter-by-custom-parameter)
* If you want to use parameter in single task, see [local parameter with custom parameter](#use-local-parameter-by-custom-parameter).
* If you want to use set parameter in task and use them in downstream tasks:
* For simple use without using custom parameter, see [export parameter via `setValue`](#export-local-parameter-by-setvalue)
* Using custom parameter, see [export parameter via `setValue` and custom parameter](#export-local-parameter-by-setvalue-and-custom-parameter)
* Using bash variable, see [export parameter via `setValue` and bash variable](#export-local-parameter-by-setvalue-and-bash-variable)
* For simple use without using custom parameter, see [export parameter via `setValue`](#export-local-parameter-by-setvalue).
* Using custom parameter, see [export parameter via `setValue` and custom parameter](#export-local-parameter-by-setvalue-and-custom-parameter).
* Using bash variable, see [export parameter via `setValue` and bash variable](#export-local-parameter-by-setvalue-and-bash-variable).
Usage of local parameters is: at the task define page, click the '+' beside the 'Custom Parameters' and fill in the key and value to save.
@ -24,26 +24,24 @@ This example shows how to use local parameters to print the current date. Create
Parameters:
- dt: indicates the parameter name
- in: IN indicates that local parameters can only be used on the current node, and OUT indicates that local parameters can be transmitted to the downstream
- DATE: indicates the DATE of the data type
- $[YYYY-MM-DD] : indicates a built-in parameter derived from a user-defined format
- dt: indicates the parameter name.
- in: IN indicates that local parameters can only be used on the current node, and OUT indicates that local.parameters can be transmitted to the downstream.
- DATE: indicates the DATE of the data type.
- $[YYYY-MM-DD] : indicates a built-in parameter derived from a user-defined format.
Save the workflow and run it. View Shell task's log.
![local-parameter02](/img/new_ui/dev/parameter/local_parameter02.png)
> Note: The local parameter can be used in the workflow of the current task node. If it is set to OUT, it can be passed to the downstream workflow. Please refer to: [Parameter Context](context.md)
> Note: The local parameter can be used in the workflow of the current task node. If it is set to OUT, it can be passed to the downstream workflow. Please refer to: [Parameter Context](context.md).
### Export Local Parameter by `setValue`
If you want to simple export parameters and then use them in downstream tasks, you could use `setValue` in your task, which
you can manage your parameters into one single task. You can use syntax `echo '${setValue(set_val=123)}'`(**do not forget the
single quote**) in Shell task and add new `OUT` custom parameter to export it.
If you want to simple export parameters and then use them in downstream tasks, you could use `setValue` in your task. And you can manage your parameters into one single task. You can use syntax `echo '${setValue(set_val=123)}'`(**do not forget the single quote**) in Shell task and add new `OUT` custom parameter to export it.
![local-parameter-set-val](/img/new_ui/dev/parameter/local_param_set_val.png)
You could get this value in downstream task using syntax `echo '${set_val}'`.
You can get this value in downstream task using syntax `echo '${set_val}'`.
### Export Local Parameter by `setValue` and Custom Parameter

10
docs/docs/en/guide/parameter/priority.md

@ -2,11 +2,11 @@
DolphinScheduler has three parameter types:
* [Global Parameter](global.md): parameters defined at the workflow define page
* [Parameter Context](context.md): parameters passed by upstream task nodes
* [Global Parameter](global.md): parameters defined at the workflow define page.
* [Parameter Context](context.md): parameters passed by upstream task nodes.
* [Local Parameter](local.md): parameters belong to its node, which is the parameters defined by the user in [Custom Parameters]. The user can define part of the parameters when creating workflow definitions.
Due to there are multiple sources of the parameter value, there will raise parameter priority issues when the parameter name is the same. The priority of DolphinScheduler parameters from high to low is: `Local Parameter > Parameter Context > Global Parameter`
As there are multiple sources of the parameter value, it will raise parameter priority issues when the parameter name is the same. The priority of DolphinScheduler parameters from high to low is: `Local Parameter > Parameter Context > Global Parameter`.
In the case of upstream tasks can pass parameters to the downstream, there may be multiple tasks upstream that pass the same parameter name:
@ -15,7 +15,7 @@ In the case of upstream tasks can pass parameters to the downstream, there may b
## Example
Followings are examples shows task parameters priority problems:#############
Followings are examples showing task parameters priority problems:
1: Use shell nodes to explain the first case.
@ -35,6 +35,6 @@ The following shows the definition of the [use_create] node:
![priority-parameter04](/img/new_ui/dev/parameter/priority_parameter04.png)
"status" is the own parameters of the node set by the current node. However, the user also sets the "status" parameter (global parameter) when saving the process definition and assign its value to -1. Then the value of status will be 2 with higher priority when the SQL executes. The global parameter value is discarded.
"status" is own parameter of the node set by the current node. However, the user also sets the "status" parameter (global parameter) when saving the process definition and assign its value to -1. Then the value of status will be 2, with higher priority when the SQL executes. The global parameter value is discarded.
The "ID" here is the parameter set by the upstream node. The user sets the parameters of the same parameter name "ID" for the [createparam1] node and [createparam2] node. And the [use_create] node uses the value of [createParam1] which is finished first.

Loading…
Cancel
Save