qingwli commented on code in PR #14934:
URL: 
https://github.com/apache/dolphinscheduler/pull/14934#discussion_r1339795223


##########
docs/docs/zh/guide/parameter/context.md:
##########
@@ -115,3 +116,13 @@ Node_mysql 运行结果如下:
 
![context-subprocess05](../../../../img/new_ui/dev/parameter/context-subprocess05.png)
 
 虽然在 A 任务中输出 var1 和 var2 两个参数,但是工作流定义中只定义了 var1 的 OUT 变量,下游任务成功输出 var1,证明var1 
参数参照预期的值在该工作流中传递。
+
+#### Kubernetes 任务传递参数
+
+在Kubernetes 任务中不同的程序开发语言可能会采用不同的日志框架,DolphinScheduler 
为了兼容不同的日志框架,提供了一种通用的日志数据格式,即 `${(key=value)dsVal}`,用户可以在应用程序的终端日志中输出以格式为 
`${(key=value)dsVal}` 结束的日志数据,key 为对应参数的 prop,value 
为该参数的值。DolphinScheduler会捕捉输出日志中的 `${(key=value)dsVal}`来进行参数捕捉,从而传递到下游

Review Comment:
   ```suggestion
   
在Kubernetes任务中不同的程序开发语言可能会采用不同的日志框架,DolphinScheduler为了兼容不同的日志框架,提供了一种通用的日志数据格式,即
 `${(key=value)dsVal}`,用户可以在应用程序的终端日志中输出以格式为 `${(key=value)dsVal}` 结束的日志数据,key 
为对应参数的 prop,value 为该参数的值。DolphinScheduler会捕捉输出日志中的 
`${(key=value)dsVal}`来进行参数捕捉,从而传递到下游。
   ```



##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/VarPoolUtils.java:
##########
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.plugin.task.api.utils;
+
+import org.apache.dolphinscheduler.plugin.task.api.TaskConstants;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import lombok.experimental.UtilityClass;
+
+@UtilityClass
+public class VarPoolUtils {
+
+    static final Pattern DSVALUE_REGEX = 
Pattern.compile(TaskConstants.DSVALUE_REGEX);
+    public static final String VAR_SUFFIX = ")dsVal}";
+
+    public static final String VAR_DELIMITER = "$VarPool$";
+    /**
+     * find var pool
+     *
+     * @param line
+     * @return
+     */
+    public static String findVarPool(String line) {
+        Matcher matcher = DSVALUE_REGEX.matcher(line);
+        if (matcher.find()) {
+            return matcher.group(1);
+        }
+        return null;

Review Comment:
   How to deal with null value?



##########
docs/docs/en/guide/parameter/context.md:
##########
@@ -116,3 +117,13 @@ Save the workflow and run it. The result of the downstream 
task is as follows:
 
![context-subprocess05](../../../../img/new_ui/dev/parameter/context-subprocess05.png)
 
 Although the two parameters var1 and var2 are output in the A task, only the 
`OUT` parameter var1 is defined in the workflow definition, and the downstream 
task successfully outputs var1. It proves that the var1 parameter is passed in 
the workflow with reference to the expected value.
+
+#### Pass parameter from Kubernetes task to downstream
+
+Different programming languages may use different logging frameworks in 
Kubernetes tasks.  To be compatible with these frameworks, DolphinScheduler 
provides a universal logging data format `${(key=value)dsVal}`.  Users can 
output log data in the format `${(key=value)dsVal}` in the terminal logs of 
their applications, where `key` is the corresponding parameter prop and `value` 
is the value of that parameter.  DolphinScheduler will capture the 
`${(key=value)dsVal}` in the output logs to capture the parameters and pass 
them downstream.
+
+For example
+
+![kubernetes_context_param](../../../../img/new_ui/dev/parameter/k8s_context_param.png)
+
+Another special consideration, not always can DolphinScheduler collect pod 
logs, if user redirect log output stream, DolphinScheduler can not collect logs 
use and can not use output parameter, either.

Review Comment:
   ```suggestion
   Another special consideration, not always can DolphinScheduler collect pod 
logs, if the user redirects the log output stream, DolphinScheduler can not 
collect logs for use and can not use the output parameter, either.
   ```



##########
docs/docs/zh/guide/parameter/context.md:
##########
@@ -115,3 +116,13 @@ Node_mysql 运行结果如下:
 
![context-subprocess05](../../../../img/new_ui/dev/parameter/context-subprocess05.png)
 
 虽然在 A 任务中输出 var1 和 var2 两个参数,但是工作流定义中只定义了 var1 的 OUT 变量,下游任务成功输出 var1,证明var1 
参数参照预期的值在该工作流中传递。
+
+#### Kubernetes 任务传递参数
+
+在Kubernetes 任务中不同的程序开发语言可能会采用不同的日志框架,DolphinScheduler 
为了兼容不同的日志框架,提供了一种通用的日志数据格式,即 `${(key=value)dsVal}`,用户可以在应用程序的终端日志中输出以格式为 
`${(key=value)dsVal}` 结束的日志数据,key 为对应参数的 prop,value 
为该参数的值。DolphinScheduler会捕捉输出日志中的 `${(key=value)dsVal}`来进行参数捕捉,从而传递到下游

Review Comment:
   ```suggestion
   
在Kubernetes任务中不同的程序开发语言可能会采用不同的日志框架,DolphinScheduler为了兼容不同的日志框架,提供了一种通用的日志数据格式,即
 `${(key=value)dsVal}`,用户可以在应用程序的终端日志中输出以格式为 `${(key=value)dsVal}` 结束的日志数据,key 
为对应参数的 prop,value 为该参数的值。DolphinScheduler会捕捉输出日志中的 
`${(key=value)dsVal}`来进行参数捕捉,从而传递到下游。
   ```



##########
docs/docs/en/guide/parameter/context.md:
##########
@@ -116,3 +117,13 @@ Save the workflow and run it. The result of the downstream 
task is as follows:
 
![context-subprocess05](../../../../img/new_ui/dev/parameter/context-subprocess05.png)
 
 Although the two parameters var1 and var2 are output in the A task, only the 
`OUT` parameter var1 is defined in the workflow definition, and the downstream 
task successfully outputs var1. It proves that the var1 parameter is passed in 
the workflow with reference to the expected value.
+
+#### Pass parameter from Kubernetes task to downstream
+
+Different programming languages may use different logging frameworks in 
Kubernetes tasks.  To be compatible with these frameworks, DolphinScheduler 
provides a universal logging data format `${(key=value)dsVal}`.  Users can 
output log data in the format `${(key=value)dsVal}` in the terminal logs of 
their applications, where `key` is the corresponding parameter prop and `value` 
is the value of that parameter.  DolphinScheduler will capture the 
`${(key=value)dsVal}` in the output logs to capture the parameters and pass 
them downstream.

Review Comment:
   ```suggestion
   Different programming languages may use different logging frameworks in 
Kubernetes tasks. To be compatible with these frameworks, DolphinScheduler 
provides a universal logging data format `${(key=value)dsVal}`. Users can 
output log data in the format `${(key=value)dsVal}` in the terminal logs of 
their applications, where `key` is the corresponding parameter prop and `value` 
is the value of that parameter. DolphinScheduler will capture the 
`${(key=value)dsVal}` in the output logs to capture the parameters and pass 
them downstream.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to