Browse Source

[Feature][SPI] Task (#6044)

2.0.7-release
Kerwin 3 years ago committed by GitHub
parent
commit
22c5292b93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      README.md
  2. 4
      dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java
  3. 4
      dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactory.java
  4. 7
      dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelTest.java
  5. 4
      dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java
  6. 2
      dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java
  7. 2
      dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelTest.java
  8. 4
      dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java
  9. 2
      dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactory.java
  10. 4
      dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactory.java
  11. 6
      dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java
  12. 4
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml
  13. 4
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.xml
  14. 6
      dolphinscheduler-dist/src/main/provisio/dolphinscheduler.xml
  15. 1
      dolphinscheduler-server/pom.xml
  16. 32
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java
  17. 33
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/config/WorkerConfig.java
  18. 4
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/plugin/TaskPluginManager.java
  19. 8
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java
  20. 56
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskExecuteThread.java
  21. 14
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
  22. 8
      dolphinscheduler-server/src/main/resources/worker.properties
  23. 16
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/FormType.java
  24. 15
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/ParamsProps.java
  25. 12
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/PluginParams.java
  26. 32
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/ResizeType.java
  27. 87
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/checkbox/CheckboxParam.java
  28. 61
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/checkbox/CheckboxParamProps.java
  29. 104
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/fswitch/SwitchParam.java
  30. 156
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/fswitch/SwitchParamProps.java
  31. 58
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/input/InputParam.java
  32. 297
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/input/InputParamProps.java
  33. 104
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/inputNumber/InputNumberParam.java
  34. 130
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/inputNumber/InputNumberParamProps.java
  35. 69
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/radio/RadioParam.java
  36. 52
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/radio/RadioParamProps.java
  37. 127
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/select/SelectParam.java
  38. 239
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/select/SelectParamProps.java
  39. 2
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/TaskChannel.java
  40. 4
      dolphinscheduler-spi/src/test/java/org/apache/dolphinscheduler/spi/params/PluginParamsTransferTest.java
  41. 9
      dolphinscheduler-task-plugin/dolphinscheduler-task-api/pom.xml
  42. 5
      dolphinscheduler-task-plugin/dolphinscheduler-task-flink/pom.xml
  43. 6
      dolphinscheduler-task-plugin/dolphinscheduler-task-python/pom.xml
  44. 9
      dolphinscheduler-task-plugin/dolphinscheduler-task-shell/pom.xml
  45. 24
      dolphinscheduler-task-plugin/dolphinscheduler-task-shell/src/main/java/org/apache/dolphinscheduler/plugin/task/shell/ShellTaskChannelFactory.java
  46. 25
      dolphinscheduler-task-plugin/dolphinscheduler-task-shell/src/main/java/org/apache/dolphinscheduler/plugin/task/shell/ShellTaskConstants.java
  47. 6
      dolphinscheduler-task-plugin/dolphinscheduler-task-spark/pom.xml
  48. 19
      pom.xml

4
README.md

@ -80,7 +80,7 @@ dolphinscheduler-dist/target/apache-dolphinscheduler-${latest.release.version}-s
## Thanks
DolphinScheduler is based on a lot of excellent open-source projects, such as Google guava, guice, grpc, netty, ali bonecp, quartz, and many open-source projects of Apache and so on.
DolphinScheduler is based on a lot of excellent open-source projects, such as Google guava, guice, grpc, netty, quartz, and many open-source projects of Apache and so on.
We would like to express our deep gratitude to all the open-source projects used in Dolphin Scheduler. We hope that we are not only the beneficiaries of open-source, but also give back to the community. Besides, we hope everyone who have the same enthusiasm and passion for open source could join in and contribute to the open-source community!
## Get Help
@ -92,7 +92,7 @@ We would like to express our deep gratitude to all the open-source projects used
You are very welcome to communicate with the developers and users of Dolphin Scheduler. There are two ways to find them:
1. Join the Slack channel by [this invitation link](https://join.slack.com/t/asf-dolphinscheduler/shared_invite/zt-omtdhuio-_JISsxYhiVsltmC5h38yfw).
2. Follow the [Twitter account of Dolphin Scheduler](https://twitter.com/dolphinschedule) and get the latest news on time.
2. Follow the [Twitter account of DolphinScheduler](https://twitter.com/dolphinschedule) and get the latest news on time.
### Contributor over time

4
dolphinscheduler-alert-plugin/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java

@ -24,9 +24,9 @@ import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_YES;
import org.apache.dolphinscheduler.spi.alert.AlertChannel;
import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory;
import org.apache.dolphinscheduler.spi.params.InputParam;
import org.apache.dolphinscheduler.spi.params.input.InputParam;
import org.apache.dolphinscheduler.spi.params.PasswordParam;
import org.apache.dolphinscheduler.spi.params.RadioParam;
import org.apache.dolphinscheduler.spi.params.radio.RadioParam;
import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate;

4
dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelFactory.java

@ -26,9 +26,9 @@ import org.apache.dolphinscheduler.spi.alert.AlertChannel;
import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory;
import org.apache.dolphinscheduler.spi.alert.AlertConstants;
import org.apache.dolphinscheduler.spi.alert.ShowType;
import org.apache.dolphinscheduler.spi.params.InputParam;
import org.apache.dolphinscheduler.spi.params.input.InputParam;
import org.apache.dolphinscheduler.spi.params.PasswordParam;
import org.apache.dolphinscheduler.spi.params.RadioParam;
import org.apache.dolphinscheduler.spi.params.radio.RadioParam;
import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate;

7
dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/EmailAlertChannelTest.java

@ -22,11 +22,10 @@ import org.apache.dolphinscheduler.spi.alert.AlertData;
import org.apache.dolphinscheduler.spi.alert.AlertInfo;
import org.apache.dolphinscheduler.spi.alert.AlertResult;
import org.apache.dolphinscheduler.spi.alert.ShowType;
import org.apache.dolphinscheduler.spi.params.InputParam;
import org.apache.dolphinscheduler.spi.params.input.InputParam;
import org.apache.dolphinscheduler.spi.params.PasswordParam;
import org.apache.dolphinscheduler.spi.params.PluginParamsTransfer;
import org.apache.dolphinscheduler.spi.params.RadioParam;
import org.apache.dolphinscheduler.spi.params.base.DataType;
import org.apache.dolphinscheduler.spi.params.radio.RadioParam;
import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate;
@ -142,7 +141,7 @@ public class EmailAlertChannelTest {
emailShowTypeList.add(new ParamsOptions(ShowType.ATTACHMENT.getDescp(), ShowType.ATTACHMENT.getDescp(), false));
emailShowTypeList.add(new ParamsOptions(ShowType.TABLEATTACHMENT.getDescp(), ShowType.TABLEATTACHMENT.getDescp(), false));
RadioParam showType = RadioParam.newBuilder(AlertConstants.SHOW_TYPE, "showType")
.setParamsOptionsList(emailShowTypeList)
.setOptions(emailShowTypeList)
.setValue(ShowType.TABLE.getDescp())
.addValidate(Validate.newBuilder().setRequired(true).build())
.build();

4
dolphinscheduler-alert-plugin/dolphinscheduler-alert-feishu/src/main/java/org/apache/dolphinscheduler/plugin/alert/feishu/FeiShuAlertChannelFactory.java

@ -24,9 +24,9 @@ import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_YES;
import org.apache.dolphinscheduler.spi.alert.AlertChannel;
import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory;
import org.apache.dolphinscheduler.spi.params.InputParam;
import org.apache.dolphinscheduler.spi.params.input.InputParam;
import org.apache.dolphinscheduler.spi.params.PasswordParam;
import org.apache.dolphinscheduler.spi.params.RadioParam;
import org.apache.dolphinscheduler.spi.params.radio.RadioParam;
import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate;

2
dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/main/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelFactory.java

@ -19,7 +19,7 @@ package org.apache.dolphinscheduler.plugin.alert.http;
import org.apache.dolphinscheduler.spi.alert.AlertChannel;
import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory;
import org.apache.dolphinscheduler.spi.params.InputParam;
import org.apache.dolphinscheduler.spi.params.input.InputParam;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate;

2
dolphinscheduler-alert-plugin/dolphinscheduler-alert-http/src/test/java/org/apache/dolphinscheduler/plugin/alert/http/HttpAlertChannelTest.java

@ -20,7 +20,7 @@ package org.apache.dolphinscheduler.plugin.alert.http;
import org.apache.dolphinscheduler.spi.alert.AlertData;
import org.apache.dolphinscheduler.spi.alert.AlertInfo;
import org.apache.dolphinscheduler.spi.alert.AlertResult;
import org.apache.dolphinscheduler.spi.params.InputParam;
import org.apache.dolphinscheduler.spi.params.input.InputParam;
import org.apache.dolphinscheduler.spi.params.PluginParamsTransfer;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate;

4
dolphinscheduler-alert-plugin/dolphinscheduler-alert-script/src/main/java/org/apache/dolphinscheduler/plugin/alert/script/ScriptAlertChannelFactory.java

@ -19,8 +19,8 @@ package org.apache.dolphinscheduler.plugin.alert.script;
import org.apache.dolphinscheduler.spi.alert.AlertChannel;
import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory;
import org.apache.dolphinscheduler.spi.params.InputParam;
import org.apache.dolphinscheduler.spi.params.RadioParam;
import org.apache.dolphinscheduler.spi.params.input.InputParam;
import org.apache.dolphinscheduler.spi.params.radio.RadioParam;
import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate;

2
dolphinscheduler-alert-plugin/dolphinscheduler-alert-slack/src/main/java/org/apache/dolphinscheduler/plugin/alert/slack/SlackAlertChannelFactory.java

@ -19,7 +19,7 @@ package org.apache.dolphinscheduler.plugin.alert.slack;
import org.apache.dolphinscheduler.spi.alert.AlertChannel;
import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory;
import org.apache.dolphinscheduler.spi.params.InputParam;
import org.apache.dolphinscheduler.spi.params.input.InputParam;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate;

4
dolphinscheduler-alert-plugin/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactory.java

@ -21,8 +21,8 @@ import org.apache.dolphinscheduler.spi.alert.AlertChannel;
import org.apache.dolphinscheduler.spi.alert.AlertChannelFactory;
import org.apache.dolphinscheduler.spi.alert.AlertConstants;
import org.apache.dolphinscheduler.spi.alert.ShowType;
import org.apache.dolphinscheduler.spi.params.InputParam;
import org.apache.dolphinscheduler.spi.params.RadioParam;
import org.apache.dolphinscheduler.spi.params.input.InputParam;
import org.apache.dolphinscheduler.spi.params.radio.RadioParam;
import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate;

6
dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java

@ -32,10 +32,10 @@ import org.apache.dolphinscheduler.dao.entity.AlertPluginInstance;
import org.apache.dolphinscheduler.dao.entity.PluginDefine;
import org.apache.dolphinscheduler.spi.alert.AlertConstants;
import org.apache.dolphinscheduler.spi.alert.ShowType;
import org.apache.dolphinscheduler.spi.params.InputParam;
import org.apache.dolphinscheduler.spi.params.input.InputParam;
import org.apache.dolphinscheduler.spi.params.PasswordParam;
import org.apache.dolphinscheduler.spi.params.PluginParamsTransfer;
import org.apache.dolphinscheduler.spi.params.RadioParam;
import org.apache.dolphinscheduler.spi.params.radio.RadioParam;
import org.apache.dolphinscheduler.spi.params.base.DataType;
import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
@ -217,7 +217,7 @@ public class EmailAlertPluginTest {
emailShowTypeList.add(new ParamsOptions(ShowType.ATTACHMENT.getDescp(), ShowType.ATTACHMENT.getDescp(), false));
emailShowTypeList.add(new ParamsOptions(ShowType.TABLEATTACHMENT.getDescp(), ShowType.TABLEATTACHMENT.getDescp(), false));
RadioParam showType = RadioParam.newBuilder(AlertConstants.SHOW_TYPE, "showType")
.setParamsOptionsList(emailShowTypeList)
.setOptions(emailShowTypeList)
.setValue(ShowType.TABLE.getDescp())
.addValidate(Validate.newBuilder().setRequired(true).build())
.build();

4
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml

@ -80,7 +80,9 @@
left join t_ds_user tu on td.user_id = tu.id
where td.project_code = #{projectCode}
<if test=" searchVal != null and searchVal != ''">
and td.name like concat('%', #{searchVal}, '%')
AND (td.name like concat('%', #{searchVal}, '%')
OR td.description like concat('%', #{searchVal}, '%')
)
</if>
<if test=" userId != 0">
and td.user_id = #{userId}

4
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.xml

@ -88,7 +88,9 @@
)
</if>
<if test="searchName!=null and searchName != ''">
and p.name like concat('%', #{searchName}, '%')
AND (p.name LIKE concat('%', #{searchName}, '%')
OR p.description LIKE concat('%', #{searchName}, '%')
)
</if>
order by p.create_time desc
</select>

6
dolphinscheduler-dist/src/main/provisio/dolphinscheduler.xml vendored

@ -74,4 +74,10 @@
<unpack/>
</artifact>
</artifactSet>
<!-- Task Plugins -->
<artifactSet to="lib/plugin/task/shell">
<artifact id="${project.groupId}:dolphinscheduler-task-shell:zip:${project.version}">
<unpack/>
</artifact>
</artifactSet>
</runtime>

1
dolphinscheduler-server/pom.xml

@ -86,6 +86,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

32
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java

@ -17,14 +17,17 @@
package org.apache.dolphinscheduler.server.worker;
import com.google.common.collect.ImmutableList;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.IStoppable;
import org.apache.dolphinscheduler.common.enums.NodeType;
import org.apache.dolphinscheduler.common.thread.Stopper;
import org.apache.dolphinscheduler.common.utils.PropertyUtils;
import org.apache.dolphinscheduler.remote.NettyRemotingServer;
import org.apache.dolphinscheduler.remote.command.CommandType;
import org.apache.dolphinscheduler.remote.config.NettyServerConfig;
import org.apache.dolphinscheduler.server.worker.config.WorkerConfig;
import org.apache.dolphinscheduler.server.worker.plugin.TaskPluginManager;
import org.apache.dolphinscheduler.server.worker.processor.DBTaskAckProcessor;
import org.apache.dolphinscheduler.server.worker.processor.DBTaskResponseProcessor;
import org.apache.dolphinscheduler.server.worker.processor.TaskExecuteProcessor;
@ -39,6 +42,9 @@ import java.util.Set;
import javax.annotation.PostConstruct;
import org.apache.dolphinscheduler.spi.plugin.DolphinPluginLoader;
import org.apache.dolphinscheduler.spi.plugin.DolphinPluginManagerConfig;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -101,6 +107,8 @@ public class WorkerServer implements IStoppable {
@Autowired
private WorkerManagerThread workerManagerThread;
private TaskPluginManager taskPluginManager;
/**
* worker server startup, not use web service
*
@ -119,11 +127,13 @@ public class WorkerServer implements IStoppable {
// alert-server client registry
alertClientService = new AlertClientService(workerConfig.getAlertListenHost(), Constants.ALERT_RPC_PORT);
// init task plugin
initTaskPlugin();
// init remoting server
NettyServerConfig serverConfig = new NettyServerConfig();
serverConfig.setListenPort(workerConfig.getListenPort());
this.nettyRemotingServer = new NettyRemotingServer(serverConfig);
this.nettyRemotingServer.registerProcessor(CommandType.TASK_EXECUTE_REQUEST, new TaskExecuteProcessor(alertClientService));
this.nettyRemotingServer.registerProcessor(CommandType.TASK_EXECUTE_REQUEST, new TaskExecuteProcessor(alertClientService, taskPluginManager));
this.nettyRemotingServer.registerProcessor(CommandType.TASK_KILL_REQUEST, new TaskKillProcessor());
this.nettyRemotingServer.registerProcessor(CommandType.DB_TASK_ACK, new DBTaskAckProcessor());
this.nettyRemotingServer.registerProcessor(CommandType.DB_TASK_RESPONSE, new DBTaskResponseProcessor());
@ -157,6 +167,26 @@ public class WorkerServer implements IStoppable {
}));
}
private void initTaskPlugin() {
taskPluginManager = new TaskPluginManager();
DolphinPluginManagerConfig taskPluginManagerConfig = new DolphinPluginManagerConfig();
taskPluginManagerConfig.setPlugins(workerConfig.getTaskPluginBinding());
if (StringUtils.isNotBlank(workerConfig.getTaskPluginDir())) {
taskPluginManagerConfig.setInstalledPluginsDir(workerConfig.getTaskPluginDir().trim());
}
if (StringUtils.isNotBlank(workerConfig.getMavenLocalRepository())) {
taskPluginManagerConfig.setMavenLocalRepository(workerConfig.getMavenLocalRepository().trim());
}
DolphinPluginLoader alertPluginLoader = new DolphinPluginLoader(taskPluginManagerConfig, ImmutableList.of(taskPluginManager));
try {
alertPluginLoader.loadPlugins();
} catch (Exception e) {
throw new RuntimeException("Load Task Plugin Failed !", e);
}
}
public void close(String cause) {
try {

33
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/config/WorkerConfig.java

@ -56,6 +56,15 @@ public class WorkerConfig {
@Value("${alert.listen.host:localhost}")
private String alertListenHost;
@Value("${task.plugin.dir:}")
private String taskPluginDir;
@Value("${maven.local.repository:}")
private String mavenLocalRepository;
@Value("${task.plugin.binding:}")
private String taskPluginBinding;
public int getListenPort() {
return listenPort;
}
@ -130,4 +139,28 @@ public class WorkerConfig {
public void setAlertListenHost(String alertListenHost) {
this.alertListenHost = alertListenHost;
}
public String getTaskPluginDir() {
return taskPluginDir;
}
public void setTaskPluginDir(String taskPluginDir) {
this.taskPluginDir = taskPluginDir;
}
public String getMavenLocalRepository() {
return mavenLocalRepository;
}
public void setMavenLocalRepository(String mavenLocalRepository) {
this.mavenLocalRepository = mavenLocalRepository;
}
public String getTaskPluginBinding() {
return taskPluginBinding;
}
public void setTaskPluginBinding(String taskPluginBinding) {
this.taskPluginBinding = taskPluginBinding;
}
}

4
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/plugin/TaskPluginManager.java

@ -83,6 +83,10 @@ public class TaskPluginManager extends AbstractDolphinPluginManager {
private PluginDao pluginDao = DaoFactory.getDaoInstance(PluginDao.class);
public Map<String, TaskChannel> getTaskChannelMap() {
return taskChannelMap;
}
@Override
public void installPlugin(DolphinSchedulerPlugin dolphinSchedulerPlugin) {
for (TaskChannelFactory taskChannelFactory : dolphinSchedulerPlugin.getTaskChannelFactorys()) {

8
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java

@ -39,6 +39,7 @@ import org.apache.dolphinscheduler.server.worker.cache.ResponceCache;
import org.apache.dolphinscheduler.server.worker.cache.TaskExecutionContextCacheManager;
import org.apache.dolphinscheduler.server.worker.cache.impl.TaskExecutionContextCacheManagerImpl;
import org.apache.dolphinscheduler.server.worker.config.WorkerConfig;
import org.apache.dolphinscheduler.server.worker.plugin.TaskPluginManager;
import org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread;
import org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread;
import org.apache.dolphinscheduler.service.alert.AlertClientService;
@ -74,6 +75,8 @@ public class TaskExecuteProcessor implements NettyRequestProcessor {
*/
private AlertClientService alertClientService;
private TaskPluginManager taskPluginManager;
/**
* taskExecutionContextCacheManager
*/
@ -102,9 +105,10 @@ public class TaskExecuteProcessor implements NettyRequestProcessor {
taskExecutionContextCacheManager.cacheTaskExecutionContext(preTaskCache);
}
public TaskExecuteProcessor(AlertClientService alertClientService) {
public TaskExecuteProcessor(AlertClientService alertClientService, TaskPluginManager taskPluginManager) {
this();
this.alertClientService = alertClientService;
this.taskPluginManager = taskPluginManager;
}
@Override
@ -177,7 +181,7 @@ public class TaskExecuteProcessor implements NettyRequestProcessor {
this.doAck(taskExecutionContext);
// submit task to manager
if (!workerManager.offer(new TaskExecuteThread(taskExecutionContext, taskCallbackService, taskLogger, alertClientService))) {
if (!workerManager.offer(new TaskExecuteThread(taskExecutionContext, taskCallbackService, taskLogger, alertClientService, taskPluginManager))) {
logger.info("submit task to manager error, queue is full, queue size is {}", workerManager.getQueueSize());
}
}

56
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskExecuteThread.java

@ -35,8 +35,8 @@ import org.apache.dolphinscheduler.server.entity.TaskExecutionContext;
import org.apache.dolphinscheduler.server.worker.cache.ResponceCache;
import org.apache.dolphinscheduler.server.worker.cache.TaskExecutionContextCacheManager;
import org.apache.dolphinscheduler.server.worker.cache.impl.TaskExecutionContextCacheManagerImpl;
import org.apache.dolphinscheduler.server.worker.plugin.TaskPluginManager;
import org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService;
import org.apache.dolphinscheduler.server.worker.task.AbstractTask;
import org.apache.dolphinscheduler.server.worker.task.TaskManager;
import org.apache.dolphinscheduler.service.alert.AlertClientService;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
@ -55,6 +55,9 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.apache.dolphinscheduler.spi.task.AbstractTask;
import org.apache.dolphinscheduler.spi.task.TaskChannel;
import org.apache.dolphinscheduler.spi.task.TaskRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -100,19 +103,35 @@ public class TaskExecuteThread implements Runnable, Delayed {
*/
private AlertClientService alertClientService;
private TaskPluginManager taskPluginManager;
/**
* constructor
* @param taskExecutionContext taskExecutionContext
* @param taskCallbackService taskCallbackService
*/
public TaskExecuteThread(TaskExecutionContext taskExecutionContext
, TaskCallbackService taskCallbackService
, Logger taskLogger, AlertClientService alertClientService) {
public TaskExecuteThread(TaskExecutionContext taskExecutionContext,
TaskCallbackService taskCallbackService,
Logger taskLogger,
AlertClientService alertClientService) {
this.taskExecutionContext = taskExecutionContext;
this.taskCallbackService = taskCallbackService;
this.taskExecutionContextCacheManager = SpringApplicationContext.getBean(TaskExecutionContextCacheManagerImpl.class);
this.taskLogger = taskLogger;
this.alertClientService = alertClientService;
}
public TaskExecuteThread(TaskExecutionContext taskExecutionContext,
TaskCallbackService taskCallbackService,
Logger taskLogger,
AlertClientService alertClientService,
TaskPluginManager taskPluginManager) {
this.taskExecutionContext = taskExecutionContext;
this.taskCallbackService = taskCallbackService;
this.taskExecutionContextCacheManager = SpringApplicationContext.getBean(TaskExecutionContextCacheManagerImpl.class);
this.taskLogger = taskLogger;
this.alertClientService = alertClientService;
this.taskPluginManager = taskPluginManager;
}
@Override
@ -150,24 +169,31 @@ public class TaskExecuteThread implements Runnable, Delayed {
taskExecutionContext.getProcessInstanceId(),
taskExecutionContext.getTaskInstanceId()));
task = TaskManager.newTask(taskExecutionContext, taskLogger, alertClientService);
TaskChannel taskChannel = taskPluginManager.getTaskChannelMap().get(taskExecutionContext.getTaskType());
//TODO Temporary operation, To be adjusted
TaskRequest taskRequest = JSONUtils.parseObject(JSONUtils.toJsonString(taskExecutionContext), TaskRequest.class);
task = taskChannel.createTask(taskRequest, taskLogger);
// task init
task.init();
this.task.init();
//init varPool
task.getParameters().setVarPool(taskExecutionContext.getVarPool());
//TODO Temporary operation, To be adjusted
// this.task.getParameters().setVarPool(taskExecutionContext.getVarPool());
// task handle
task.handle();
this.task.handle();
// task result process
task.after();
this.task.after();
responseCommand.setStatus(task.getExitStatus().getCode());
responseCommand.setStatus(this.task.getExitStatus().getCode());
responseCommand.setEndTime(new Date());
responseCommand.setProcessId(task.getProcessId());
responseCommand.setAppIds(task.getAppIds());
responseCommand.setVarPool(JSONUtils.toJsonString(task.getParameters().getVarPool()));
logger.info("task instance id : {},task final status : {}", taskExecutionContext.getTaskInstanceId(), task.getExitStatus());
} catch (Exception e) {
responseCommand.setProcessId(this.task.getProcessId());
responseCommand.setAppIds(this.task.getAppIds());
//TODO Temporary operation, To be adjusted
// responseCommand.setVarPool(JSONUtils.toJsonString(this.task.getParameters().getVarPool()));
logger.info("task instance id : {},task final status : {}", taskExecutionContext.getTaskInstanceId(), this.task.getExitStatus());
} catch (Throwable e) {
e.printStackTrace();
logger.error("task scheduler failure", e);
kill();
responseCommand.setStatus(ExecutionStatus.FAILURE.getCode());

14
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java

@ -42,6 +42,8 @@ import org.apache.dolphinscheduler.server.worker.task.AbstractTask;
import org.apache.dolphinscheduler.service.alert.AlertClientService;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import org.apache.commons.collections.MapUtils;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@ -271,11 +273,11 @@ public class SqlTask extends AbstractTask {
public String setNonQuerySqlReturn(String updateResult, List<Property> properties) {
String result = null;
for (Property info :properties) {
for (Property info : properties) {
if (Direct.OUT == info.getDirect()) {
List<Map<String,String>> updateRL = new ArrayList<>();
Map<String,String> updateRM = new HashMap<>();
updateRM.put(info.getProp(),updateResult);
List<Map<String, String>> updateRL = new ArrayList<>();
Map<String, String> updateRM = new HashMap<>();
updateRM.put(info.getProp(), updateResult);
updateRL.add(updateRM);
result = JSONUtils.toJsonString(updateRL);
break;
@ -490,6 +492,10 @@ public class SqlTask extends AbstractTask {
public void printReplacedSql(String content, String formatSql, String rgex, Map<Integer, Property> sqlParamsMap) {
//parameter print style
logger.info("after replace sql , preparing : {}", formatSql);
if (MapUtils.isEmpty(sqlParamsMap)) {
logger.info("sqlParamsMap should not be Empty");
return;
}
StringBuilder logPrint = new StringBuilder("replaced sql , parameters:");
if (sqlParamsMap == null) {
logger.info("printReplacedSql: sqlParamsMap is null.");

8
dolphinscheduler-server/src/main/resources/worker.properties

@ -41,3 +41,11 @@
# alert server listen host
#alert.listen.host=localhost
#alert.plugin.dir config the Alert Plugin dir . AlertServer while find and load the Alert Plugin Jar from this dir when deploy and start AlertServer on the server .
#task.plugin.dir=lib/plugin/task
#maven.local.repository=/Users/localRepository
#task.plugin.binding config the task plugin need be load when development and run in IDE
#task.plugin.binding=./dolphinscheduler-task-plugin/dolphinscheduler-task-shell/pom.xml

16
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/FormType.java

@ -22,8 +22,20 @@ import com.fasterxml.jackson.annotation.JsonValue;
public enum FormType {
INPUT("input"),
RADIO("radio");
INPUTNUMBER("inputNumber"),
RADIO("radio"),
SELECT("select"),
SWITCH("switch"),
CHECKBOX("checkbox"),
TIMEPICKER("timePicker"),
DATEPICKER("datePicker"),
SLIDER("slider"),
RATE("rate"),
COLORPICKER("colorPicker"),
CASCADER("cascader"),
UPLOAD("upload"),
ELTRANSFER("el-transfer"),
TREE("tree");
private String formType;

15
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/ParamsProps.java

@ -26,8 +26,16 @@ public class ParamsProps {
private String placeholder;
/**
* input box size, optional value medium/small/mini
*/
private String size = "small";
/**
* whether to disable, the default value is false
*/
private Boolean disabled;
public void setSize(String size) {
this.size = size;
}
@ -47,4 +55,11 @@ public class ParamsProps {
return this;
}
public Boolean getDisabled() {
return disabled;
}
public void setDisabled(Boolean disabled) {
this.disabled = disabled;
}
}

12
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/PluginParams.java

@ -81,12 +81,12 @@ public class PluginParams {
/**
* whether to hide, the default value is false
*/
protected boolean hidden;
protected Boolean hidden;
/**
* whether to display, the default value is true
*/
protected boolean display;
protected Boolean display;
protected PluginParams(Builder builder) {
@ -132,9 +132,9 @@ public class PluginParams {
protected List<Validate> validateList;
protected boolean hidden;
protected Boolean hidden;
protected boolean display;
protected Boolean display;
public Builder(String name,
FormType formType,
@ -158,8 +158,8 @@ public class PluginParams {
@JsonProperty("name") String fieldName,
@JsonProperty("validate") List<Validate> validateList,
@JsonProperty("info") String info,
@JsonProperty("hidden") boolean hidden,
@JsonProperty("display") boolean display
@JsonProperty("hidden") Boolean hidden,
@JsonProperty("display") Boolean display
) {
requireNonNull(name, "name is null");
requireNonNull(formType, "formType is null");

32
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/base/ResizeType.java

@ -0,0 +1,32 @@
/*
* 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.spi.params.base;
public enum ResizeType {
NONE("none"),
BOTH("both"),
HORIZONTAL("horizontal"),
VERTICAL("vertical");
private String value;
ResizeType(String value) {
this.value = value;
}
}

87
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/checkbox/CheckboxParam.java

@ -0,0 +1,87 @@
package org.apache.dolphinscheduler.spi.params.checkbox;
import static org.apache.dolphinscheduler.spi.params.base.FormType.CHECKBOX;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate;
import java.util.ArrayList;
import java.util.List;
/**
* front-end checkbox component
*/
public class CheckboxParam extends PluginParams {
private CheckboxParam(Builder builder) {
super(builder);
}
private CheckboxParamProps props;
public static Builder newBuilder(String name, String title) {
return new Builder(name, title);
}
public static class Builder extends PluginParams.Builder {
public Builder(String name, String title) {
super(name, CHECKBOX, title);
}
private CheckboxParamProps props;
public Builder setProps(CheckboxParamProps props) {
this.props = props;
return this;
}
public Builder setName(String name) {
this.name = name;
return this;
}
public Builder setTitle(String title) {
this.title = title;
return this;
}
public Builder setInfo(String info) {
this.info = info;
return this;
}
public Builder setValue(Object value) {
this.value = value;
return this;
}
public Builder setValidateList(List<Validate> validateList) {
this.validateList = validateList;
return this;
}
public Builder addValidate(Validate validate) {
if (this.validateList == null) {
this.validateList = new ArrayList<>();
}
this.validateList.add(validate);
return this;
}
public Builder setHidden(Boolean hidden) {
this.hidden = hidden;
return this;
}
public Builder setDisplay(Boolean display) {
this.display = display;
return this;
}
}
@Override
public CheckboxParamProps getProps() {
return props;
}
}

61
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/checkbox/CheckboxParamProps.java

@ -0,0 +1,61 @@
package org.apache.dolphinscheduler.spi.params.checkbox;
import org.apache.dolphinscheduler.spi.params.base.ParamsProps;
/**
* front-end checkbox component props attributes
*/
public class CheckboxParamProps extends ParamsProps {
/**
* the minimum number of checkboxes that can be checked
*/
private Integer min;
/**
* the maximum number of checkboxes that can be checked
*/
private Integer max;
/**
* the color of the text when the Checkbox in the form of a button is activated
*/
private String textColor;
/**
* the fill color and border color of the Checkbox in the form of a button when activated
*/
private String fill;
public Integer getMin() {
return min;
}
public void setMin(Integer min) {
this.min = min;
}
public Integer getMax() {
return max;
}
public void setMax(Integer max) {
this.max = max;
}
public String getTextColor() {
return textColor;
}
public void setTextColor(String textColor) {
this.textColor = textColor;
}
public String getFill() {
return fill;
}
public void setFill(String fill) {
this.fill = fill;
}
}

104
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/fswitch/SwitchParam.java

@ -0,0 +1,104 @@
/*
* 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.spi.params.fswitch;
import static org.apache.dolphinscheduler.spi.params.base.FormType.SWITCH;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate;
import java.util.ArrayList;
import java.util.List;
/**
* front-end switch component
*/
public class SwitchParam extends PluginParams {
private SwitchParam(Builder builder) {
super(builder);
}
private SwitchParamProps props;
public static Builder newBuilder(String name, String title) {
return new Builder(name, title);
}
public static class Builder extends PluginParams.Builder {
public Builder(String name, String title) {
super(name, SWITCH, title);
}
private SwitchParamProps props;
public Builder setProps(SwitchParamProps props) {
this.props = props;
return this;
}
public Builder setName(String name) {
this.name = name;
return this;
}
public Builder setTitle(String title) {
this.title = title;
return this;
}
public Builder setInfo(String info) {
this.info = info;
return this;
}
public Builder setValue(Object value) {
this.value = value;
return this;
}
public Builder setValidateList(List<Validate> validateList) {
this.validateList = validateList;
return this;
}
public Builder addValidate(Validate validate) {
if (this.validateList == null) {
this.validateList = new ArrayList<>();
}
this.validateList.add(validate);
return this;
}
public Builder setHidden(Boolean hidden) {
this.hidden = hidden;
return this;
}
public Builder setDisplay(Boolean display) {
this.display = display;
return this;
}
}
@Override
public SwitchParamProps getProps() {
return props;
}
}

156
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/fswitch/SwitchParamProps.java

@ -0,0 +1,156 @@
/*
* 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.spi.params.fswitch;
import org.apache.dolphinscheduler.spi.params.base.ParamsProps;
/**
* front-end switch component props attributes
*/
public class SwitchParamProps extends ParamsProps {
/**
* the width of the switch (pixels)
*/
private Integer width;
/**
* the class name of the icon displayed when the switch is turned on, setting this option will ignore active-text
*/
private String activeIconClass;
/**
* the class name of the icon displayed when the switch is closed, setting this option will ignore inactive-text
*/
private String inactiveIconClass;
/**
* text description when switch is turned on
*/
private String activeText;
/**
* text description when switch is closed
*/
private String inactiveText;
/**
* value when switch is turned on
*/
private Object activeValue;
/**
* value when the switch is closed
*/
private Object inactiveValue;
/**
* the background color when the switch is turned on
*/
private String activeColor;
/**
* the background color when the switch is closed
*/
private String inactiveColor;
/**
* name attribute
*/
private String name;
public Integer getWidth() {
return width;
}
public void setWidth(Integer width) {
this.width = width;
}
public String getActiveIconClass() {
return activeIconClass;
}
public void setActiveIconClass(String activeIconClass) {
this.activeIconClass = activeIconClass;
}
public String getInactiveIconClass() {
return inactiveIconClass;
}
public void setInactiveIconClass(String inactiveIconClass) {
this.inactiveIconClass = inactiveIconClass;
}
public String getActiveText() {
return activeText;
}
public void setActiveText(String activeText) {
this.activeText = activeText;
}
public String getInactiveText() {
return inactiveText;
}
public void setInactiveText(String inactiveText) {
this.inactiveText = inactiveText;
}
public Object getActiveValue() {
return activeValue;
}
public void setActiveValue(Object activeValue) {
this.activeValue = activeValue;
}
public Object getInactiveValue() {
return inactiveValue;
}
public void setInactiveValue(Object inactiveValue) {
this.inactiveValue = inactiveValue;
}
public String getActiveColor() {
return activeColor;
}
public void setActiveColor(String activeColor) {
this.activeColor = activeColor;
}
public String getInactiveColor() {
return inactiveColor;
}
public void setInactiveColor(String inactiveColor) {
this.inactiveColor = inactiveColor;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

58
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/InputParam.java → dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/input/InputParam.java

@ -15,10 +15,10 @@
* limitations under the License.
*/
package org.apache.dolphinscheduler.spi.params;
package org.apache.dolphinscheduler.spi.params.input;
import static org.apache.dolphinscheduler.spi.params.base.FormType.INPUT;
import org.apache.dolphinscheduler.spi.params.base.FormType;
import org.apache.dolphinscheduler.spi.params.base.ParamsProps;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate;
@ -34,6 +34,8 @@ public class InputParam extends PluginParams {
super(builder);
}
private InputParamProps props;
public static Builder newBuilder(String name, String title) {
return new Builder(name, title);
}
@ -41,23 +43,22 @@ public class InputParam extends PluginParams {
public static class Builder extends PluginParams.Builder {
public Builder(String name, String title) {
super(name, FormType.INPUT, title);
super(name, INPUT, title);
}
public Builder setPlaceholder(String placeholder) {
if (this.props == null) {
this.setProps(new ParamsProps());
}
private InputParamProps props;
this.props.setPlaceholder(placeholder);
public Builder setProps(InputParamProps props) {
this.props = props;
return this;
}
public Builder addValidate(Validate validate) {
if (this.validateList == null) {
this.validateList = new ArrayList<>();
public Builder setPlaceholder(String placeholder) {
if (this.props == null) {
this.setProps(new InputParamProps());
}
this.validateList.add(validate);
this.props.setPlaceholder(placeholder);
return this;
}
@ -66,13 +67,13 @@ public class InputParam extends PluginParams {
return this;
}
public Builder setProps(ParamsProps props) {
this.props = props;
public Builder setTitle(String title) {
this.title = title;
return this;
}
public Builder setTitle(String title) {
this.title = title;
public Builder setInfo(String info) {
this.info = info;
return this;
}
@ -86,9 +87,32 @@ public class InputParam extends PluginParams {
return this;
}
public Builder addValidate(Validate validate) {
if (this.validateList == null) {
this.validateList = new ArrayList<>();
}
this.validateList.add(validate);
return this;
}
public Builder setHidden(Boolean hidden) {
this.hidden = hidden;
return this;
}
public Builder setDisplay(Boolean display) {
this.display = display;
return this;
}
@Override
public InputParam build() {
return new InputParam(this);
}
}
@Override
public InputParamProps getProps() {
return props;
}
}

297
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/input/InputParamProps.java

@ -0,0 +1,297 @@
/*
* 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.spi.params.input;
import org.apache.dolphinscheduler.spi.params.base.ParamsProps;
import org.apache.dolphinscheduler.spi.params.base.ResizeType;
/**
* front-end input component props attributes
*/
public class InputParamProps extends ParamsProps {
/**
* input type
*/
private String type;
/**
* maximum input length
*/
private Integer maxlength;
/**
* minimum input length
*/
private Integer minlength;
/**
* whether it can be cleared, the default value is false
*/
private Boolean clearable;
/**
* input box head icon
*/
private String prefixIcon;
/**
* input box end icon
*/
private String suffixIcon;
/**
* number of lines in the input box, only valid for type="textarea"
*/
private Integer rows;
/**
* adaptive content height, only valid for type="textarea", objects can be passed in, such as {minRows: 2, maxRows: 6}
*/
private Object autosize;
/**
* autocomplete attribute:on, off
*/
private String autocomplete;
/**
* name attribute
*/
private String name;
/**
* whether it is read-only, the default value is false
*/
private Boolean readonly;
/**
* set maximum
*/
private Integer max;
/**
* set minimum
*/
private Integer min;
/**
* set the legal number interval of the input field
*/
private Integer step;
/**
* control whether it can be zoomed by the user, the value is none, both, horizontal, vertical
*/
private ResizeType resize;
/**
* get focus automatically, the default value is false
*/
private Boolean autofocus;
private String form;
/**
* the label text associated with the input box
*/
private String label;
/**
* tabindex of the input box
*/
private String tabindex;
/**
* whether to trigger the verification of the form during input, the default value is true
*/
private Boolean validateEvent;
/**
* whether to display the switch password icon
*/
private Boolean showPassword;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Integer getMaxlength() {
return maxlength;
}
public void setMaxlength(Integer maxlength) {
this.maxlength = maxlength;
}
public Integer getMinlength() {
return minlength;
}
public void setMinlength(Integer minlength) {
this.minlength = minlength;
}
public Boolean getClearable() {
return clearable;
}
public void setClearable(Boolean clearable) {
this.clearable = clearable;
}
public String getPrefixIcon() {
return prefixIcon;
}
public void setPrefixIcon(String prefixIcon) {
this.prefixIcon = prefixIcon;
}
public String getSuffixIcon() {
return suffixIcon;
}
public void setSuffixIcon(String suffixIcon) {
this.suffixIcon = suffixIcon;
}
public Integer getRows() {
return rows;
}
public void setRows(Integer rows) {
this.rows = rows;
}
public Object getAutosize() {
return autosize;
}
public void setAutosize(Object autosize) {
this.autosize = autosize;
}
public String getAutocomplete() {
return autocomplete;
}
public void setAutocomplete(String autocomplete) {
this.autocomplete = autocomplete;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Boolean getReadonly() {
return readonly;
}
public void setReadonly(Boolean readonly) {
this.readonly = readonly;
}
public Integer getMax() {
return max;
}
public void setMax(Integer max) {
this.max = max;
}
public Integer getMin() {
return min;
}
public void setMin(Integer min) {
this.min = min;
}
public Integer getStep() {
return step;
}
public void setStep(Integer step) {
this.step = step;
}
public ResizeType getResize() {
return resize;
}
public void setResize(ResizeType resize) {
this.resize = resize;
}
public Boolean getAutofocus() {
return autofocus;
}
public void setAutofocus(Boolean autofocus) {
this.autofocus = autofocus;
}
public String getForm() {
return form;
}
public void setForm(String form) {
this.form = form;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getTabindex() {
return tabindex;
}
public void setTabindex(String tabindex) {
this.tabindex = tabindex;
}
public Boolean getValidateEvent() {
return validateEvent;
}
public void setValidateEvent(Boolean validateEvent) {
this.validateEvent = validateEvent;
}
public Boolean getShowPassword() {
return showPassword;
}
public void setShowPassword(Boolean showPassword) {
this.showPassword = showPassword;
}
}

104
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/inputNumber/InputNumberParam.java

@ -0,0 +1,104 @@
/*
* 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.spi.params.inputNumber;
import static org.apache.dolphinscheduler.spi.params.base.FormType.INPUTNUMBER;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate;
import java.util.ArrayList;
import java.util.List;
/**
* front-end input number component
*/
public class InputNumberParam extends PluginParams {
private InputNumberParam(Builder builder) {
super(builder);
}
private InputNumberParamProps props;
public static Builder newBuilder(String name, String title) {
return new Builder(name, title);
}
public static class Builder extends PluginParams.Builder {
public Builder(String name, String title) {
super(name, INPUTNUMBER, title);
}
private InputNumberParamProps props;
public Builder setProps(InputNumberParamProps props) {
this.props = props;
return this;
}
public Builder setName(String name) {
this.name = name;
return this;
}
public Builder setTitle(String title) {
this.title = title;
return this;
}
public Builder setInfo(String info) {
this.info = info;
return this;
}
public Builder setValue(Object value) {
this.value = value;
return this;
}
public Builder setValidateList(List<Validate> validateList) {
this.validateList = validateList;
return this;
}
public Builder addValidate(Validate validate) {
if (this.validateList == null) {
this.validateList = new ArrayList<>();
}
this.validateList.add(validate);
return this;
}
public Builder setHidden(Boolean hidden) {
this.hidden = hidden;
return this;
}
public Builder setDisplay(Boolean display) {
this.display = display;
return this;
}
}
@Override
public InputNumberParamProps getProps() {
return props;
}
}

130
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/inputNumber/InputNumberParamProps.java

@ -0,0 +1,130 @@
/*
* 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.spi.params.inputNumber;
import org.apache.dolphinscheduler.spi.params.base.ParamsProps;
/**
* front-end input number component props attributes
*/
public class InputNumberParamProps extends ParamsProps {
/**
* set the minimum value allowed by the counter
*/
private Integer min;
/**
* set the maximum value allowed by the counter
*/
private Integer max;
/**
* counter step
*/
private Integer step;
/**
* numerical accuracy
*/
private Integer precision;
/**
* whether to use the control button, the default value is true
*/
private Boolean controls;
/**
* control button position, the default value is right
*/
private String controlsPosition;
/**
* name attribute
*/
private String name;
/**
* the label text associated with the input box
*/
private String label;
public Integer getMin() {
return min;
}
public void setMin(Integer min) {
this.min = min;
}
public Integer getMax() {
return max;
}
public void setMax(Integer max) {
this.max = max;
}
public Integer getStep() {
return step;
}
public void setStep(Integer step) {
this.step = step;
}
public Integer getPrecision() {
return precision;
}
public void setPrecision(Integer precision) {
this.precision = precision;
}
public Boolean getControls() {
return controls;
}
public void setControls(Boolean controls) {
this.controls = controls;
}
public String getControlsPosition() {
return controlsPosition;
}
public void setControlsPosition(String controlsPosition) {
this.controlsPosition = controlsPosition;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
}

69
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/RadioParam.java → dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/radio/RadioParam.java

@ -15,11 +15,11 @@
* limitations under the License.
*/
package org.apache.dolphinscheduler.spi.params;
package org.apache.dolphinscheduler.spi.params.radio;
import static org.apache.dolphinscheduler.spi.params.base.FormType.RADIO;
import static org.apache.dolphinscheduler.spi.utils.Constants.STRING_PLUGIN_PARAM_OPTIONS;
import org.apache.dolphinscheduler.spi.params.base.FormType;
import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate;
@ -30,16 +30,18 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* radio
* front-end radio select component
*/
public class RadioParam extends PluginParams {
@JsonProperty(STRING_PLUGIN_PARAM_OPTIONS)
private List<ParamsOptions> paramsOptionsList;
private List<ParamsOptions> options;
private RadioParamProps props;
private RadioParam(Builder builder) {
super(builder);
this.paramsOptionsList = builder.paramsOptionsList;
this.options = builder.options;
}
public static Builder newBuilder(String name, String title) {
@ -48,17 +50,30 @@ public class RadioParam extends PluginParams {
public static class Builder extends PluginParams.Builder {
private List<ParamsOptions> paramsOptionsList;
public Builder(String name, String title) {
super(name, FormType.RADIO, title);
super(name, RADIO, title);
}
public Builder addValidate(Validate validate) {
if (this.validateList == null) {
this.validateList = new ArrayList<>();
private List<ParamsOptions> options;
private RadioParamProps props;
public Builder setOptions(List<ParamsOptions> options) {
this.options = options;
return this;
}
this.validateList.add(validate);
public Builder addParamsOptions(ParamsOptions paramsOptions) {
if (this.options == null) {
this.options = new ArrayList<>();
}
this.options.add(paramsOptions);
return this;
}
public Builder setProps(RadioParamProps props) {
this.props = props;
return this;
}
@ -72,6 +87,11 @@ public class RadioParam extends PluginParams {
return this;
}
public Builder setInfo(String info) {
this.info = info;
return this;
}
public Builder setValue(Object value) {
this.value = value;
return this;
@ -82,17 +102,21 @@ public class RadioParam extends PluginParams {
return this;
}
public Builder setParamsOptionsList(List<ParamsOptions> paramsOptionsList) {
this.paramsOptionsList = paramsOptionsList;
public Builder addValidate(Validate validate) {
if (this.validateList == null) {
this.validateList = new ArrayList<>();
}
this.validateList.add(validate);
return this;
}
public Builder addParamsOptions(ParamsOptions paramsOptions) {
if (this.paramsOptionsList == null) {
this.paramsOptionsList = new ArrayList<>();
public Builder setHidden(Boolean hidden) {
this.hidden = hidden;
return this;
}
this.paramsOptionsList.add(paramsOptions);
public Builder setDisplay(Boolean display) {
this.display = display;
return this;
}
@ -102,7 +126,12 @@ public class RadioParam extends PluginParams {
}
}
public List<ParamsOptions> getParamsOptionsList() {
return paramsOptionsList;
public List<ParamsOptions> getOptions() {
return options;
}
@Override
public RadioParamProps getProps() {
return props;
}
}

52
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/radio/RadioParamProps.java

@ -0,0 +1,52 @@
/*
* 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.spi.params.radio;
import org.apache.dolphinscheduler.spi.params.base.ParamsProps;
/**
* front-end radio component props attributes
*/
public class RadioParamProps extends ParamsProps {
/**
* the color of the text when Radio is activated in the form of a button
*/
private String textColor;
/**
* the fill color and border color of the button form of Radio when activated
*/
private String fill;
public String getTextColor() {
return textColor;
}
public void setTextColor(String textColor) {
this.textColor = textColor;
}
public String getFill() {
return fill;
}
public void setFill(String fill) {
this.fill = fill;
}
}

127
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/select/SelectParam.java

@ -0,0 +1,127 @@
/*
* 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.spi.params.select;
import static org.apache.dolphinscheduler.spi.params.base.FormType.SELECT;
import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate;
import java.util.ArrayList;
import java.util.List;
/**
* front-end select component
*/
public class SelectParam extends PluginParams {
private List<ParamsOptions> options;
private SelectParamProps props;
private SelectParam(Builder builder) {
super(builder);
}
public static Builder newBuilder(String name, String title) {
return new Builder(name, title);
}
public static class Builder extends PluginParams.Builder {
public Builder(String name, String title) {
super(name, SELECT, title);
}
private List<ParamsOptions> options;
private SelectParamProps props;
public Builder setOptions(List<ParamsOptions> options) {
this.options = options;
return this;
}
public Builder addOptions(ParamsOptions paramsOptions) {
if (this.options == null) {
this.options = new ArrayList<>();
}
this.options.add(paramsOptions);
return this;
}
public Builder setProps(SelectParamProps props) {
this.props = props;
return this;
}
public Builder setName(String name) {
this.name = name;
return this;
}
public Builder setTitle(String title) {
this.title = title;
return this;
}
public Builder setInfo(String info) {
this.info = info;
return this;
}
public Builder setValue(Object value) {
this.value = value;
return this;
}
public Builder setValidateList(List<Validate> validateList) {
this.validateList = validateList;
return this;
}
public Builder addValidate(Validate validate) {
if (this.validateList == null) {
this.validateList = new ArrayList<>();
}
this.validateList.add(validate);
return this;
}
public Builder setHidden(Boolean hidden) {
this.hidden = hidden;
return this;
}
public Builder setDisplay(Boolean display) {
this.display = display;
return this;
}
}
public List<ParamsOptions> getOptions() {
return options;
}
@Override
public SelectParamProps getProps() {
return props;
}
}

239
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/select/SelectParamProps.java

@ -0,0 +1,239 @@
/*
* 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.spi.params.select;
import org.apache.dolphinscheduler.spi.params.base.ParamsProps;
/**
* front-end select component props attributes
*/
public class SelectParamProps extends ParamsProps {
/**
* whether to select multiple, the default value is false
*/
private Boolean multiple;
/**
* as the key name that uniquely identifies the value, it is required when the binding value is the object type
*/
private String valueKey;
/**
* input box size, optional value medium/small/mini
*/
private String size;
/**
* whether the option can be cleared, the default value is false
*/
private Boolean clearable;
/**
* whether to display the selected value in the form of text when multiple selections, the default value is false
*/
private Boolean collapseTags;
/**
* the maximum number of items that the user can select when multiple selections are made, if it is 0, there is no limit
*/
private Integer multipleLimit;
/**
* select input name attribute
*/
private String name;
/**
* select input autocomplete attribute, the default value is off
*/
private String autocomplete;
/**
* whether it is searchable, the default value is false
*/
private Boolean filterable;
/**
* whether to allow users to create new entries, it needs to be used with filterable, the default value is false
*/
private Boolean allowCreate;
/**
* the text displayed when there is no match for the search criteria
*/
private String noMatchText;
/**
* the text displayed when the option is empty
*/
private String noDataText;
/**
* Select the class name of the drop-down box
*/
private String popperClass;
/**
* when multiple selection and searchable, whether to keep the current search keywords after selecting an option, the default value is false
*/
private Boolean reserveKeyword;
/**
* press Enter in the input box to select the first match. need to be used with filterable or remote, the default value is false
*/
private Boolean defaultFirstOption;
/**
* whether to insert a pop-up box into the body element. when there is a problem with the positioning of the pop-up box, this property can be set to false
*/
private Boolean popperAppendToBody;
/**
* for non-searchable Select, whether to automatically pop up the option menu after the input box gets the focus, the default value is false
*/
private Boolean automaticDropdown;
public Boolean getMultiple() {
return multiple;
}
public void setMultiple(Boolean multiple) {
this.multiple = multiple;
}
public String getValueKey() {
return valueKey;
}
public void setValueKey(String valueKey) {
this.valueKey = valueKey;
}
public Boolean getClearable() {
return clearable;
}
public void setClearable(Boolean clearable) {
this.clearable = clearable;
}
public Boolean getCollapseTags() {
return collapseTags;
}
public void setCollapseTags(Boolean collapseTags) {
this.collapseTags = collapseTags;
}
public Integer getMultipleLimit() {
return multipleLimit;
}
public void setMultipleLimit(Integer multipleLimit) {
this.multipleLimit = multipleLimit;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAutocomplete() {
return autocomplete;
}
public void setAutocomplete(String autocomplete) {
this.autocomplete = autocomplete;
}
public Boolean getFilterable() {
return filterable;
}
public void setFilterable(Boolean filterable) {
this.filterable = filterable;
}
public Boolean getAllowCreate() {
return allowCreate;
}
public void setAllowCreate(Boolean allowCreate) {
this.allowCreate = allowCreate;
}
public String getNoMatchText() {
return noMatchText;
}
public void setNoMatchText(String noMatchText) {
this.noMatchText = noMatchText;
}
public String getNoDataText() {
return noDataText;
}
public void setNoDataText(String noDataText) {
this.noDataText = noDataText;
}
public String getPopperClass() {
return popperClass;
}
public void setPopperClass(String popperClass) {
this.popperClass = popperClass;
}
public Boolean getReserveKeyword() {
return reserveKeyword;
}
public void setReserveKeyword(Boolean reserveKeyword) {
this.reserveKeyword = reserveKeyword;
}
public Boolean getDefaultFirstOption() {
return defaultFirstOption;
}
public void setDefaultFirstOption(Boolean defaultFirstOption) {
this.defaultFirstOption = defaultFirstOption;
}
public Boolean getPopperAppendToBody() {
return popperAppendToBody;
}
public void setPopperAppendToBody(Boolean popperAppendToBody) {
this.popperAppendToBody = popperAppendToBody;
}
public Boolean getAutomaticDropdown() {
return automaticDropdown;
}
public void setAutomaticDropdown(Boolean automaticDropdown) {
this.automaticDropdown = automaticDropdown;
}
}

2
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/TaskChannel.java

@ -21,6 +21,6 @@ public interface TaskChannel {
void cancelApplication(boolean status);
AbstractTask createTask(TaskRequest taskRequest,Logger logger);
AbstractTask createTask(TaskRequest taskRequest, Logger logger);
}

4
dolphinscheduler-spi/src/test/java/org/apache/dolphinscheduler/spi/params/PluginParamsTransferTest.java

@ -25,6 +25,8 @@ import org.apache.dolphinscheduler.spi.params.base.Validate;
import java.util.ArrayList;
import java.util.List;
import org.apache.dolphinscheduler.spi.params.input.InputParam;
import org.apache.dolphinscheduler.spi.params.radio.RadioParam;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@ -110,7 +112,7 @@ public class PluginParamsTransferTest {
emailShowTypeList.add(new ParamsOptions("attachment", "attachment", false));
emailShowTypeList.add(new ParamsOptions("tableattachment", "tableattachment", false));
RadioParam showType = new RadioParam.Builder("showType", "showType")
.setParamsOptionsList(emailShowTypeList)
.setOptions(emailShowTypeList)
.setValue("table")
.addValidate(Validate.newBuilder().setRequired(true).build())
.build();

9
dolphinscheduler-task-plugin/dolphinscheduler-task-api/pom.xml

@ -41,13 +41,14 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
</dependencies>
</project>

5
dolphinscheduler-task-plugin/dolphinscheduler-task-flink/pom.xml

@ -37,6 +37,11 @@
<artifactId>dolphinscheduler-task-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

6
dolphinscheduler-task-plugin/dolphinscheduler-task-python/pom.xml

@ -38,6 +38,12 @@
<artifactId>dolphinscheduler-task-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

9
dolphinscheduler-task-plugin/dolphinscheduler-task-shell/pom.xml

@ -26,6 +26,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>dolphinscheduler-task-shell</artifactId>
<packaging>dolphinscheduler-plugin</packaging>
<dependencies>
<dependency>
@ -38,9 +39,9 @@
<artifactId>dolphinscheduler-task-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
</dependencies>
<build>
<finalName>dolphinscheduler-task-shell-${project.version}</finalName>
</build>
</project>

24
dolphinscheduler-task-plugin/dolphinscheduler-task-shell/src/main/java/org/apache/dolphinscheduler/plugin/task/shell/ShellTaskChannelFactory.java

@ -17,10 +17,15 @@
package org.apache.dolphinscheduler.plugin.task.shell;
import org.apache.dolphinscheduler.spi.params.input.InputParam;
import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate;
import org.apache.dolphinscheduler.spi.params.radio.RadioParam;
import org.apache.dolphinscheduler.spi.task.TaskChannel;
import org.apache.dolphinscheduler.spi.task.TaskChannelFactory;
import java.util.ArrayList;
import java.util.List;
public class ShellTaskChannelFactory implements TaskChannelFactory {
@ -31,11 +36,26 @@ public class ShellTaskChannelFactory implements TaskChannelFactory {
@Override
public String getName() {
return "Shell";
return "SHELL";
}
@Override
public List<PluginParams> getParams() {
return null;
List<PluginParams> paramsList = new ArrayList<>();
InputParam nodeName = InputParam.newBuilder("name", "$t('Node name')")
.addValidate(Validate.newBuilder()
.setRequired(true)
.build())
.build();
RadioParam runFlag = RadioParam.newBuilder("runFlag", "运行标志")
.addParamsOptions(new ParamsOptions("NORMAL", "NORMAL", false))
.addParamsOptions(new ParamsOptions("FORBIDDEN", "FORBIDDEN", false))
.build();
paramsList.add(nodeName);
paramsList.add(runFlag);
return paramsList;
}
}

25
dolphinscheduler-task-plugin/dolphinscheduler-task-shell/src/main/java/org/apache/dolphinscheduler/plugin/task/shell/ShellTaskConstants.java

@ -0,0 +1,25 @@
/*
* 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.shell;
public class ShellTaskConstants {
private ShellTaskConstants() {
}
}

6
dolphinscheduler-task-plugin/dolphinscheduler-task-spark/pom.xml

@ -36,6 +36,12 @@
<artifactId>dolphinscheduler-task-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

19
pom.xml

@ -97,7 +97,7 @@
<mssql.jdbc.version>6.1.0.jre8</mssql.jdbc.version>
<presto.jdbc.version>0.238.1</presto.jdbc.version>
<spotbugs.version>3.1.12</spotbugs.version>
<checkstyle.version>3.0.0</checkstyle.version>
<checkstyle.version>3.1.2</checkstyle.version>
<zookeeper.version>3.4.14</zookeeper.version>
<curator.test>2.12.0</curator.test>
<frontend-maven-plugin.version>1.6</frontend-maven-plugin.version>
@ -206,6 +206,11 @@
<artifactId>dolphinscheduler-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dolphinscheduler</groupId>
<artifactId>dolphinscheduler-standalone-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dolphinscheduler</groupId>
<artifactId>dolphinscheduler-common</artifactId>
@ -310,7 +315,6 @@
<groupId>org.apache.curator</groupId>
<artifactId>curator-test</artifactId>
<version>${curator.test}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
@ -661,7 +665,6 @@
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
</dependency>
</dependencies>
</dependencyManagement>
@ -899,7 +902,6 @@
<include>**/api/utils/ResultTest.java</include>
<include>**/common/graph/DAGTest.java</include>
<include>**/common/os/OshiTest.java</include>
<include>**/common/os/OSUtilsTest.java</include>
<include>**/common/shell/ShellExecutorTest.java</include>
<include>**/common/task/DataxParametersTest.java</include>
<include>**/common/task/EntityTestUtils.java</include>
@ -919,7 +921,6 @@
<include>**/common/utils/JSONUtilsTest.java</include>
<include>**/common/utils/LoggerUtilsTest.java</include>
<include>**/common/utils/NetUtilsTest.java</include>
<include>**/common/utils/OSUtilsTest.java</include>
<include>**/common/utils/ParameterUtilsTest.java</include>
<include>**/common/utils/TimePlaceholderUtilsTest.java</include>
<include>**/common/utils/PreconditionsTest.java</include>
@ -991,6 +992,7 @@
<include>**/server/master/MasterCommandTest.java</include>
<include>**/server/master/DependentTaskTest.java</include>
<include>**/server/master/ConditionsTaskTest.java</include>
<include>**/server/master/SwitchTaskTest.java</include>
<include>**/server/master/MasterExecThreadTest.java</include>
<include>**/server/master/ParamsTest.java</include>
<include>**/server/master/SubProcessTaskTest.java</include>
@ -1065,7 +1067,6 @@
<include>**/plugin/alert/email/EmailAlertChannelFactoryTest.java</include>
<include>**/plugin/alert/email/EmailAlertChannelTest.java</include>
<include>**/plugin/alert/email/ExcelUtilsTest.java</include>
<include>**/plugin/alert/email/MailUtilsTest.java</include>
<include>**/plugin/alert/email/template/DefaultHTMLTemplateTest.java</include>
<include>**/plugin/alert/dingtalk/DingTalkSenderTest.java</include>
<include>**/plugin/alert/dingtalk/DingTalkAlertChannelFactoryTest.java</include>
@ -1153,15 +1154,13 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.18</version>
<version>8.45</version>
</dependency>
</dependencies>
<configuration>
<consoleOutput>true</consoleOutput>
<encoding>UTF-8</encoding>
<configLocation>style/checkstyle.xml</configLocation>
<suppressionsLocation>style/checkstyle-suppressions.xml</suppressionsLocation>
<suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression>
<failOnViolation>true</failOnViolation>
<violationSeverity>warning</violationSeverity>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
@ -1169,7 +1168,6 @@
<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
</sourceDirectories>
<excludes>**\/generated-sources\/</excludes>
<skip>true</skip>
</configuration>
<executions>
<execution>
@ -1215,5 +1213,6 @@
<module>dolphinscheduler-remote</module>
<module>dolphinscheduler-service</module>
<module>dolphinscheduler-microbench</module>
<module>dolphinscheduler-standalone-server</module>
</modules>
</project>

Loading…
Cancel
Save