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

zihaoxiang pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 82b501aa8e [Feature-16269][dinky-task]Supports dinky tasks to accept 
Prepare Params passed within a task or from a previous task (#15947)
82b501aa8e is described below

commit 82b501aa8e9af598342f7773186cef5e7f2b2e29
Author: gaoyan <[email protected]>
AuthorDate: Thu Jul 4 09:52:07 2024 +0800

    [Feature-16269][dinky-task]Supports dinky tasks to accept Prepare Params 
passed within a task or from a previous task (#15947)
    
    * fix dinky unresolve params
    
    * Supplement the Dinky documentation
---
 docs/docs/en/guide/task/dinky.md                   |  11 ++++++-----
 docs/docs/zh/guide/task/dinky.md                   |  11 ++++++-----
 docs/img/tasks/demo/dinky_task_id.png              | Bin 221254 -> 365529 bytes
 .../plugin/task/dinky/DinkyTask.java               |   8 +++++++-
 4 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/docs/docs/en/guide/task/dinky.md b/docs/docs/en/guide/task/dinky.md
index c229c42ded..b758fa8691 100644
--- a/docs/docs/en/guide/task/dinky.md
+++ b/docs/docs/en/guide/task/dinky.md
@@ -17,11 +17,12 @@ it will call `Dinky API` to trigger dinky task. Click 
[here](http://www.dlink.to
 
 - Please refer to [DolphinScheduler Task Parameters Appendix](appendix.md) 
`Default Task Parameters` section for default parameters.
 
-| **Parameter** |                                                              
                         **Description**                                        
                                                |
-|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| Dinky Address | The url for a dinky server.                                  
                                                                                
                                                |
-| Dinky Task ID | The unique task id for a dinky task.                         
                                                                                
                                                |
-| Online Task   | Specify whether the current dinky job is online. If yes, the 
submitted job can only be submitted successfully when it is published and there 
is no corresponding Flink job instance running. |
+|   **Parameter**   |                                                          
                                                          **Description**       
                                                                                
                              |
+|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| Dinky Address     | The URL for the Dinky service, e.g., 
http://localhost:8888.                                                          
                                                                                
                                                  |
+| Dinky Task ID     | The unique task id for a dinky task.                     
                                                                                
                                                                                
                              |
+| Online Task       | Specify whether the current dinky job is online. If yes, 
the submitted job can only be submitted successfully when it is published and 
there is no corresponding Flink job instance running.                           
                                |
+| Custom Parameters | Starting from Dinky 1.0, support for passing custom 
parameters is available. Currently, only `IN` type inputs are supported, with 
no support for `OUT` type outputs. Supports the `${param}` syntax for 
retrieving global or local dynamic parameters. |
 
 ## Task Example
 
diff --git a/docs/docs/zh/guide/task/dinky.md b/docs/docs/zh/guide/task/dinky.md
index cab9a24ce4..6b7ab3cc4b 100644
--- a/docs/docs/zh/guide/task/dinky.md
+++ b/docs/docs/zh/guide/task/dinky.md
@@ -17,11 +17,12 @@
 
 - 默认参数说明请参考[DolphinScheduler任务参数附录](appendix.md)`默认任务参数`一栏。
 
-|  **任务参数**   |                               **描述**                           
     |
-|-------------|---------------------------------------------------------------------|
-| Dinky 地址    | Dinky 服务的 url。                                                 
     |
-| Dinky 任务 ID | Dinky 作业对应的唯一ID。                                               
     |
-| 上线作业        | 指定当前 Dinky 作业是否上线,如果是,则该被提交的作业只能处于已发布且当前无对应的 Flink Job 
实例在运行才可提交成功。 |
+|  **任务参数**   |                                   **描述**                       
            |
+|-------------|----------------------------------------------------------------------------|
+| Dinky 地址    | Dinky 服务的 url,例如:`http://localhost:8888`。                      
            |
+| Dinky 任务 ID | Dinky 作业对应的唯一ID。                                               
            |
+| 上线作业        | 指定当前 Dinky 作业是否上线,如果是,则该被提交的作业只能处于已发布且当前无对应的 Flink Job 
实例在运行才可提交成功。        |
+| 自定义参数       | 从Dinky 
1.0开始支持传递自定义参数,目前仅支持`IN`类型输入,不支持`OUT`类型输出。支持`${param}`方式获取全局或局部动态参数 |
 
 ## Task Example
 
diff --git a/docs/img/tasks/demo/dinky_task_id.png 
b/docs/img/tasks/demo/dinky_task_id.png
index f1e791caad..b1ebb3ec03 100644
Binary files a/docs/img/tasks/demo/dinky_task_id.png and 
b/docs/img/tasks/demo/dinky_task_id.png differ
diff --git 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-dinky/src/main/java/org/apache/dolphinscheduler/plugin/task/dinky/DinkyTask.java
 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-dinky/src/main/java/org/apache/dolphinscheduler/plugin/task/dinky/DinkyTask.java
index 2c0b0cb68e..8f14e8518a 100644
--- 
a/dolphinscheduler-task-plugin/dolphinscheduler-task-dinky/src/main/java/org/apache/dolphinscheduler/plugin/task/dinky/DinkyTask.java
+++ 
b/dolphinscheduler-task-plugin/dolphinscheduler-task-dinky/src/main/java/org/apache/dolphinscheduler/plugin/task/dinky/DinkyTask.java
@@ -27,6 +27,8 @@ import 
org.apache.dolphinscheduler.plugin.task.api.TaskException;
 import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
 import org.apache.dolphinscheduler.plugin.task.api.model.Property;
 import 
org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters;
+import org.apache.dolphinscheduler.plugin.task.api.parser.PlaceholderUtils;
+import org.apache.dolphinscheduler.plugin.task.api.utils.ParameterUtils;
 
 import org.apache.commons.lang3.StringUtils;
 import org.apache.http.HttpResponse;
@@ -343,11 +345,15 @@ public class DinkyTask extends AbstractRemoteTask {
             }
         }
         List<Property> localParams = this.dinkyParameters.getLocalParams();
+        Map<String, Property> prepareParamsMap = 
taskExecutionContext.getPrepareParamsMap();
         if (localParams == null || localParams.isEmpty()) {
             return variables;
         }
+        Map<String, String> convertMap = 
ParameterUtils.convert(prepareParamsMap);
         for (Property property : localParams) {
-            variables.put(property.getProp(), property.getValue());
+            String propertyValue = property.getValue();
+            String value = PlaceholderUtils.replacePlaceholders(propertyValue, 
convertMap, true);
+            variables.put(property.getProp(), value);
         }
         return variables;
     }

Reply via email to