ruanwenjun commented on code in PR #17987:
URL:
https://github.com/apache/dolphinscheduler/pull/17987#discussion_r2845269485
##########
dolphinscheduler-task-plugin/dolphinscheduler-task-flink-stream/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkStreamTask.java:
##########
@@ -48,6 +52,20 @@ public FlinkStreamTask(TaskExecutionContext
taskExecutionContext) {
public void init() {
flinkParameters =
JSONUtils.parseObject(taskExecutionContext.getTaskParams(),
FlinkStreamParameters.class);
+ // Replace parameter placeholders (e.g. ${system.biz.date},
$[yyyyMMdd]) in init script and main script
+ if (flinkParameters != null) {
+ Map<String, Property> paramsMap =
taskExecutionContext.getPrepareParamsMap();
+ Map<String, String> stringParams =
ParameterUtils.convert(paramsMap);
+
+ if (StringUtils.isNotBlank(flinkParameters.getInitScript())) {
+ flinkParameters.setInitScript(
+
ParameterUtils.convertParameterPlaceholders(flinkParameters.getInitScript(),
stringParams));
+ }
+ if (StringUtils.isNotBlank(flinkParameters.getRawScript())) {
+ flinkParameters.setRawScript(
+
ParameterUtils.convertParameterPlaceholders(flinkParameters.getRawScript(),
stringParams));
+ }
+ }
Review Comment:
It's better move to line 74.
##########
dolphinscheduler-task-plugin/dolphinscheduler-task-flink/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkTask.java:
##########
@@ -57,6 +62,21 @@ public FlinkTask(TaskExecutionContext taskExecutionContext) {
public void init() {
flinkParameters =
JSONUtils.parseObject(taskExecutionContext.getTaskParams(),
FlinkParameters.class);
+ // Replace parameter placeholders (e.g. ${system.biz.date},
$[yyyyMMdd]) in init script and main script
+ if (flinkParameters != null) {
+ Map<String, Property> paramsMap =
taskExecutionContext.getPrepareParamsMap();
+ Map<String, String> stringParams =
ParameterUtils.convert(paramsMap);
+
+ if (StringUtils.isNotBlank(flinkParameters.getInitScript())) {
+ flinkParameters.setInitScript(
+
ParameterUtils.convertParameterPlaceholders(flinkParameters.getInitScript(),
stringParams));
+ }
+ if (StringUtils.isNotBlank(flinkParameters.getRawScript())) {
+ flinkParameters.setRawScript(
+
ParameterUtils.convertParameterPlaceholders(flinkParameters.getRawScript(),
stringParams));
+ }
+ }
Review Comment:
It's better move to line 85.
##########
dolphinscheduler-task-plugin/dolphinscheduler-task-flink/pom.xml:
##########
@@ -45,6 +45,22 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-junit-jupiter</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-inline</artifactId>
+ <scope>test</scope>
+ </dependency>
Review Comment:
This has already defined at root pom, do we still need to add here?
##########
dolphinscheduler-task-plugin/dolphinscheduler-task-flink-stream/pom.xml:
##########
@@ -51,6 +51,22 @@
<artifactId>dolphinscheduler-task-flink</artifactId>
<version>${project.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-junit-jupiter</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-inline</artifactId>
+ <scope>test</scope>
+ </dependency>
Review Comment:
This has already defined at root pom, do we still need to add here?
--
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]