Browse Source

Merge pull request #4 from apache/dev

update code
pull/2/head
samz406 5 years ago committed by GitHub
parent
commit
c8938770eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/ISSUE_TEMPLATE/bug_report.md
  2. 23
      .github/ISSUE_TEMPLATE/question.md
  3. 17
      .github/workflows/ci.yml
  4. 36
      README.md
  5. 32
      README_zh_CN.md
  6. 6
      docs/en_US/EasyScheduler Proposal.md
  7. 6
      docs/en_US/architecture-design.md
  8. 2
      docs/en_US/frontend-deployment.md
  9. 4
      docs/en_US/frontend-development.md
  10. 6
      docs/en_US/system-manual.md
  11. 4
      docs/zh_CN/前端开发文档.md
  12. 2
      docs/zh_CN/系统使用手册.md
  13. 4
      docs/zh_CN/系统架构设计.md
  14. 27
      escheduler-alert/src/main/java/cn/escheduler/alert/AlertServer.java
  15. 5
      escheduler-alert/src/main/resources/application_alert.properties
  16. 2
      escheduler-api/src/main/java/cn/escheduler/api/CombinedApplicationServer.java
  17. 80
      escheduler-api/src/main/java/cn/escheduler/api/service/ProcessDefinitionService.java
  18. 26
      escheduler-api/src/main/java/cn/escheduler/api/utils/ZooKeeperState.java
  19. 20
      escheduler-api/src/main/java/cn/escheduler/api/utils/ZookeeperMonitor.java
  20. 6
      escheduler-api/src/test/java/cn/escheduler/api/HttpClientTest.java
  21. 18
      escheduler-api/src/test/java/cn/escheduler/api/controller/MonitorControllerTest.java
  22. 18
      escheduler-api/src/test/java/cn/escheduler/api/utils/ZookeeperMonitorUtilsTest.java
  23. 14
      escheduler-common/pom.xml
  24. 18
      escheduler-common/src/main/java/cn/escheduler/common/Constants.java
  25. 30
      escheduler-common/src/main/java/cn/escheduler/common/enums/HttpCheckCondition.java
  26. 31
      escheduler-common/src/main/java/cn/escheduler/common/enums/HttpMethod.java
  27. 29
      escheduler-common/src/main/java/cn/escheduler/common/enums/HttpParametersType.java
  28. 4
      escheduler-common/src/main/java/cn/escheduler/common/enums/TaskType.java
  29. 17
      escheduler-common/src/main/java/cn/escheduler/common/enums/ZKNodeType.java
  30. 125
      escheduler-common/src/main/java/cn/escheduler/common/process/HttpProperty.java
  31. 2
      escheduler-common/src/main/java/cn/escheduler/common/shell/AbstractShell.java
  32. 219
      escheduler-common/src/main/java/cn/escheduler/common/task/flink/FlinkParameters.java
  33. 108
      escheduler-common/src/main/java/cn/escheduler/common/task/http/HttpParameters.java
  34. 2
      escheduler-common/src/main/java/cn/escheduler/common/thread/ThreadPoolExecutors.java
  35. 4
      escheduler-common/src/main/java/cn/escheduler/common/utils/HadoopUtils.java
  36. 6
      escheduler-common/src/main/java/cn/escheduler/common/utils/TaskParametersUtils.java
  37. 2
      escheduler-common/src/main/resources/common/common.properties
  38. 19
      escheduler-common/src/test/java/cn/escheduler/common/utils/IpUtilsTest.java
  39. 4
      escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java
  40. 16
      escheduler-dao/src/main/java/cn/escheduler/dao/mapper/ErrorCommandMapperProvider.java
  41. 8
      escheduler-dao/src/main/java/cn/escheduler/dao/mapper/ProcessInstanceMapperProvider.java
  42. 2
      escheduler-dao/src/main/java/cn/escheduler/dao/mapper/ScheduleMapperProvider.java
  43. 8
      escheduler-dao/src/main/java/cn/escheduler/dao/mapper/TaskInstanceMapperProvider.java
  44. 13
      escheduler-dao/src/main/java/cn/escheduler/dao/upgrade/DolphinSchedulerManager.java
  45. 9
      escheduler-dao/src/main/java/cn/escheduler/dao/upgrade/MysqlUpgradeDao.java
  46. 21
      escheduler-dao/src/main/java/cn/escheduler/dao/upgrade/PostgresqlUpgradeDao.java
  47. 34
      escheduler-dao/src/main/java/cn/escheduler/dao/upgrade/UpgradeDao.java
  48. 28
      escheduler-rpc/src/main/java/cn/escheduler/rpc/LogViewServiceGrpc.java
  49. 2
      escheduler-server/src/main/java/cn/escheduler/server/rpc/LoggerServer.java
  50. 124
      escheduler-server/src/main/java/cn/escheduler/server/utils/FlinkArgsUtils.java
  51. 3
      escheduler-server/src/main/java/cn/escheduler/server/worker/task/AbstractTask.java
  52. 6
      escheduler-server/src/main/java/cn/escheduler/server/worker/task/TaskManager.java
  53. 118
      escheduler-server/src/main/java/cn/escheduler/server/worker/task/flink/FlinkTask.java
  54. 270
      escheduler-server/src/main/java/cn/escheduler/server/worker/task/http/HttpTask.java
  55. 2
      escheduler-server/src/main/resources/application_worker.properties
  56. 16
      escheduler-server/src/test/java/cn/escheduler/server/worker/EnvFileTest.java
  57. 18
      escheduler-server/src/test/java/cn/escheduler/server/zk/ZKWorkerClientTest.java
  58. 4
      escheduler-ui/build/webpack.config.prod.js
  59. 3
      escheduler-ui/package.json
  60. 16
      escheduler-ui/src/combo/1.0.0/3rd.css
  61. 16
      escheduler-ui/src/combo/1.0.0/local.js
  62. 16
      escheduler-ui/src/font/demo.css
  63. 16
      escheduler-ui/src/font/iconfont.css
  64. 16
      escheduler-ui/src/font/iconfont.js
  65. 16
      escheduler-ui/src/js/conf/home/App.vue
  66. 8
      escheduler-ui/src/js/conf/home/pages/dag/_source/config.js
  67. 22
      escheduler-ui/src/js/conf/home/pages/dag/_source/dag.scss
  68. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue
  69. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/_source/selectInput.vue
  70. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/_source/timeoutAlarm.vue
  71. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/_source/workerGroups.vue
  72. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.scss
  73. 152
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue
  74. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/log.vue
  75. 34
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/commcon.js
  76. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/datasource.vue
  77. 29
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/dependItemList.vue
  78. 242
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/httpParams.vue
  79. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/listBox.vue
  80. 20
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/localParams.vue
  81. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/resources.vue
  82. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/sqlType.vue
  83. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/statementList.vue
  84. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/udfs.vue
  85. 29
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/dependent.vue
  86. 389
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue
  87. 191
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/http.vue
  88. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/mr.vue
  89. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/procedure.vue
  90. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue
  91. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue
  92. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue
  93. 22
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sql.vue
  94. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sub_process.vue
  95. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/jumpAffirm/index.js
  96. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/jumpAffirm/jumpAffirm.vue
  97. 2
      escheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/jsPlumbHandle.js
  98. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/startingParam/index.vue
  99. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/udp/_source/selectTenant.vue
  100. 16
      escheduler-ui/src/js/conf/home/pages/dag/_source/udp/udp.vue
  101. Some files were not shown because too many files have changed in this diff Show More

2
.github/ISSUE_TEMPLATE/bug_report.md

@ -26,7 +26,7 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.
**Which version of Easy Scheduler:**
**Which version of Dolphin Scheduler:**
-[1.1.0-preview]
**Additional context**

23
.github/ISSUE_TEMPLATE/question.md

@ -0,0 +1,23 @@
---
name: question
about: have a question wanted to be help
title: "[QUESTION] question title"
labels: question
assignees: ''
---
*For better global communication, please give priority to using English description, thx! *
**Describe the question**
A clear and concise description of what the question is.
**Which version of DolphinScheduler:**
-[1.1.0-preview]
**Additional context**
Add any other context about the problem here.
**Requirement or improvement
- Please describe about your requirements or improvement suggestions.

17
.github/workflows/ci.yml

@ -0,0 +1,17 @@
name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Maven
run: mvn apache-rat:check --file pom.xml

36
README.md

@ -1,11 +1,11 @@
Easy Scheduler
Dolphin Scheduler
============
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
[![Total Lines](https://tokei.rs/b1/github/analysys/EasyScheduler?category=lines)](https://github.com/analysys/EasyScheduler)
[![Total Lines](https://tokei.rs/b1/github/apache/Incubator-DolphinScheduler?category=lines)](https://github.com/apache/Incubator-DolphinScheduler)
> Easy Scheduler for Big Data
> Dolphin Scheduler for Big Data
[![Stargazers over time](https://starchart.cc/analysys/EasyScheduler.svg)](https://starchart.cc/analysys/EasyScheduler)
[![Stargazers over time](https://starchart.cc/apache/incubator-dolphinscheduler.svg)](https://starchart.cc/apache/incubator-dolphinscheduler)
[![EN doc](https://img.shields.io/badge/document-English-blue.svg)](README.md)
[![CN doc](https://img.shields.io/badge/文档-中文版-blue.svg)](README_zh_CN.md)
@ -32,12 +32,12 @@ Its main objectives are as follows:
- There are more waiting partners to explore
### What's in Easy Scheduler
### What's in Dolphin Scheduler
Stability | Easy to use | Features | Scalability |
-- | -- | -- | --
Decentralized multi-master and multi-worker | Visualization process defines key information such as task status, task type, retry times, task running machine, visual variables and so on at a glance.  |  Support pause, recover operation | support custom task types
HA is supported by itself | All process definition operations are visualized, dragging tasks to draw DAGs, configuring data sources and resources. At the same time, for third-party systems, the api mode operation is provided. | Users on easyscheduler can achieve many-to-one or one-to-one mapping relationship through tenants and Hadoop users, which is very important for scheduling large data jobs. " | The scheduler uses distributed scheduling, and the overall scheduling capability will increase linearly with the scale of the cluster. Master and Worker support dynamic online and offline.
HA is supported by itself | All process definition operations are visualized, dragging tasks to draw DAGs, configuring data sources and resources. At the same time, for third-party systems, the api mode operation is provided. | Users on DolphinScheduler can achieve many-to-one or one-to-one mapping relationship through tenants and Hadoop users, which is very important for scheduling large data jobs. " | The scheduler uses distributed scheduling, and the overall scheduling capability will increase linearly with the scale of the cluster. Master and Worker support dynamic online and offline.
Overload processing: Task queue mechanism, the number of schedulable tasks on a single machine can be flexibly configured, when too many tasks will be cached in the task queue, will not cause machine jam. | One-click deployment | Supports traditional shell tasks, and also support big data platform task scheduling: MR, Spark, SQL (mysql, postgresql, hive, sparksql), Python, Procedure, Sub_Process | |
@ -54,36 +54,38 @@ Overload processing: Task queue mechanism, the number of schedulable tasks on a
### Document
- <a href="https://analysys.github.io/easyscheduler_docs_cn/后端部署文档.html" target="_blank">Backend deployment documentation</a>
- <a href="https://dolphinscheduler.apache.org/en-us/docs/user_doc/backend-deployment.html" target="_blank">Backend deployment documentation</a>
- <a href="https://analysys.github.io/easyscheduler_docs_cn/前端部署文档.html" target="_blank">Front-end deployment documentation</a>
- <a href="https://dolphinscheduler.apache.org/en-us/docs/user_doc/frontend-deployment.html" target="_blank">Front-end deployment documentation</a>
- [**User manual**](https://analysys.github.io/easyscheduler_docs_cn/系统使用手册.html?_blank "User manual")
- [**User manual**](https://dolphinscheduler.apache.org/en-us/docs/user_doc/system-manual.html?_blank "System manual")
- [**Upgrade document**](https://analysys.github.io/easyscheduler_docs_cn/升级文档.html?_blank "Upgrade document")
- [**Upgrade document**](https://dolphinscheduler.apache.org/en-us/docs/release/upgrade.html?_blank "Upgrade document")
- <a href="http://106.75.43.194:8888" target="_blank">Online Demo</a>
More documentation please refer to <a href="https://analysys.github.io/easyscheduler_docs_cn/" target="_blank">[EasyScheduler online documentation]</a>
More documentation please refer to <a href="https://dolphinscheduler.apache.org/en-us/docs/user_doc/quick-start.html" target="_blank">[DolphinScheduler online documentation]</a>
### Recent R&D plan
Work plan of Easy Scheduler: [R&D plan](https://github.com/analysys/EasyScheduler/projects/1), where `In Develop` card is the features of 1.1.0 version , TODO card is to be done (including feature ideas)
Work plan of Dolphin Scheduler: [R&D plan](https://github.com/apache/incubator-dolphinscheduler/projects/1), Under the `In Develop` card is what is currently being developed, TODO card is to be done (including feature ideas)
### How to contribute code
Welcome to participate in contributing code, please refer to the process of submitting the code:
[[How to contribute code](https://github.com/analysys/EasyScheduler/issues/310)]
[[How to contribute code](https://github.com/apache/incubator-dolphinscheduler/issues/310)]
### Thanks
Easy Scheduler uses a lot of excellent open source projects, such as google guava, guice, grpc, netty, ali bonecp, quartz, and many open source projects of apache, etc.
It is because of the shoulders of these open source projects that the birth of the Easy Scheduler is possible. We are very grateful for all the open source software used! We also hope that we will not only be the beneficiaries of open source, but also be open source contributors, so we decided to contribute to easy scheduling and promised long-term updates. We also hope that partners who have the same passion and conviction for open source will join in and contribute to open source!
Dolphin Scheduler uses a lot of excellent open source projects, such as google guava, guice, grpc, netty, ali bonecp, quartz, and many open source projects of apache, etc.
It is because of the shoulders of these open source projects that the birth of the Dolphin Scheduler is possible. We are very grateful for all the open source software used! We also hope that we will not only be the beneficiaries of open source, but also be open source contributors. We also hope that partners who have the same passion and conviction for open source will join in and contribute to open source!
### Get Help
The fastest way to get response from our developers is to submit issues, or add our wechat : 510570367
1. Submit an issue
1. Mail list: dev@dolphinscheduler.apache.org. Mail to dev-subscribe@dolphinscheduler.apache.org, follow the reply to subscribe the mail list.
1. Contact WeChat group manager, ID 510570367. This is for Mandarin(CN) discussion.
### License
Please refer to [LICENSE](https://github.com/analysys/EasyScheduler/blob/dev/LICENSE) file.
Please refer to [LICENSE](https://github.com/apache/incubator-dolphinscheduler/blob/dev/LICENSE) file.

32
README_zh_CN.md

@ -1,9 +1,9 @@
Easy Scheduler
Dolphin Scheduler
============
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
[![Total Lines](https://tokei.rs/b1/github/analysys/EasyScheduler?category=lines)](https://github.com/analysys/EasyScheduler)
> Easy Scheduler for Big Data
> Dolphin Scheduler for Big Data
@ -30,9 +30,6 @@ Easy Scheduler
- 支持国际化
- 还有更多等待伙伴们探索
### 与同类调度系统的对比
![调度系统对比](http://geek.analysys.cn/static/upload/47/2019-03-01/9609ca82-cf8b-4d91-8dc0-0e2805194747.jpeg)
### 系统部分截图
@ -44,38 +41,43 @@ Easy Scheduler
### 文档
- <a href="https://analysys.github.io/easyscheduler_docs_cn/后端部署文档.html" target="_blank">后端部署文档</a>
- <a href="https://dolphinscheduler.apache.org/zh-cn/docs/user_doc/backend-deployment.html" target="_blank">后端部署文档</a>
- <a href="https://analysys.github.io/easyscheduler_docs_cn/前端部署文档.html" target="_blank">前端部署文档</a>
- <a href="https://dolphinscheduler.apache.org/zh-cn/docs/user_doc/frontend-deployment.html" target="_blank">前端部署文档</a>
- [**使用手册**](https://analysys.github.io/easyscheduler_docs_cn/系统使用手册.html?_blank "系统使用手册")
- [**使用手册**](https://dolphinscheduler.apache.org/zh-cn/docs/user_doc/system-manual.html?_blank "系统使用手册")
- [**升级文档**](https://analysys.github.io/easyscheduler_docs_cn/升级文档.html?_blank "升级文档")
- [**升级文档**](https://dolphinscheduler.apache.org/zh-cn/docs/release/upgrade.html?_blank "升级文档")
- <a href="http://106.75.43.194:8888" target="_blank">我要体验</a>
更多文档请参考 <a href="https://analysys.github.io/easyscheduler_docs_cn/" target="_blank">easyscheduler中文在线文档</a>
更多文档请参考 <a href="https://dolphinscheduler.apache.org/zh-cn/docs/user_doc/quick-start.html" target="_blank">DolphinScheduler中文在线文档</a>
### 近期研发计划
EasyScheduler的工作计划:<a href="https://github.com/analysys/EasyScheduler/projects/1" target="_blank">研发计划</a> ,其中 In Develop卡片下是1.1.0版本的功能,TODO卡片是待做事项(包括 feature ideas)
DolphinScheduler的工作计划:<a href="https://github.com/apache/incubator-dolphinscheduler/projects/1" target="_blank">研发计划</a> ,其中 In Develop卡片下是正在研发的功能,TODO卡片是待做事项(包括 feature ideas)
### 贡献代码
非常欢迎大家来参与贡献代码,提交代码流程请参考:
[[How to contribute code](https://github.com/analysys/EasyScheduler/issues/310)]
[[How to contribute code](https://github.com/apache/incubator-dolphinscheduler/issues/310)]
### 感谢
Easy Scheduler使用了很多优秀的开源项目,比如google的guava、guice、grpc,netty,ali的bonecp,quartz,以及apache的众多开源项目等等,
Dolphin Scheduler使用了很多优秀的开源项目,比如google的guava、guice、grpc,netty,ali的bonecp,quartz,以及apache的众多开源项目等等,
正是由于站在这些开源项目的肩膀上,才有Easy Scheduler的诞生的可能。对此我们对使用的所有开源软件表示非常的感谢!我们也希望自己不仅是开源的受益者,也能成为开源的
贡献者,于是我们决定把易调度贡献出来,并承诺长期维护。也希望对开源有同样热情和信念的伙伴加入进来,一起为开源献出一份力!
### 帮助
The fastest way to get response from our developers is to submit issues, or add our wechat : 510570367
### 获得帮助
1. Submit an issue
1. Mail list: dev@dolphinscheduler.apache.org. Mail to dev-subscribe@dolphinscheduler.apache.org, follow the reply to subscribe the mail list.
1. Contact WeChat group manager, ID 510570367. This is for Mandarin(CN) discussion.
### 版权
Please refer to [LICENSE](https://github.com/apache/incubator-dolphinscheduler/blob/dev/LICENSE) file.

6
docs/en_US/EasyScheduler Proposal.md

@ -30,7 +30,7 @@ The codes are already under Apache License Version 2.0.
We want to find a data processing tool with the following features:
- Easy to use,developers can build a ETL process with a very simple drag and drop operation. not only for ETL developers,people who can't write code also can use this tool for ETL operation such as system adminitrator.
- Easy to use,developers can build a ETL process with a very simple drag and drop operation. not only for ETL developers,people who can't write code also can use this tool for ETL operation such as system administrator.
- Solving the problem of "complex task dependencies" , and it can monitor the ETL running status.
- Support multi-tenant.
- Support many task types: Shell, MR, Spark, SQL (mysql, postgresql, hive, sparksql), Python, Sub_Process, Procedure, etc.
@ -73,7 +73,7 @@ Thus, it is very unlikely that EasyScheduler becomes orphaned.
EasyScheduler's core developers have been running it as a community-oriented open source project for some time, several of them already have experience working with open source communities, they are also active in presto, alluxio and other projects. At the same time, we will learn more open source experiences by following the Apache way in our incubator journey.
### Homogenous Developers
### Homogeneous Developers
The current developers work across a variety of organizations including Analysys, guandata and hydee;
some individual developers are accepted as developers of EasyScheduler as well.
@ -110,7 +110,7 @@ The project consists of three distinct codebases: core and document. The address
## Source and Intellectual Property Submission Plan
As soon as EasyScheduler is approved to join Apache Incubator, Analysys will provide the Software Grant Agreement(SGA) and intial committers will submit ICLA(s). The code is already licensed under the Apache Software License, version 2.0.
As soon as EasyScheduler is approved to join Apache Incubator, Analysys will provide the Software Grant Agreement(SGA) and initial committers will submit ICLA(s). The code is already licensed under the Apache Software License, version 2.0.
## External Dependencies

6
docs/en_US/architecture-design.md

@ -266,7 +266,7 @@ In the early scheduling design, if there is no priority design and fair scheduli
/**
* task log appender
*/
Public class TaskLogAppender extends FileAppender<ILoggingEvent {
Public class TaskLogAppender extends FileAppender<ILoggingEvent> {
...
@ -297,7 +297,7 @@ Generate a log in the form of /process definition id/process instance id/task in
/**
* task log filter
*/
Public class TaskLogFilter extends Filter<ILoggingEvent {
Public class TaskLogFilter extends Filter<ILoggingEvent> {
@Override
Public FilterReply decide(ILoggingEvent event) {
@ -313,4 +313,4 @@ Public class TaskLogFilter extends Filter<ILoggingEvent {
### summary
Starting from the scheduling, this paper introduces the architecture principle and implementation ideas of the big data distributed workflow scheduling system-EasyScheduler. To be continued
Starting from the scheduling, this paper introduces the architecture principle and implementation ideas of the big data distributed workflow scheduling system-EasyScheduler. To be continued

2
docs/en_US/frontend-deployment.md

@ -64,7 +64,7 @@ server {
index index.html index.html;
}
location /escheduler {
proxy_pass http://192.168.xx.xx:12345; # nterface address (self-modifying)
proxy_pass http://192.168.xx.xx:12345; # interface address (self-modifying)
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header x_real_ipP $remote_addr;

4
docs/en_US/frontend-development.md

@ -63,7 +63,7 @@ Copy it to the corresponding directory of the server (front-end service static p
Visit address` http://localhost:8888/#/`
#### Start with node and daemon under Liunx
#### Start with node and daemon under Linux
Install pm2 `npm install -g pm2`
@ -238,7 +238,7 @@ The internal common component of the `src/js/module/components` project writes t
├── conditions
├── conditions.vue
└── _source
└── serach.vue
└── search.vue
└── util.js
```

6
docs/en_US/system-manual.md

@ -340,7 +340,7 @@ conf/common/hadoop.properties
- Queues are used to execute spark, mapreduce and other programs, which require the use of "queue" parameters.
- "Security" - > "Queue Manage" - > "Creat Queue"
- "Security" - > "Queue Manage" - > "Create Queue"
<p align="center">
<img src="https://user-images.githubusercontent.com/53217792/61841945-078f4480-aec9-11e9-92fb-05b6f42f07d6.png" width="60%" />
</p>
@ -403,7 +403,7 @@ conf/common/hadoop.properties
try {
// execute
response = httpclient.execute(httpPost);
// eponse status code 200
// response status code 200
if (response.getStatusLine().getStatusCode() == 200) {
String content = EntityUtils.toString(response.getEntity(), "UTF-8");
System.out.println(content);
@ -533,7 +533,7 @@ conf/common/hadoop.properties
<img src="https://user-images.githubusercontent.com/53217792/61844464-1af2dd80-aed2-11e9-9486-6cf1b8585aa5.png" width="60%" />
</p>
- Datasource: The data source type of stored procedure supports MySQL and POSTGRRESQL, and chooses the corresponding data source.
- Datasource: The data source type of stored procedure supports MySQL and POSTGRESQL, and chooses the corresponding data source.
- Method: The method name of the stored procedure
- Custom parameters: Custom parameter types of stored procedures support IN and OUT, and data types support nine data types: VARCHAR, INTEGER, LONG, FLOAT, DOUBLE, DATE, TIME, TIMESTAMP and BOOLEAN.

4
docs/zh_CN/前端开发文档.md

@ -64,7 +64,7 @@ npm install node-sass --unsafe-perm //单独安装node-sass依赖
访问地址 `http://localhost:8888/#/`
#### Liunx下使用node启动并且守护进程
#### Linux下使用node启动并且守护进程
安装pm2 `npm install -g pm2`
@ -237,7 +237,7 @@ export default {
├── conditions
├── conditions.vue
└── _source
└── serach.vue
└── search.vue
└── util.js
```

2
docs/zh_CN/系统使用手册.md

@ -391,7 +391,7 @@ conf/common/hadoop.properties
try {
// execute
response = httpclient.execute(httpPost);
// eponse status code 200
// response status code 200
if (response.getStatusLine().getStatusCode() == 200) {
String content = EntityUtils.toString(response.getEntity(), "UTF-8");
System.out.println(content);

4
docs/zh_CN/系统架构设计.md

@ -253,7 +253,7 @@ Master Scheduler线程一旦发现任务实例为” 需要容错”状态,则
/**
* task log appender
*/
public class TaskLogAppender extends FileAppender<ILoggingEvent {
public class TaskLogAppender extends FileAppender<ILoggingEvent> {
...
@ -286,7 +286,7 @@ Master Scheduler线程一旦发现任务实例为” 需要容错”状态,则
/**
* task log filter
*/
public class TaskLogFilter extends Filter<ILoggingEvent {
public class TaskLogFilter extends Filter<ILoggingEvent> {
@Override
public FilterReply decide(ILoggingEvent event) {

27
escheduler-alert/src/main/java/cn/escheduler/alert/AlertServer.java

@ -20,36 +20,40 @@ import cn.escheduler.alert.runner.AlertSender;
import cn.escheduler.alert.utils.Constants;
import cn.escheduler.common.thread.Stopper;
import cn.escheduler.dao.AlertDao;
import cn.escheduler.dao.DaoFactory;
import cn.escheduler.dao.model.Alert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.context.annotation.ComponentScan;
import java.util.List;
/**
* alert of start
*/
public class AlertServer {
@ComponentScan("cn.escheduler")
public class AlertServer implements CommandLineRunner {
private static final Logger logger = LoggerFactory.getLogger(AlertServer.class);
/**
* Alert Dao
*/
private AlertDao alertDao = DaoFactory.getDaoInstance(AlertDao.class);
private AlertDao alertDao;
private AlertSender alertSender;
private static AlertServer instance;
private AlertServer() {
private static volatile AlertServer instance;
public AlertServer(AlertDao alertDao) {
this.alertDao = alertDao;
}
public static AlertServer getInstance(){
public static AlertServer getInstance(AlertDao alertDao){
if (null == instance) {
synchronized (AlertServer.class) {
if(null == instance) {
instance = new AlertServer();
instance = new AlertServer(alertDao);
}
}
}
@ -72,8 +76,13 @@ public class AlertServer {
public static void main(String[] args){
SpringApplication app = new SpringApplication(AlertServer.class);
app.run(args);
}
AlertServer alertServer = AlertServer.getInstance();
@Override
public void run(String... strings) throws Exception {
AlertServer alertServer = AlertServer.getInstance(alertDao);
alertServer.start();
}
}

5
escheduler-alert/src/main/resources/application_alert.properties

@ -0,0 +1,5 @@
logging.config=classpath:alert_logback.xml
# server port
server.port=7789

2
escheduler-api/src/main/java/cn/escheduler/api/CombinedApplicationServer.java

@ -51,7 +51,7 @@ public class CombinedApplicationServer extends SpringBootServletInitializer {
LoggerServer server = new LoggerServer();
server.start();
AlertServer alertServer = AlertServer.getInstance();
AlertServer alertServer = AlertServer.getInstance(alertDao);
alertServer.start();
}
}

80
escheduler-api/src/main/java/cn/escheduler/api/service/ProcessDefinitionService.java

@ -547,8 +547,27 @@ public class ProcessDefinitionService extends BaseDAGService {
sqlParameters.put("datasourceName", dataSource.getName());
}
taskNode.put("params", sqlParameters);
}else if(taskType.equals(TaskType.DEPENDENT.name())){
JSONObject dependentParameters = JSONUtils.parseObject(taskNode.getString("dependence"));
if(dependentParameters != null){
JSONArray dependTaskList = (JSONArray) dependentParameters.get("dependTaskList");
for (int j = 0; j < dependTaskList.size(); j++) {
JSONObject dependentTaskModel = dependTaskList.getJSONObject(j);
JSONArray dependItemList = (JSONArray) dependentTaskModel.get("dependItemList");
for (int k = 0; k < dependItemList.size(); k++) {
JSONObject dependentItem = dependItemList.getJSONObject(k);
int definitionId = dependentItem.getInteger("definitionId");
ProcessDefinition definition = processDefineMapper.queryByDefineId(definitionId);
if(definition != null){
dependentItem.put("projectName",definition.getProjectName());
dependentItem.put("definitionName",definition.getName());
}
}
}
taskNode.put("dependence", dependentParameters);
}
}
}
}
jsonObject.put("tasks", jsonArray);
processDefinition.setProcessDefinitionJson(jsonObject.toString());
@ -570,7 +589,7 @@ public class ProcessDefinitionService extends BaseDAGService {
row.put("scheduleEndTime", schedule.getEndTime());
row.put("scheduleCrontab", schedule.getCrontab());
row.put("scheduleFailureStrategy", schedule.getFailureStrategy());
row.put("scheduleReleaseState", schedule.getReleaseState());
row.put("scheduleReleaseState", ReleaseState.OFFLINE);
row.put("scheduleProcessInstancePriority", schedule.getProcessInstancePriority());
if(schedule.getId() == -1){
row.put("scheduleWorkerGroupId", -1);
@ -643,16 +662,19 @@ public class ProcessDefinitionService extends BaseDAGService {
projectName = json.get("projectName").toString();
} else {
putMsg(result, Status.DATA_IS_NULL, "processDefinitionName");
return result;
}
if (ObjectUtils.allNotNull(json.get("processDefinitionName"))) {
processDefinitionName = json.get("processDefinitionName").toString();
} else {
putMsg(result, Status.DATA_IS_NULL, "processDefinitionName");
return result;
}
if (ObjectUtils.allNotNull(json.get("processDefinitionJson"))) {
processDefinitionJson = json.get("processDefinitionJson").toString();
} else {
putMsg(result, Status.DATA_IS_NULL, "processDefinitionJson");
return result;
}
if (ObjectUtils.allNotNull(json.get("processDefinitionDesc"))) {
processDefinitionDesc = json.get("processDefinitionDesc").toString();
@ -664,17 +686,46 @@ public class ProcessDefinitionService extends BaseDAGService {
processDefinitionConnects = json.get("processDefinitionConnects").toString();
}
Project project = projectMapper.queryByName(projectName);
if(project != null){
processDefinitionName = recursionProcessDefinitionName(project.getId(), processDefinitionName,1);
}
JSONObject jsonObject = JSONUtils.parseObject(processDefinitionJson);
JSONArray jsonArray = (JSONArray) jsonObject.get("tasks");
for (int j = 0; j < jsonArray.size(); j++) {
JSONObject taskNode = jsonArray.getJSONObject(j);
JSONObject sqlParameters = JSONUtils.parseObject(taskNode.getString("params"));
List<DataSource> dataSources = dataSourceMapper.queryDataSourceByName(sqlParameters.getString("datasourceName"));
if (dataSources.size() > 0) {
DataSource dataSource = dataSources.get(0);
sqlParameters.put("datasource", dataSource.getId());
String taskType = taskNode.getString("type");
if(taskType.equals(TaskType.SQL.name()) || taskType.equals(TaskType.PROCEDURE.name())) {
JSONObject sqlParameters = JSONUtils.parseObject(taskNode.getString("params"));
List<DataSource> dataSources = dataSourceMapper.queryDataSourceByName(sqlParameters.getString("datasourceName"));
if (dataSources.size() > 0) {
DataSource dataSource = dataSources.get(0);
sqlParameters.put("datasource", dataSource.getId());
}
taskNode.put("params", sqlParameters);
}else if(taskType.equals(TaskType.DEPENDENT.name())){
JSONObject dependentParameters = JSONUtils.parseObject(taskNode.getString("dependence"));
if(dependentParameters != null){
JSONArray dependTaskList = (JSONArray) dependentParameters.get("dependTaskList");
for (int h = 0; h < dependTaskList.size(); h++) {
JSONObject dependentTaskModel = dependTaskList.getJSONObject(h);
JSONArray dependItemList = (JSONArray) dependentTaskModel.get("dependItemList");
for (int k = 0; k < dependItemList.size(); k++) {
JSONObject dependentItem = dependItemList.getJSONObject(k);
Project dependentItemProject = projectMapper.queryByName(dependentItem.getString("projectName"));
if(dependentItemProject != null){
ProcessDefinition definition = processDefineMapper.queryByDefineName(dependentItemProject.getId(),dependentItem.getString("definitionName"));
if(definition != null){
dependentItem.put("projectId",dependentItemProject.getId());
dependentItem.put("definitionId",definition.getId());
}
}
}
}
taskNode.put("dependence", dependentParameters);
}
}
taskNode.put("params", sqlParameters);
}
jsonObject.put("tasks", jsonArray);
@ -1112,5 +1163,20 @@ public class ProcessDefinitionService extends BaseDAGService {
return graph.hasCycle();
}
private String recursionProcessDefinitionName(Integer projectId,String processDefinitionName,int num){
ProcessDefinition processDefinition = processDefineMapper.queryByDefineName(projectId, processDefinitionName);
if (processDefinition != null) {
if(num>1){
String str = processDefinitionName.substring(0,processDefinitionName.length() - 3);
processDefinitionName = str + "("+num+")";
}else{
processDefinitionName = processDefinition.getName() + "("+num+")";
}
}else{
return processDefinitionName;
}
return recursionProcessDefinitionName(projectId,processDefinitionName,num + 1);
}
}

26
escheduler-api/src/main/java/cn/escheduler/api/utils/ZooKeeperState.java

@ -1,3 +1,19 @@
/*
* 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 cn.escheduler.api.utils;
import org.apache.commons.lang3.StringUtils;
@ -9,7 +25,7 @@ import java.io.IOException;
import java.util.Scanner;
/**
* zookeeper状态监控:4字口诀
* zookeeper状态监控:4字口诀
*
*/
public class ZooKeeperState {
@ -77,7 +93,7 @@ public class ZooKeeperState {
}
scannerForWchs.close();
}
String consText = cmd("cons");
if (StringUtils.isNotBlank(consText)) {
Scanner scannerForCons = new Scanner(consText);
@ -205,7 +221,7 @@ public class ZooKeeperState {
+ ", watches=" + watches + ", connections="
+ connections + "]";
}
}

20
escheduler-api/src/main/java/cn/escheduler/api/utils/ZookeeperMonitor.java

@ -1,3 +1,19 @@
/*
* 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 cn.escheduler.api.utils;
import cn.escheduler.common.enums.ZKNodeType;
@ -57,14 +73,14 @@ public class ZookeeperMonitor extends AbstractZKClient{
if(StringUtils.isNotBlank(zookeeperServers)){
String[] zookeeperServersArray = zookeeperServers.split(",");
for (String zookeeperServer : zookeeperServersArray) {
ZooKeeperState state = new ZooKeeperState(zookeeperServer);
boolean ok = state.ruok();
if(ok){
state.getZookeeperInfo();
}
String hostName = zookeeperServer;
int connections = state.getConnections();
int watches = state.getWatches();

6
escheduler-api/src/test/java/cn/escheduler/api/HttpClientTest.java

@ -59,7 +59,7 @@ public class HttpClientTest {
try {
// execute
response = httpclient.execute(httpPost);
// eponse status code 200
// response status code 200
if (response.getStatusLine().getStatusCode() == 200) {
String content = EntityUtils.toString(response.getEntity(), "UTF-8");
logger.info(content);
@ -96,7 +96,7 @@ public class HttpClientTest {
try {
// execute http get request
response = httpclient.execute(httpGet);
// reponse status code 200
// response status code 200
if (response.getStatusLine().getStatusCode() == 200) {
String content = EntityUtils.toString(response.getEntity(), "UTF-8");
logger.info("start--------------->");
@ -139,7 +139,7 @@ public class HttpClientTest {
try {
// execute http get request
response = httpclient.execute(httpGet);
// reponse status code 200
// response status code 200
if (response.getStatusLine().getStatusCode() == 200) {
String content = EntityUtils.toString(response.getEntity(), "UTF-8");
logger.info("start--------------->");

18
escheduler-api/src/test/java/cn/escheduler/api/controller/MonitorControllerTest.java

@ -1,3 +1,19 @@
/*
* 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 cn.escheduler.api.controller;
import cn.escheduler.api.enums.Status;
@ -79,4 +95,4 @@ public class MonitorControllerTest extends AbstractControllerTest {
Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
}
}

18
escheduler-api/src/test/java/cn/escheduler/api/utils/ZookeeperMonitorUtilsTest.java

@ -1,3 +1,19 @@
/*
* 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 cn.escheduler.api.utils;
import cn.escheduler.common.model.MasterServer;
@ -27,4 +43,4 @@ public class ZookeeperMonitorUtilsTest {
}
}
}

14
escheduler-common/pom.xml

@ -83,10 +83,6 @@
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.curator</groupId>
<artifactId>curator-client</artifactId>
@ -519,6 +515,10 @@
<artifactId>log4j-web</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
<exclusion>
<artifactId>log4j-1.2-api</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
</exclusions>
</dependency>
@ -572,6 +572,12 @@
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-2.1</artifactId>
<exclusions>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api-2.5</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

18
escheduler-common/src/main/java/cn/escheduler/common/Constants.java

@ -696,6 +696,10 @@ public final class Constants {
*/
public static final String SPARK_QUEUE = "--queue";
/**
* --queue --qu
*/
public static final String FLINK_QUEUE = "--qu";
/**
* exit code success
@ -906,4 +910,18 @@ public final class Constants {
* hive conf
*/
public static final String HIVE_CONF = "hiveconf:";
//flink 任务
public static final String FLINK_YARN_CLUSTER = "yarn-cluster";
public static final String FLINK_RUN_MODE = "-m";
public static final String FLINK_YARN_SLOT = "-ys";
public static final String FLINK_APP_NAME = "-ynm";
public static final String FLINK_TASK_MANAGE = "-yn";
public static final String FLINK_JOB_MANAGE_MEM = "-yjm";
public static final String FLINK_TASK_MANAGE_MEM = "-ytm";
public static final String FLINK_detach = "-d";
public static final String FLINK_MAIN_CLASS = "-c";
}

30
escheduler-common/src/main/java/cn/escheduler/common/enums/HttpCheckCondition.java

@ -0,0 +1,30 @@
/*
* 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 cn.escheduler.common.enums;
/**
* http check condition
*/
public enum HttpCheckCondition {
/**
* 0 status_code_default:200
* 1 status_code_custom
* 2 body_contains
* 3 body_not_contains
*/
STATUS_CODE_DEFAULT,STATUS_CODE_CUSTOM, BODY_CONTAINS, BODY_NOT_CONTAINS
}

31
escheduler-common/src/main/java/cn/escheduler/common/enums/HttpMethod.java

@ -0,0 +1,31 @@
/*
* 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 cn.escheduler.common.enums;
/**
* http method
*/
public enum HttpMethod {
/**
* 0 get
* 1 post
* 2 head
* 3 put
* 4 delete
*/
GET, POST, HEAD, PUT, DELETE
}

29
escheduler-common/src/main/java/cn/escheduler/common/enums/HttpParametersType.java

@ -0,0 +1,29 @@
/*
* 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 cn.escheduler.common.enums;
/**
* http parameters type
*/
public enum HttpParametersType {
/**
* 0 parameter;
* 1 body;
* 2 headers;
*/
PARAMETER,BODY,HEADERS
}

4
escheduler-common/src/main/java/cn/escheduler/common/enums/TaskType.java

@ -29,8 +29,10 @@ public enum TaskType {
* 5 SPARK
* 6 PYTHON
* 7 DEPENDENT
* 8 FLINK
* 9 HTTP
*/
SHELL,SQL, SUB_PROCESS,PROCEDURE,MR,SPARK,PYTHON,DEPENDENT;
SHELL,SQL, SUB_PROCESS,PROCEDURE,MR,SPARK,PYTHON,DEPENDENT,FLINK,HTTP;
public static boolean typeIsNormalTask(String typeName) {
TaskType taskType = TaskType.valueOf(typeName);

17
escheduler-common/src/main/java/cn/escheduler/common/enums/ZKNodeType.java

@ -1,3 +1,20 @@
/*
* 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 cn.escheduler.common.enums;
/**

125
escheduler-common/src/main/java/cn/escheduler/common/process/HttpProperty.java

@ -0,0 +1,125 @@
/*
* 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 cn.escheduler.common.process;
import cn.escheduler.common.enums.HttpParametersType;
import java.util.Objects;
public class HttpProperty {
/**
* key
*/
private String prop;
/**
* httpParametersType
*/
private HttpParametersType httpParametersType;
/**
* value
*/
private String value;
public HttpProperty() {
}
public HttpProperty(String prop, HttpParametersType httpParametersType, String value) {
this.prop = prop;
this.httpParametersType = httpParametersType;
this.value = value;
}
/**
* getter method
*
* @return the prop
* @see HttpProperty#prop
*/
public String getProp() {
return prop;
}
/**
* setter method
*
* @param prop the prop to set
* @see HttpProperty#prop
*/
public void setProp(String prop) {
this.prop = prop;
}
/**
* getter method
*
* @return the value
* @see HttpProperty#value
*/
public String getValue() {
return value;
}
/**
* setter method
*
* @param value the value to set
* @see HttpProperty#value
*/
public void setValue(String value) {
this.value = value;
}
public HttpParametersType getHttpParametersType() {
return httpParametersType;
}
public void setHttpParametersType(HttpParametersType httpParametersType) {
this.httpParametersType = httpParametersType;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
HttpProperty property = (HttpProperty) o;
return Objects.equals(prop, property.prop) &&
Objects.equals(value, property.value);
}
@Override
public int hashCode() {
return Objects.hash(prop, value);
}
@Override
public String toString() {
return "HttpProperty{" +
"prop='" + prop + '\'' +
", httpParametersType=" + httpParametersType +
", value='" + value + '\'' +
'}';
}
}

2
escheduler-common/src/main/java/cn/escheduler/common/shell/AbstractShell.java

@ -157,7 +157,7 @@ public abstract class AbstractShell {
BufferedReader inReader =
new BufferedReader(new InputStreamReader(process
.getInputStream()));
final StringBuffer errMsg = new StringBuffer();
final StringBuilder errMsg = new StringBuilder();
// read error and input streams as this would free up the buffers
// free the error stream buffer

219
escheduler-common/src/main/java/cn/escheduler/common/task/flink/FlinkParameters.java

@ -0,0 +1,219 @@
/*
* 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 cn.escheduler.common.task.flink;
import cn.escheduler.common.enums.ProgramType;
import cn.escheduler.common.process.ResourceInfo;
import cn.escheduler.common.task.AbstractParameters;
import java.util.List;
import java.util.stream.Collectors;
/**
* spark parameters
*/
public class FlinkParameters extends AbstractParameters {
/**
* major jar
*/
private ResourceInfo mainJar;
/**
* major class
*/
private String mainClass;
/**
* deploy mode yarn-cluster yarn-client yarn-local
*/
private String deployMode;
/**
* arguments
*/
private String mainArgs;
/**
* slot个数
*/
private int slot;
/**
*Yarn application的名字
*/
private String appName;
/**
* taskManager 数量
*/
private int taskManager;
/**
* jobManagerMemory 内存大小
*/
private String jobManagerMemory ;
/**
* taskManagerMemory内存大小
*/
private String taskManagerMemory;
/**
* resource list
*/
private List<ResourceInfo> resourceList;
/**
* The YARN queue to submit to
*/
private String queue;
/**
* other arguments
*/
private String others;
/**
* program type
* 0 JAVA,1 SCALA,2 PYTHON
*/
private ProgramType programType;
public ResourceInfo getMainJar() {
return mainJar;
}
public void setMainJar(ResourceInfo mainJar) {
this.mainJar = mainJar;
}
public String getMainClass() {
return mainClass;
}
public void setMainClass(String mainClass) {
this.mainClass = mainClass;
}
public String getDeployMode() {
return deployMode;
}
public void setDeployMode(String deployMode) {
this.deployMode = deployMode;
}
public String getMainArgs() {
return mainArgs;
}
public void setMainArgs(String mainArgs) {
this.mainArgs = mainArgs;
}
public int getSlot() {
return slot;
}
public void setSlot(int slot) {
this.slot = slot;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public int getTaskManager() {
return taskManager;
}
public void setTaskManager(int taskManager) {
this.taskManager = taskManager;
}
public String getJobManagerMemory() {
return jobManagerMemory;
}
public void setJobManagerMemory(String jobManagerMemory) {
this.jobManagerMemory = jobManagerMemory;
}
public String getTaskManagerMemory() {
return taskManagerMemory;
}
public void setTaskManagerMemory(String taskManagerMemory) {
this.taskManagerMemory = taskManagerMemory;
}
public String getQueue() {
return queue;
}
public void setQueue(String queue) {
this.queue = queue;
}
public List<ResourceInfo> getResourceList() {
return resourceList;
}
public void setResourceList(List<ResourceInfo> resourceList) {
this.resourceList = resourceList;
}
public String getOthers() {
return others;
}
public void setOthers(String others) {
this.others = others;
}
public ProgramType getProgramType() {
return programType;
}
public void setProgramType(ProgramType programType) {
this.programType = programType;
}
@Override
public boolean checkParameters() {
return mainJar != null && programType != null;
}
@Override
public List<String> getResourceFilesList() {
if(resourceList !=null ) {
this.resourceList.add(mainJar);
return resourceList.stream()
.map(p -> p.getRes()).collect(Collectors.toList());
}
return null;
}
}

108
escheduler-common/src/main/java/cn/escheduler/common/task/http/HttpParameters.java

@ -0,0 +1,108 @@
/*
* 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 cn.escheduler.common.task.http;
import cn.escheduler.common.enums.HttpCheckCondition;
import cn.escheduler.common.enums.HttpMethod;
import cn.escheduler.common.process.HttpProperty;
import cn.escheduler.common.task.AbstractParameters;
import org.apache.commons.lang.StringUtils;
import java.util.ArrayList;
import java.util.List;
/**
* http parameter
*/
public class HttpParameters extends AbstractParameters {
/**
* url
*/
private String url;
/**
* httpMethod
*/
private HttpMethod httpMethod;
/**
* http params
*/
private List<HttpProperty> httpParams;
/**
* httpCheckCondition
*/
private HttpCheckCondition httpCheckCondition = HttpCheckCondition.STATUS_CODE_DEFAULT;
/**
* condition
*/
private String condition;
@Override
public boolean checkParameters() {
return StringUtils.isNotEmpty(url);
}
@Override
public List<String> getResourceFilesList() {
return new ArrayList<>();
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public HttpMethod getHttpMethod() {
return httpMethod;
}
public void setHttpMethod(HttpMethod httpMethod) {
this.httpMethod = httpMethod;
}
public List<HttpProperty> getHttpParams() {
return httpParams;
}
public void setHttpParams(List<HttpProperty> httpParams) {
this.httpParams = httpParams;
}
public HttpCheckCondition getHttpCheckCondition() {
return httpCheckCondition;
}
public void setHttpCheckCondition(HttpCheckCondition httpCheckCondition) {
this.httpCheckCondition = httpCheckCondition;
}
public String getCondition() {
return condition;
}
public void setCondition(String condition) {
this.condition = condition;
}
}

2
escheduler-common/src/main/java/cn/escheduler/common/thread/ThreadPoolExecutors.java

@ -40,7 +40,7 @@ public class ThreadPoolExecutors {
private static final Logger logger = LoggerFactory.getLogger(ThreadPoolExecutors.class);
private static Executor executor;
private static ThreadPoolExecutors threadPoolExecutors;
private static volatile ThreadPoolExecutors threadPoolExecutors;
private ThreadPoolExecutors(){}

4
escheduler-common/src/main/java/cn/escheduler/common/utils/HadoopUtils.java

@ -288,9 +288,11 @@ public class HadoopUtils implements Closeable {
if (dstPath.isFile()) {
if (overwrite) {
dstPath.delete();
}else{
throw new IOException("destination file already exists!");
}
} else {
logger.error("destination file must be a file");
throw new IOException("destination file must be a file!");
}
}

6
escheduler-common/src/main/java/cn/escheduler/common/utils/TaskParametersUtils.java

@ -19,6 +19,8 @@ package cn.escheduler.common.utils;
import cn.escheduler.common.enums.TaskType;
import cn.escheduler.common.task.AbstractParameters;
import cn.escheduler.common.task.dependent.DependentParameters;
import cn.escheduler.common.task.flink.FlinkParameters;
import cn.escheduler.common.task.http.HttpParameters;
import cn.escheduler.common.task.mr.MapreduceParameters;
import cn.escheduler.common.task.procedure.ProcedureParameters;
import cn.escheduler.common.task.python.PythonParameters;
@ -63,6 +65,10 @@ public class TaskParametersUtils {
return JSONUtils.parseObject(parameter, PythonParameters.class);
case DEPENDENT:
return JSONUtils.parseObject(parameter, DependentParameters.class);
case FLINK:
return JSONUtils.parseObject(parameter, FlinkParameters.class);
case HTTP:
return JSONUtils.parseObject(parameter, HttpParameters.class);
default:
return null;
}

2
escheduler-common/src/main/resources/common/common.properties

@ -35,7 +35,7 @@ login.user.keytab.path=/opt/hdfs.headless.keytab
escheduler.env.path=/opt/.escheduler_env.sh
#resource.view.suffixs
resource.view.suffixs=txt,log,sh,conf,cfg,py,java,sql,hql,xml
resource.view.suffixs=txt,log,sh,conf,cfg,py,java,sql,hql,xml,properties
# is development state? default "false"
development.state=true

19
escheduler-common/src/test/java/cn/escheduler/common/utils/IpUtilsTest.java

@ -1,3 +1,20 @@
/*
* 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 cn.escheduler.common.utils;
import org.junit.Assert;
@ -38,4 +55,4 @@ public class IpUtilsTest {
Assert.assertEquals(ip, i1);
Assert.assertEquals(ip2, i2);
}
}
}

4
escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java

@ -1024,11 +1024,11 @@ public class ProcessDao extends AbstractBaseDao {
}
/**
* ${processInstancePriority}_${processInstanceId}_${taskInstancePriority}_${taskId}_${task executed by ip1},${ip2}...
* ${processInstancePriority}_${processInstanceId}_${taskInstancePriority}_${taskInstanceId}_${task executed by ip1},${ip2}...
*
* The tasks with the highest priority are selected by comparing the priorities of the above four levels from high to low.
*
* 流程实例优先级_流程实例id_任务优先级_任务id_任务执行机器ip1ip2... high <- low
* 流程实例优先级_流程实例id_任务优先级_任务实例id_任务执行机器ip1ip2... high <- low
*
* @param taskInstance
* @return

16
escheduler-dao/src/main/java/cn/escheduler/dao/mapper/ErrorCommandMapperProvider.java

@ -1,3 +1,19 @@
/*
* 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 cn.escheduler.dao.mapper;
import cn.escheduler.common.enums.*;

8
escheduler-dao/src/main/java/cn/escheduler/dao/mapper/ProcessInstanceMapperProvider.java

@ -354,7 +354,7 @@ public class ProcessInstanceMapperProvider {
* @return
*/
public String listByStatus(Map<String, Object> parameter) {
StringBuffer strStates = new StringBuffer();
StringBuilder strStates = new StringBuilder();
int[] stateArray = (int[]) parameter.get("states");
for(int i=0;i<stateArray.length;i++){
@ -387,7 +387,7 @@ public class ProcessInstanceMapperProvider {
* @return
*/
public String queryByHostAndStatus(Map<String, Object> parameter) {
StringBuffer strStates = new StringBuffer();
StringBuilder strStates = new StringBuilder();
int[] stateArray = (int[]) parameter.get("states");
for(int i=0;i<stateArray.length;i++){
@ -425,7 +425,7 @@ public class ProcessInstanceMapperProvider {
* @return
*/
public String setFailoverByHostAndStateArray(Map<String, Object> parameter) {
StringBuffer strStates = new StringBuffer();
StringBuilder strStates = new StringBuilder();
int[] stateArray = (int[]) parameter.get("states");
for(int i=0;i<stateArray.length;i++){
@ -563,7 +563,7 @@ public class ProcessInstanceMapperProvider {
}
public String queryLastRunningProcess(Map<String, Object> parameter) {
StringBuffer strStates = new StringBuffer();
StringBuilder strStates = new StringBuilder();
int[] stateArray = (int[]) parameter.get("states");
for(int i=0;i<stateArray.length;i++){

2
escheduler-dao/src/main/java/cn/escheduler/dao/mapper/ScheduleMapperProvider.java

@ -163,7 +163,7 @@ public class ScheduleMapperProvider {
*/
public String selectAllByProcessDefineArray(Map<String, Object> parameter) {
StringBuffer strIds = new StringBuffer();
StringBuilder strIds = new StringBuilder();
int[] idsArray = (int[]) parameter.get("processDefineIds");
for(int i=0;i<idsArray.length;i++){
strIds.append(idsArray[i]);

8
escheduler-dao/src/main/java/cn/escheduler/dao/mapper/TaskInstanceMapperProvider.java

@ -213,7 +213,7 @@ public class TaskInstanceMapperProvider {
* @return
*/
public String queryByHostAndStatus(Map<String, Object> parameter) {
StringBuffer strStates = new StringBuffer();
StringBuilder strStates = new StringBuilder();
int[] stateArray = (int[]) parameter.get("states");
for(int i=0;i<stateArray.length;i++){
strStates.append(stateArray[i]);
@ -246,7 +246,7 @@ public class TaskInstanceMapperProvider {
* @return
*/
public String queryLimitNumByHostAndStatus(Map<String, Object> parameter) {
StringBuffer strStates = new StringBuffer();
StringBuilder strStates = new StringBuilder();
int[] stateArray = (int[]) parameter.get("states");
for(int i=0;i<stateArray.length;i++){
strStates.append(stateArray[i]);
@ -278,7 +278,7 @@ public class TaskInstanceMapperProvider {
* @return
*/
public String setFailoverByHostAndStateArray(Map<String, Object> parameter) {
StringBuffer strStates = new StringBuffer();
StringBuilder strStates = new StringBuilder();
int[] stateArray = (int[]) parameter.get("states");
int state = ExecutionStatus.NEED_FAULT_TOLERANCE.ordinal();
for(int i=0;i<stateArray.length;i++){
@ -419,7 +419,7 @@ public class TaskInstanceMapperProvider {
*/
public String countTask(Map<String, Object> parameter){
StringBuffer taskIdsStr = new StringBuffer();
StringBuilder taskIdsStr = new StringBuilder();
int[] stateArray = (int[]) parameter.get("taskIds");
for(int i=0;i<stateArray.length;i++){
taskIdsStr.append(stateArray[i]);

13
escheduler-dao/src/main/java/cn/escheduler/dao/upgrade/DolphinSchedulerManager.java

@ -81,7 +81,9 @@ public class DolphinSchedulerManager {
String version = "";
// Gets the version of the current system
if (upgradeDao.isExistsTable("t_escheduler_version")) {
version = upgradeDao.getCurrentVersion();
version = upgradeDao.getCurrentVersion("t_escheduler_version");
}else if(upgradeDao.isExistsTable("t_dolphinscheduler_version")){
version = upgradeDao.getCurrentVersion("t_dolphinscheduler_version");
}else if(upgradeDao.isExistsColumn("t_escheduler_queue","create_time")){
version = "1.0.1";
}else if(upgradeDao.isExistsTable("t_escheduler_queue")){
@ -93,21 +95,14 @@ public class DolphinSchedulerManager {
// The target version of the upgrade
String schemaVersion = "";
for(String schemaDir : schemaList) {
schemaVersion = schemaDir.split("_")[0];
if(SchemaUtils.isAGreatVersion(schemaVersion , version)) {
logger.info("upgrade DolphinScheduler metadata version from " + version + " to " + schemaVersion);
logger.info("Begin upgrading DolphinScheduler's table structure");
upgradeDao.upgradeDolphinScheduler(schemaDir);
if(SchemaUtils.isAGreatVersion(version,"1.0.1")){
version = upgradeDao.getCurrentVersion();
}else {
version = schemaVersion;
}
version = schemaVersion;
}
}

9
escheduler-dao/src/main/java/cn/escheduler/dao/upgrade/MysqlUpgradeDao.java

@ -28,8 +28,6 @@ import java.sql.SQLException;
public class MysqlUpgradeDao extends UpgradeDao {
public static final Logger logger = LoggerFactory.getLogger(UpgradeDao.class);
private static final String T_VERSION_NAME = "t_escheduler_version";
private static final String rootDir = System.getProperty("user.dir");
@Override
protected void init() {
@ -54,10 +52,11 @@ public class MysqlUpgradeDao extends UpgradeDao {
* @return
*/
public boolean isExistsTable(String tableName) {
ResultSet rs = null;
Connection conn = null;
try {
conn = ConnectionFactory.getDataSource().getConnection();
ResultSet rs = conn.getMetaData().getTables(null, null, tableName, null);
rs = conn.getMetaData().getTables(null, null, tableName, null);
if (rs.next()) {
return true;
} else {
@ -68,8 +67,7 @@ public class MysqlUpgradeDao extends UpgradeDao {
logger.error(e.getMessage(),e);
throw new RuntimeException(e.getMessage(),e);
} finally {
ConnectionUtils.releaseResource(null, null, conn);
ConnectionUtils.releaseResource(rs, null, conn);
}
}
@ -96,7 +94,6 @@ public class MysqlUpgradeDao extends UpgradeDao {
throw new RuntimeException(e.getMessage(),e);
} finally {
ConnectionUtils.releaseResource(null, null, conn);
}
}

21
escheduler-dao/src/main/java/cn/escheduler/dao/upgrade/PostgresqlUpgradeDao.java

@ -29,8 +29,6 @@ import java.sql.SQLException;
public class PostgresqlUpgradeDao extends UpgradeDao {
public static final Logger logger = LoggerFactory.getLogger(UpgradeDao.class);
private static final String T_VERSION_NAME = "t_escheduler_version";
private static final String rootDir = System.getProperty("user.dir");
private static final String schema = getSchema();
@Override
@ -55,23 +53,24 @@ public class PostgresqlUpgradeDao extends UpgradeDao {
super.initSchema(initSqlPath);
}
private static String getSchema(){
public static String getSchema(){
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet resultSet = null;
try {
conn = ConnectionFactory.getDataSource().getConnection();
pstmt = conn.prepareStatement("select current_schema()");
ResultSet resultSet = pstmt.executeQuery();
resultSet = pstmt.executeQuery();
while (resultSet.next()){
if(resultSet.isFirst()){
return resultSet.getString(1);
}
}
} catch (SQLException e) {
logger.error(e.getMessage(),e);
} finally {
ConnectionUtils.releaseResource(null, null, conn);
ConnectionUtils.releaseResource(resultSet, pstmt, conn);
}
return "";
}
@ -83,10 +82,11 @@ public class PostgresqlUpgradeDao extends UpgradeDao {
*/
public boolean isExistsTable(String tableName) {
Connection conn = null;
ResultSet rs = null;
try {
conn = ConnectionFactory.getDataSource().getConnection();
ResultSet rs = conn.getMetaData().getTables(null, schema, tableName, null);
rs = conn.getMetaData().getTables(null, schema, tableName, null);
if (rs.next()) {
return true;
} else {
@ -97,7 +97,7 @@ public class PostgresqlUpgradeDao extends UpgradeDao {
logger.error(e.getMessage(),e);
throw new RuntimeException(e.getMessage(),e);
} finally {
ConnectionUtils.releaseResource(null, null, conn);
ConnectionUtils.releaseResource(rs, null, conn);
}
}
@ -110,9 +110,10 @@ public class PostgresqlUpgradeDao extends UpgradeDao {
*/
public boolean isExistsColumn(String tableName,String columnName) {
Connection conn = null;
ResultSet rs = null;
try {
conn = ConnectionFactory.getDataSource().getConnection();
ResultSet rs = conn.getMetaData().getColumns(null,schema,tableName,columnName);
rs = conn.getMetaData().getColumns(null,schema,tableName,columnName);
if (rs.next()) {
return true;
} else {
@ -123,7 +124,7 @@ public class PostgresqlUpgradeDao extends UpgradeDao {
logger.error(e.getMessage(),e);
throw new RuntimeException(e.getMessage(),e);
} finally {
ConnectionUtils.releaseResource(null, null, conn);
ConnectionUtils.releaseResource(rs, null, conn);
}

34
escheduler-dao/src/main/java/cn/escheduler/dao/upgrade/UpgradeDao.java

@ -18,6 +18,7 @@ package cn.escheduler.dao.upgrade;
import cn.escheduler.common.enums.DbType;
import cn.escheduler.common.utils.ConnectionUtils;
import cn.escheduler.common.utils.SchemaUtils;
import cn.escheduler.common.utils.ScriptRunner;
import cn.escheduler.dao.AbstractBaseDao;
import cn.escheduler.dao.datasource.ConnectionFactory;
@ -36,7 +37,9 @@ public abstract class UpgradeDao extends AbstractBaseDao {
public static final Logger logger = LoggerFactory.getLogger(UpgradeDao.class);
private static final String T_VERSION_NAME = "t_escheduler_version";
private static final String T_NEW_VERSION_NAME = "t_dolphinscheduler_version";
private static final String rootDir = System.getProperty("user.dir");
private static final DbType dbType = getCurrentDbType();
@Override
protected void init() {
@ -48,13 +51,24 @@ public abstract class UpgradeDao extends AbstractBaseDao {
* @return
*/
public static DbType getDbType(){
return dbType;
}
/**
* get db type
* @return
*/
private static DbType getCurrentDbType(){
Connection conn = null;
try {
Connection conn = ConnectionFactory.getDataSource().getConnection();
conn = ConnectionFactory.getDataSource().getConnection();
String name = conn.getMetaData().getDatabaseProductName().toUpperCase();
return DbType.valueOf(name);
} catch (Exception e) {
logger.error(e.getMessage(),e);
return null;
}finally {
ConnectionUtils.releaseResource(null, null, conn);
}
}
@ -175,8 +189,8 @@ public abstract class UpgradeDao extends AbstractBaseDao {
public abstract boolean isExistsColumn(String tableName,String columnName);
public String getCurrentVersion() {
String sql = String.format("select version from %s",T_VERSION_NAME);
public String getCurrentVersion(String versionName) {
String sql = String.format("select version from %s",versionName);
Connection conn = null;
ResultSet rs = null;
PreparedStatement pstmt = null;
@ -231,6 +245,12 @@ public abstract class UpgradeDao extends AbstractBaseDao {
pstmt = conn.prepareStatement(upgradeSQL);
pstmt.setString(1, schemaVersion);
pstmt.executeUpdate();
}else if (isExistsTable(T_NEW_VERSION_NAME)) {
// Change version in the version table to the new version
String upgradeSQL = String.format("update %s set version = ?",T_NEW_VERSION_NAME);
pstmt = conn.prepareStatement(upgradeSQL);
pstmt.setString(1, schemaVersion);
pstmt.executeUpdate();
}
conn.commit();
} catch (FileNotFoundException e) {
@ -275,7 +295,7 @@ public abstract class UpgradeDao extends AbstractBaseDao {
if (StringUtils.isEmpty(rootDir)) {
throw new RuntimeException("Environment variable user.dir not found");
}
String mysqlSQLFilePath = MessageFormat.format("{0}/sql/upgrade/{1}/{2}/dolphinscheduler_dml.sql",rootDir,schemaDir,getDbType().name().toLowerCase());
String mysqlSQLFilePath = MessageFormat.format("{0}/sql/upgrade/{1}/{2}/dolphinscheduler_ddl.sql",rootDir,schemaDir,getDbType().name().toLowerCase());
Connection conn = null;
PreparedStatement pstmt = null;
try {
@ -314,7 +334,11 @@ public abstract class UpgradeDao extends AbstractBaseDao {
public void updateVersion(String version) {
// Change version in the version table to the new version
String upgradeSQL = String.format("update %s set version = ?",T_VERSION_NAME);
String versionName = T_VERSION_NAME;
if(!SchemaUtils.isAGreatVersion("1.2.0" , version)){
versionName = "t_dolphinscheduler_version";
}
String upgradeSQL = String.format("update %s set version = ?",versionName);
PreparedStatement pstmt = null;
Connection conn = null;
try {

28
escheduler-rpc/src/main/java/cn/escheduler/rpc/LogViewServiceGrpc.java

@ -1,3 +1,19 @@
/*
* 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 cn.escheduler.rpc;
import static io.grpc.MethodDescriptor.generateFullMethodName;
@ -32,7 +48,7 @@ public final class LogViewServiceGrpc {
// Static method descriptors that strictly reflect the proto.
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
@java.lang.Deprecated // Use {@link #getRollViewLogMethod()} instead.
@java.lang.Deprecated // Use {@link #getRollViewLogMethod()} instead.
public static final io.grpc.MethodDescriptor<cn.escheduler.rpc.LogParameter,
cn.escheduler.rpc.RetStrInfo> METHOD_ROLL_VIEW_LOG = getRollViewLogMethod();
@ -46,7 +62,7 @@ public final class LogViewServiceGrpc {
if ((getRollViewLogMethod = LogViewServiceGrpc.getRollViewLogMethod) == null) {
synchronized (LogViewServiceGrpc.class) {
if ((getRollViewLogMethod = LogViewServiceGrpc.getRollViewLogMethod) == null) {
LogViewServiceGrpc.getRollViewLogMethod = getRollViewLogMethod =
LogViewServiceGrpc.getRollViewLogMethod = getRollViewLogMethod =
io.grpc.MethodDescriptor.<cn.escheduler.rpc.LogParameter, cn.escheduler.rpc.RetStrInfo>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(
@ -64,7 +80,7 @@ public final class LogViewServiceGrpc {
return getRollViewLogMethod;
}
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
@java.lang.Deprecated // Use {@link #getViewLogMethod()} instead.
@java.lang.Deprecated // Use {@link #getViewLogMethod()} instead.
public static final io.grpc.MethodDescriptor<cn.escheduler.rpc.PathParameter,
cn.escheduler.rpc.RetStrInfo> METHOD_VIEW_LOG = getViewLogMethod();
@ -78,7 +94,7 @@ public final class LogViewServiceGrpc {
if ((getViewLogMethod = LogViewServiceGrpc.getViewLogMethod) == null) {
synchronized (LogViewServiceGrpc.class) {
if ((getViewLogMethod = LogViewServiceGrpc.getViewLogMethod) == null) {
LogViewServiceGrpc.getViewLogMethod = getViewLogMethod =
LogViewServiceGrpc.getViewLogMethod = getViewLogMethod =
io.grpc.MethodDescriptor.<cn.escheduler.rpc.PathParameter, cn.escheduler.rpc.RetStrInfo>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(
@ -96,7 +112,7 @@ public final class LogViewServiceGrpc {
return getViewLogMethod;
}
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
@java.lang.Deprecated // Use {@link #getGetLogBytesMethod()} instead.
@java.lang.Deprecated // Use {@link #getGetLogBytesMethod()} instead.
public static final io.grpc.MethodDescriptor<cn.escheduler.rpc.PathParameter,
cn.escheduler.rpc.RetByteInfo> METHOD_GET_LOG_BYTES = getGetLogBytesMethod();
@ -110,7 +126,7 @@ public final class LogViewServiceGrpc {
if ((getGetLogBytesMethod = LogViewServiceGrpc.getGetLogBytesMethod) == null) {
synchronized (LogViewServiceGrpc.class) {
if ((getGetLogBytesMethod = LogViewServiceGrpc.getGetLogBytesMethod) == null) {
LogViewServiceGrpc.getGetLogBytesMethod = getGetLogBytesMethod =
LogViewServiceGrpc.getGetLogBytesMethod = getGetLogBytesMethod =
io.grpc.MethodDescriptor.<cn.escheduler.rpc.PathParameter, cn.escheduler.rpc.RetByteInfo>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(

2
escheduler-server/src/main/java/cn/escheduler/server/rpc/LoggerServer.java

@ -98,7 +98,6 @@ public class LoggerServer {
request.getLimit());
List<String> list = readFile(request.getPath(), request.getSkipLineNum(), request.getLimit());
StringBuilder sb = new StringBuilder();
boolean errorLineFlag = false;
for (String line : list){
sb.append(line + "\r\n");
}
@ -196,7 +195,6 @@ public class LoggerServer {
StringBuilder sb = new StringBuilder();
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(path)));
boolean errorLineFlag = false;
while ((line = br.readLine()) != null){
sb.append(line + "\r\n");
}

124
escheduler-server/src/main/java/cn/escheduler/server/utils/FlinkArgsUtils.java

@ -0,0 +1,124 @@
/*
* 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 cn.escheduler.server.utils;
import cn.escheduler.common.Constants;
import cn.escheduler.common.enums.ProgramType;
import cn.escheduler.common.task.flink.FlinkParameters;
import org.apache.commons.lang.StringUtils;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
/**
* spark args utils
*/
public class FlinkArgsUtils {
/**
* build args
*
* @param param
* @return
*/
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(FlinkArgsUtils.class);
public static List<String> buildArgs(FlinkParameters param) {
List<String> args = new ArrayList<>();
String deployMode = "cluster";
if (StringUtils.isNotEmpty(param.getDeployMode())) {
deployMode = param.getDeployMode();
}
if (!"local".equals(deployMode)) {
args.add(Constants.FLINK_RUN_MODE); //-m
args.add(Constants.FLINK_YARN_CLUSTER); //yarn-cluster
if (param.getSlot() != 0) {
args.add(Constants.FLINK_YARN_SLOT);
args.add(String.format("%d", param.getSlot())); //-ys
}
if (StringUtils.isNotEmpty(param.getAppName())) { //-ynm
args.add(Constants.FLINK_APP_NAME);
args.add(param.getAppName());
}
if (param.getTaskManager() != 0) { //-yn
args.add(Constants.FLINK_TASK_MANAGE);
args.add(String.format("%d", param.getTaskManager()));
}
if (StringUtils.isNotEmpty(param.getJobManagerMemory())) {
args.add(Constants.FLINK_JOB_MANAGE_MEM);
args.add(param.getJobManagerMemory()); //-yjm
}
if (StringUtils.isNotEmpty(param.getTaskManagerMemory())) { // -ytm
args.add(Constants.FLINK_TASK_MANAGE_MEM);
args.add(param.getTaskManagerMemory());
}
args.add(Constants.FLINK_detach); //-d
}
if (param.getProgramType() != null) {
if (param.getProgramType() != ProgramType.PYTHON) {
if (StringUtils.isNotEmpty(param.getMainClass())) {
args.add(Constants.FLINK_MAIN_CLASS); //-c
args.add(param.getMainClass()); //main class
}
}
}
if (param.getMainJar() != null) {
args.add(param.getMainJar().getRes());
}
if (StringUtils.isNotEmpty(param.getMainArgs())) {
args.add(param.getMainArgs());
}
// --files --conf --libjar ...
if (StringUtils.isNotEmpty(param.getOthers())) {
String others = param.getOthers();
if (!others.contains("--qu")) {
if (StringUtils.isNotEmpty(param.getQueue()) && !deployMode.equals("local")) {
args.add(Constants.FLINK_QUEUE);
args.add(param.getQueue());
}
}
args.add(param.getOthers());
} else if (StringUtils.isNotEmpty(param.getQueue()) && !deployMode.equals("local")) {
args.add(Constants.FLINK_QUEUE);
args.add(param.getQueue());
}
return args;
}
}

3
escheduler-server/src/main/java/cn/escheduler/server/worker/task/AbstractTask.java

@ -22,6 +22,7 @@ import cn.escheduler.common.enums.TaskRecordStatus;
import cn.escheduler.common.enums.TaskType;
import cn.escheduler.common.process.Property;
import cn.escheduler.common.task.AbstractParameters;
import cn.escheduler.common.task.flink.FlinkParameters;
import cn.escheduler.common.task.mr.MapreduceParameters;
import cn.escheduler.common.task.procedure.ProcedureParameters;
import cn.escheduler.common.task.python.PythonParameters;
@ -178,6 +179,8 @@ public abstract class AbstractTask {
case SPARK:
paramsClass = SparkParameters.class;
break;
case FLINK:
paramsClass = FlinkParameters.class;
case PYTHON:
paramsClass = PythonParameters.class;
break;

6
escheduler-server/src/main/java/cn/escheduler/server/worker/task/TaskManager.java

@ -19,6 +19,8 @@ package cn.escheduler.server.worker.task;
import cn.escheduler.common.enums.TaskType;
import cn.escheduler.server.worker.task.dependent.DependentTask;
import cn.escheduler.server.worker.task.flink.FlinkTask;
import cn.escheduler.server.worker.task.http.HttpTask;
import cn.escheduler.server.worker.task.mr.MapReduceTask;
import cn.escheduler.server.worker.task.processdure.ProcedureTask;
import cn.escheduler.server.worker.task.python.PythonTask;
@ -55,10 +57,14 @@ public class TaskManager {
return new MapReduceTask(props, logger);
case SPARK:
return new SparkTask(props, logger);
case FLINK:
return new FlinkTask(props, logger);
case PYTHON:
return new PythonTask(props, logger);
case DEPENDENT:
return new DependentTask(props, logger);
case HTTP:
return new HttpTask(props, logger);
default:
logger.error("unsupport task type: {}", taskType);
throw new IllegalArgumentException("not support task type");

118
escheduler-server/src/main/java/cn/escheduler/server/worker/task/flink/FlinkTask.java

@ -0,0 +1,118 @@
/*
* 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 cn.escheduler.server.worker.task.flink;
import cn.escheduler.common.process.Property;
import cn.escheduler.common.task.AbstractParameters;
import cn.escheduler.common.task.flink.FlinkParameters;
import cn.escheduler.common.utils.JSONUtils;
import cn.escheduler.common.utils.ParameterUtils;
import cn.escheduler.dao.model.ProcessInstance;
import cn.escheduler.server.utils.FlinkArgsUtils;
import cn.escheduler.server.utils.ParamUtils;
import cn.escheduler.server.worker.task.AbstractYarnTask;
import cn.escheduler.server.worker.task.TaskProps;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* flink task
*/
public class FlinkTask extends AbstractYarnTask {
/**
* flink command
*/
private static final String FLINK_COMMAND = "flink";
private static final String FLINK_RUN = "run";
/**
* flink parameters
*/
private FlinkParameters flinkParameters;
public FlinkTask(TaskProps props, Logger logger) {
super(props, logger);
}
@Override
public void init() {
logger.info("flink task params {}", taskProps.getTaskParams());
flinkParameters = JSONUtils.parseObject(taskProps.getTaskParams(), FlinkParameters.class);
if (!flinkParameters.checkParameters()) {
throw new RuntimeException("flink task params is not valid");
}
flinkParameters.setQueue(taskProps.getQueue());
if (StringUtils.isNotEmpty(flinkParameters.getMainArgs())) {
String args = flinkParameters.getMainArgs();
// get process instance by task instance id
ProcessInstance processInstance = processDao.findProcessInstanceByTaskId(taskProps.getTaskInstId());
/**
* combining local and global parameters
*/
Map<String, Property> paramsMap = ParamUtils.convert(taskProps.getUserDefParamsMap(),
taskProps.getDefinedParams(),
flinkParameters.getLocalParametersMap(),
processInstance.getCmdTypeIfComplement(),
processInstance.getScheduleTime());
logger.info("param Map : {}", paramsMap);
if (paramsMap != null ){
args = ParameterUtils.convertParameterPlaceholders(args, ParamUtils.convert(paramsMap));
logger.info("param args : {}", args);
}
flinkParameters.setMainArgs(args);
}
}
/**
* create command
* @return
*/
@Override
protected String buildCommand() {
List<String> args = new ArrayList<>();
args.add(FLINK_COMMAND);
args.add(FLINK_RUN);
logger.info("flink task args : {}", args);
// other parameters
args.addAll(FlinkArgsUtils.buildArgs(flinkParameters));
String command = ParameterUtils
.convertParameterPlaceholders(String.join(" ", args), taskProps.getDefinedParams());
logger.info("flink task command : {}", command);
return command;
}
@Override
public AbstractParameters getParameters() {
return flinkParameters;
}
}

270
escheduler-server/src/main/java/cn/escheduler/server/worker/task/http/HttpTask.java

@ -0,0 +1,270 @@
/*
* 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 cn.escheduler.server.worker.task.http;
import cn.escheduler.common.enums.HttpMethod;
import cn.escheduler.common.enums.HttpParametersType;
import cn.escheduler.common.process.HttpProperty;
import cn.escheduler.common.process.Property;
import cn.escheduler.common.task.AbstractParameters;
import cn.escheduler.common.task.http.HttpParameters;
import cn.escheduler.common.utils.Bytes;
import cn.escheduler.common.utils.DateUtils;
import cn.escheduler.common.utils.ParameterUtils;
import cn.escheduler.dao.DaoFactory;
import cn.escheduler.dao.ProcessDao;
import cn.escheduler.dao.model.ProcessInstance;
import cn.escheduler.server.utils.ParamUtils;
import cn.escheduler.server.worker.task.AbstractTask;
import cn.escheduler.server.worker.task.TaskProps;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.io.Charsets;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.ParseException;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.methods.RequestBuilder;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* http task
*/
public class HttpTask extends AbstractTask {
private HttpParameters httpParameters;
/**
* process database access
*/
private ProcessDao processDao;
/**
* Convert mill seconds to second unit
*/
protected static final int MAX_CONNECTION_MILLISECONDS = 60000;
protected static final String APPLICATION_JSON = "application/json";
protected String output;
public HttpTask(TaskProps props, Logger logger) {
super(props, logger);
this.processDao = DaoFactory.getDaoInstance(ProcessDao.class);
}
@Override
public void init() {
logger.info("http task params {}", taskProps.getTaskParams());
this.httpParameters = JSONObject.parseObject(taskProps.getTaskParams(), HttpParameters.class);
if (!httpParameters.checkParameters()) {
throw new RuntimeException("http task params is not valid");
}
}
@Override
public void handle() throws Exception {
String threadLoggerInfoName = String.format("TaskLogInfo-%s", taskProps.getTaskAppId());
Thread.currentThread().setName(threadLoggerInfoName);
long startTime = System.currentTimeMillis();
String statusCode = null;
String body = null;
try(CloseableHttpClient client = createHttpClient()) {
try(CloseableHttpResponse response = sendRequest(client)) {
statusCode = String.valueOf(getStatusCode(response));
body = getResponseBody(response);
exitStatusCode = validResponse(body, statusCode);
long costTime = System.currentTimeMillis() - startTime;
logger.info("startTime: {}, httpUrl: {}, httpMethod: {}, costTime : {}Millisecond, statusCode : {}, body : {}, log : {}",
DateUtils.format2Readable(startTime), httpParameters.getUrl(),httpParameters.getHttpMethod(), costTime, statusCode, body, output);
}catch (Exception e) {
appendMessage(e.toString());
exitStatusCode = -1;
logger.error("httpUrl[" + httpParameters.getUrl() + "] connection failed:"+output, e);
}
} catch (Exception e) {
appendMessage(e.toString());
exitStatusCode = -1;
logger.error("httpUrl[" + httpParameters.getUrl() + "] connection failed:"+output, e);
}
}
protected CloseableHttpResponse sendRequest(CloseableHttpClient client) throws IOException {
RequestBuilder builder = createRequestBuilder();
ProcessInstance processInstance = processDao.findProcessInstanceByTaskId(taskProps.getTaskInstId());
Map<String, Property> paramsMap = ParamUtils.convert(taskProps.getUserDefParamsMap(),
taskProps.getDefinedParams(),
httpParameters.getLocalParametersMap(),
processInstance.getCmdTypeIfComplement(),
processInstance.getScheduleTime());
List<HttpProperty> httpPropertyList = new ArrayList<>();
if(httpParameters.getHttpParams() != null && httpParameters.getHttpParams().size() > 0){
for (HttpProperty httpProperty: httpParameters.getHttpParams()) {
String jsonObject = JSONObject.toJSONString(httpProperty);
String params = ParameterUtils.convertParameterPlaceholders(jsonObject,ParamUtils.convert(paramsMap));
logger.info("http request params:{}",params);
httpPropertyList.add(JSONObject.parseObject(params,HttpProperty.class));
}
}
addRequestParams(builder,httpPropertyList);
HttpUriRequest request = builder.setUri(httpParameters.getUrl()).build();
setHeaders(request,httpPropertyList);
return client.execute(request);
}
protected String getResponseBody(CloseableHttpResponse httpResponse) throws ParseException, IOException {
if (httpResponse == null) {
return null;
}
HttpEntity entity = httpResponse.getEntity();
if (entity == null) {
return null;
}
String webPage = EntityUtils.toString(entity, Bytes.UTF8_ENCODING);
return webPage;
}
protected int getStatusCode(CloseableHttpResponse httpResponse) {
int status = httpResponse.getStatusLine().getStatusCode();
return status;
}
protected int validResponse(String body, String statusCode){
int exitStatusCode = 0;
switch (httpParameters.getHttpCheckCondition()) {
case BODY_CONTAINS:
if (StringUtils.isEmpty(body) || !body.contains(httpParameters.getCondition())) {
appendMessage(httpParameters.getUrl() + " doesn contain "
+ httpParameters.getCondition());
exitStatusCode = -1;
}
break;
case BODY_NOT_CONTAINS:
if (StringUtils.isEmpty(body) || body.contains(httpParameters.getCondition())) {
appendMessage(httpParameters.getUrl() + " contains "
+ httpParameters.getCondition());
exitStatusCode = -1;
}
break;
case STATUS_CODE_CUSTOM:
if (!statusCode.equals(httpParameters.getCondition())) {
appendMessage(httpParameters.getUrl() + " statuscode: " + statusCode + ", Must be: " + httpParameters.getCondition());
exitStatusCode = -1;
}
break;
default:
if (!"200".equals(statusCode)) {
appendMessage(httpParameters.getUrl() + " statuscode: " + statusCode + ", Must be: 200");
exitStatusCode = -1;
}
break;
}
return exitStatusCode;
}
public String getOutput() {
return output;
}
protected void appendMessage(String message) {
if (output == null) {
output = "";
}
if (message != null && !message.trim().isEmpty()) {
output += message;
}
}
protected void addRequestParams(RequestBuilder builder,List<HttpProperty> httpPropertyList) {
if(httpPropertyList != null && httpPropertyList.size() > 0){
JSONObject jsonParam = new JSONObject();
for (HttpProperty property: httpPropertyList){
if(property.getHttpParametersType() != null){
if (property.getHttpParametersType().equals(HttpParametersType.PARAMETER)){
builder.addParameter(property.getProp(), property.getValue());
}else if(property.getHttpParametersType().equals(HttpParametersType.BODY)){
jsonParam.put(property.getProp(), property.getValue());
}
}
}
StringEntity postingString = new StringEntity(jsonParam.toString(), Charsets.UTF_8);
postingString.setContentEncoding(Bytes.UTF8_ENCODING);
postingString.setContentType(APPLICATION_JSON);
builder.setEntity(postingString);
}
}
protected void setHeaders(HttpUriRequest request,List<HttpProperty> httpPropertyList) {
if(httpPropertyList != null && httpPropertyList.size() > 0){
for (HttpProperty property: httpPropertyList){
if(property.getHttpParametersType() != null) {
if (property.getHttpParametersType().equals(HttpParametersType.HEADERS)) {
request.addHeader(property.getProp(), property.getValue());
}
}
}
}
}
protected CloseableHttpClient createHttpClient() {
final RequestConfig requestConfig = requestConfig();
HttpClientBuilder httpClientBuilder;
httpClientBuilder = HttpClients.custom().setDefaultRequestConfig(requestConfig);
return httpClientBuilder.build();
}
private RequestConfig requestConfig() {
return RequestConfig.custom().setSocketTimeout(MAX_CONNECTION_MILLISECONDS).setConnectTimeout(MAX_CONNECTION_MILLISECONDS).build();
}
protected RequestBuilder createRequestBuilder() {
if (httpParameters.getHttpMethod().equals(HttpMethod.GET)) {
return RequestBuilder.get();
} else if (httpParameters.getHttpMethod().equals(HttpMethod.POST)) {
return RequestBuilder.post();
} else if (httpParameters.getHttpMethod().equals(HttpMethod.HEAD)) {
return RequestBuilder.head();
} else if (httpParameters.getHttpMethod().equals(HttpMethod.PUT)) {
return RequestBuilder.put();
} else if (httpParameters.getHttpMethod().equals(HttpMethod.DELETE)) {
return RequestBuilder.delete();
} else {
return null;
}
}
@Override
public AbstractParameters getParameters() {
return this.httpParameters;
}
}

2
escheduler-server/src/main/resources/application_worker.properties

@ -1,4 +1,4 @@
logging.config=classpath:master_logback.xml
logging.config=classpath:worker_logback.xml
# server port
server.port=7788

16
escheduler-server/src/test/java/cn/escheduler/server/worker/EnvFileTest.java

@ -1,3 +1,19 @@
/*
* 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 cn.escheduler.server.worker;
import org.apache.commons.lang.StringUtils;

18
escheduler-server/src/test/java/cn/escheduler/server/zk/ZKWorkerClientTest.java

@ -1,3 +1,19 @@
/*
* 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 cn.escheduler.server.zk;
import cn.escheduler.common.Constants;
@ -34,4 +50,4 @@ public class ZKWorkerClientTest {
Assert.assertEquals(1, ipList.size());
}
}
}

4
escheduler-ui/build/webpack.config.prod.js

@ -100,8 +100,10 @@ const config = merge.smart(baseConfig, {
sourceMap: true,
uglifyOptions: {
compress: {
warnings: false,
drop_debugger: true,
drop_console: true,
drop_debugger: true
pure_funcs: ['console.log']//移除console
},
comments: function (n, c) {
/*! IMPORTANT: Please preserve 3rd-party library license info, inspired from @allex/amd-build-worker/config/jsplumb.js */

3
escheduler-ui/package.json

@ -1,5 +1,5 @@
{
"name": "escheduler",
"name": "dolphinscheduler",
"version": "1.0.0",
"description": "调度平台前端项目",
"author": "gongzijian <gongzijian@analysys.com.cn>",
@ -23,7 +23,6 @@
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-remove-console": "^6.9.4",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-plugin-transform-vue-jsx": "^3.5.0",
"babel-preset-env": "^1.6.1",

16
escheduler-ui/src/combo/1.0.0/3rd.css

File diff suppressed because one or more lines are too long

16
escheduler-ui/src/combo/1.0.0/local.js

@ -1 +1,17 @@
/*
* 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.
*/
Not found

16
escheduler-ui/src/font/demo.css

@ -1,3 +1,19 @@
/*
* 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.
*/
/* Logo 字体 */
@font-face {
font-family: "iconfont logo";

16
escheduler-ui/src/font/iconfont.css

@ -1,3 +1,19 @@
/*
* 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.
*/
@font-face {font-family: "iconfont";
src: url('iconfont.eot?t=1554803141579'); /* IE9 */
src: url('iconfont.eot?t=1554803141579#iefix') format('embedded-opentype'), /* IE6-IE8 */

16
escheduler-ui/src/font/iconfont.js

File diff suppressed because one or more lines are too long

16
escheduler-ui/src/js/conf/home/App.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<m-layout>
<m-nav slot="top"></m-nav>

8
escheduler-ui/src/js/conf/home/pages/dag/_source/config.js

@ -260,6 +260,10 @@ let tasksType = {
desc: 'SPARK',
color: '#E46F13'
},
'FLINK': {
desc: 'FLINK',
color: '#E46F13'
},
'MR': {
desc: 'MapReduce',
color: '#A0A5CC'
@ -271,6 +275,10 @@ let tasksType = {
'DEPENDENT': {
desc: 'DEPENDENT',
color: '#2FBFD8'
},
'HTTP': {
desc: 'HTTP',
color: '#E46F13'
}
}

22
escheduler-ui/src/js/conf/home/pages/dag/_source/dag.scss

@ -1,3 +1,19 @@
/*
* 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.
*/
.dag-model {
background: url("../img/dag_bg.png");
@ -70,6 +86,9 @@
.icos-SPARK {
background: url("../img/toolbar_SPARK.png") no-repeat 50% 50%;
}
.icos-FLINK {
background: url("../img/toobar_FLINK.png") no-repeat 50% 50%;
}
.icos-MR {
background: url("../img/toolbar_MR.png") no-repeat 50% 50%;
}
@ -79,6 +98,9 @@
.icos-DEPENDENT {
background: url("../img/toolbar_DEPENDENT.png") no-repeat 50% 50%;
}
.icos-HTTP {
background: url("../img/toobar_HTTP.png") no-repeat 50% 50%;
}
.toolbar {
width: 60px;
height: 100%;

16
escheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<div class="clearfix dag-model" >
<div class="toolbar">

16
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/_source/selectInput.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<x-select
style="width: 157px;"

16
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/_source/timeoutAlarm.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<div class="timeout-alarm-model">
<div class="clearfix list">

16
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/_source/workerGroups.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<x-select
:disabled="isDetails"

16
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.scss

@ -1,3 +1,19 @@
/*
* 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.
*/
.form-model-model {
width: 720px;
position: relative;

152
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<div class="form-model-model" v-clickoutside="_handleClose">
<div class="title-box">
@ -19,13 +35,13 @@
<div class="cont-box">
<label class="label-box">
<x-input
type="text"
v-model="name"
:disabled="isDetails"
:placeholder="$t('Please enter name(required)')"
maxlength="100"
@on-blur="_verifName()"
autocomplete="off">
type="text"
v-model="name"
:disabled="isDetails"
:placeholder="$t('Please enter name(required)')"
maxlength="100"
@on-blur="_verifName()"
autocomplete="off">
</x-input>
</label>
</div>
@ -52,13 +68,13 @@
<div class="cont-box">
<label class="label-box">
<x-input
resize
:autosize="{minRows:2}"
type="textarea"
:disabled="isDetails"
v-model="desc"
:placeholder="$t('Please enter description')"
autocomplete="off">
resize
:autosize="{minRows:2}"
type="textarea"
:disabled="isDetails"
v-model="desc"
:placeholder="$t('Please enter description')"
autocomplete="off">
</x-input>
</label>
</div>
@ -96,69 +112,81 @@
<!-- Task timeout alarm -->
<m-timeout-alarm
ref="timeout"
:backfill-item="backfillItem"
@on-timeout="_onTimeout">
ref="timeout"
:backfill-item="backfillItem"
@on-timeout="_onTimeout">
</m-timeout-alarm>
<!-- shell node -->
<m-shell
v-if="taskType === 'SHELL'"
@on-params="_onParams"
ref="SHELL"
:backfill-item="backfillItem">
v-if="taskType === 'SHELL'"
@on-params="_onParams"
ref="SHELL"
:backfill-item="backfillItem">
</m-shell>
<!-- sub_process node -->
<m-sub-process
v-if="taskType === 'SUB_PROCESS'"
@on-params="_onParams"
@on-set-process-name="_onSetProcessName"
ref="SUB_PROCESS"
:backfill-item="backfillItem">
v-if="taskType === 'SUB_PROCESS'"
@on-params="_onParams"
@on-set-process-name="_onSetProcessName"
ref="SUB_PROCESS"
:backfill-item="backfillItem">
</m-sub-process>
<!-- procedure node -->
<m-procedure
v-if="taskType === 'PROCEDURE'"
@on-params="_onParams"
ref="PROCEDURE"
:backfill-item="backfillItem">
v-if="taskType === 'PROCEDURE'"
@on-params="_onParams"
ref="PROCEDURE"
:backfill-item="backfillItem">
</m-procedure>
<!-- sql node -->
<m-sql
v-if="taskType === 'SQL'"
@on-params="_onParams"
ref="SQL"
:create-node-id="id"
:backfill-item="backfillItem">
v-if="taskType === 'SQL'"
@on-params="_onParams"
ref="SQL"
:create-node-id="id"
:backfill-item="backfillItem">
</m-sql>
<!-- spark node -->
<m-spark
v-if="taskType === 'SPARK'"
@on-params="_onParams"
ref="SPARK"
:backfill-item="backfillItem">
v-if="taskType === 'SPARK'"
@on-params="_onParams"
ref="SPARK"
:backfill-item="backfillItem">
</m-spark>
<m-flink
v-if="taskType === 'FLINK'"
@on-params="_onParams"
ref="FLINK"
:backfill-item="backfillItem">
</m-flink>
<!-- mr node -->
<m-mr
v-if="taskType === 'MR'"
@on-params="_onParams"
ref="MR"
:backfill-item="backfillItem">
v-if="taskType === 'MR'"
@on-params="_onParams"
ref="MR"
:backfill-item="backfillItem">
</m-mr>
<!-- python node -->
<m-python
v-if="taskType === 'PYTHON'"
@on-params="_onParams"
ref="PYTHON"
:backfill-item="backfillItem">
v-if="taskType === 'PYTHON'"
@on-params="_onParams"
ref="PYTHON"
:backfill-item="backfillItem">
</m-python>
<!-- dependent node -->
<m-dependent
v-if="taskType === 'DEPENDENT'"
@on-dependent="_onDependent"
ref="DEPENDENT"
:backfill-item="backfillItem">
v-if="taskType === 'DEPENDENT'"
@on-dependent="_onDependent"
ref="DEPENDENT"
:backfill-item="backfillItem">
</m-dependent>
<m-http
v-if="taskType === 'HTTP'"
@on-params="_onParams"
ref="HTTP"
:backfill-item="backfillItem">
</m-http>
</div>
</div>
@ -178,10 +206,12 @@
import i18n from '@/module/i18n'
import mShell from './tasks/shell'
import mSpark from './tasks/spark'
import mFlink from './tasks/flink'
import mPython from './tasks/python'
import JSP from './../plugIn/jsPlumbHandle'
import mProcedure from './tasks/procedure'
import mDependent from './tasks/dependent'
import mHttp from './tasks/http'
import mSubProcess from './tasks/sub_process'
import mSelectInput from './_source/selectInput'
import mTimeoutAlarm from './_source/timeoutAlarm'
@ -284,12 +314,12 @@
}
this.store.dispatch('dag/getSubProcessId', { taskId: stateId }).then(res => {
this.$emit('onSubProcess', {
subProcessId: res.data.subProcessInstanceId,
fromThis: this
})
}).catch(e => {
this.$message.error(e.msg || '')
subProcessId: res.data.subProcessInstanceId,
fromThis: this
})
}).catch(e => {
this.$message.error(e.msg || '')
})
} else {
this.$emit('onSubProcess', {
subProcessId: this.backfillItem.params.processDefinitionId,
@ -413,10 +443,10 @@
if (taskList.length) {
taskList.forEach(v => {
if (v.id === this.id) {
o = v
this.backfillItem = v
}
})
o = v
this.backfillItem = v
}
})
// Non-null objects represent backfill
if (!_.isEmpty(o)) {
this.name = o.name
@ -455,8 +485,10 @@
mSql,
mLog,
mSpark,
mFlink,
mPython,
mDependent,
mHttp,
mSelectInput,
mTimeoutAlarm,
mPriority,

16
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/log.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<span class="log-model">
<span v-if="stateId && item.type !== 'SUB_PROCESS'">

34
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/commcon.js

@ -1,3 +1,19 @@
/*
* 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.
*/
import i18n from '@/module/i18n'
@ -202,10 +218,26 @@ const sqlTypeList = [
}
]
const positionList = [
{
id: 'PARAMETER',
code: "Parameter"
},
{
id: 'BODY',
code: "Body"
},
{
id: 'HEADERS',
code: "Headers"
}
]
export {
cycleList,
dateValueList,
typeList,
directList,
sqlTypeList
sqlTypeList,
positionList
}

16
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/datasource.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<div class="datasource-model">
<div class="select-listpp">

29
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/dependItemList.vue

@ -1,6 +1,22 @@
/*
* 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.
*/
<template>
<div class="dep-list-model">
<div v-for="(el,$index) in dependItemList" class="list" @click="itemIndex = $index">
<div v-for="(el,$index) in dependItemList" :key='$index' class="list" @click="itemIndex = $index">
<x-select filterable :style="{width:isInstance ? '450px' : '450px'}" :disabled="isDetails" v-model="el.projectId" @on-change="_onChangeProjectId">
<x-option v-for="item in projectList" :key="item.value" :value="item.value" :label="item.label">
</x-option>
@ -58,7 +74,8 @@
mixins: [disabledState],
props: {
dependItemList: Array,
index: Number
index: Number,
dependTaskList:Array
},
model: {
prop: 'dependItemList',
@ -77,9 +94,10 @@
let value = noArr[0] && noArr[0].value || null
let val = value || this.definitionList[0].value
// add task list
let projectId = this.projectList[0].value
this._getDependItemList(val).then(depTasksList => {
this.$nextTick(() => {
this.$emit('dependItemListEvent', _.concat(this.dependItemList, this._rtNewParams(val, depTasksList)))
this.$emit('dependItemListEvent', _.concat(this.dependItemList, this._rtNewParams(val, depTasksList,projectId)))
})
})
// remove tooltip
@ -89,10 +107,9 @@
* remove task
*/
_remove (i) {
this.dependItemList.splice(i, 1)
this.dependTaskList[this.index].dependItemList.splice(i,1)
this._removeTip()
if (!this.dependItemList.length) {
if (!this.dependItemList.length || this.dependItemList.length === 0) {
this.$emit('on-delete-all', {
index: this.index
})

242
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/httpParams.vue

@ -0,0 +1,242 @@
/*
* 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.
*/
<template>
<div class="user-def-params-model">
<div class="select-listpp"
v-for="(item,$index) in httpParamsList"
:key="item.id"
@click="_getIndex($index)">
<x-input
:disabled="isDetails"
type="text"
v-model="httpParamsList[$index].prop"
:placeholder="$t('prop(required)')"
@on-blur="_verifProp()"
:style="inputStyle">
</x-input>
<x-select
@change="_handlePositionChanged"
v-model="httpParamsList[$index].httpParametersType"
:placeholder="$t('Http Parameters Position')"
:disabled="isDetails"
:style="inputStyle"
>
<x-option
v-for="position in positionList"
:key="position.code"
:value="position.id"
:label="position.code">
</x-option>
</x-select>
<x-input
:disabled="isDetails"
type="text"
v-model="httpParamsList[$index].value"
:placeholder="$t('value(required)')"
@on-blur="_handleValue()"
:style="inputStyle">
</x-input>
<span class="lt-add">
<a href="javascript:" style="color:red;" @click="!isDetails && _removeUdp($index)" >
<i class="iconfont" :class="_isDetails" data-toggle="tooltip" :title="$t('delete')" >&#xe611;</i>
</a>
</span>
<span class="add" v-if="$index === (httpParamsList.length - 1)">
<a href="javascript:" @click="!isDetails && _addUdp()" >
<i class="iconfont" :class="_isDetails" data-toggle="tooltip" :title="$t('Add')">&#xe636;</i>
</a>
</span>
</div>
<span class="add-dp" v-if="!httpParamsList.length">
<a href="javascript:" @click="!isDetails && _addUdp()" >
<i class="iconfont" :class="_isDetails" data-toggle="tooltip" :title="$t('Add')">&#xe636;</i>
</a>
</span>
</div>
</template>
<script>
import _ from 'lodash'
import i18n from '@/module/i18n'
import { positionList } from './commcon'
import disabledState from '@/module/mixin/disabledState'
export default {
name: 'http-params',
data () {
return {
// Increased data
httpParamsList: [],
// Current execution index
httpParamsIndex: null,
//
positionList:positionList
}
},
mixins: [disabledState],
props: {
udpList: Array,
// hide direct/type
hide: {
type: Boolean,
default: true
}
},
methods: {
/**
* Current index
*/
_getIndex (index) {
this.httpParamsIndex = index
},
/**
* 获取参数位置
*/
_handlePositionChanged () {
this._verifProp('value')
},
/**
* delete item
*/
_removeUdp (index) {
this.httpParamsList.splice(index, 1)
this._verifProp('value')
},
/**
* add
*/
_addUdp () {
this.httpParamsList.push({
prop: '',
httpParametersType: 'PARAMETER',
value: ''
})
},
/**
* blur verification
*/
_handleValue () {
this._verifValue('value')
},
/**
* Verify that the value exists or is empty
*/
_verifProp (type) {
let arr = []
let flag = true
_.map(this.httpParamsList, v => {
arr.push(v.prop)
if (!v.prop) {
flag = false
}
if(v.value === ''){
this.$message.warning(`${i18n.$t('value is empty')}`)
return false
}
})
if (!flag) {
if (!type) {
this.$message.warning(`${i18n.$t('prop is empty')}`)
}
return false
}
let newArr = _.cloneDeep(_.uniqWith(arr, _.isEqual))
if (newArr.length !== arr.length) {
if (!type) {
this.$message.warning(`${i18n.$t('prop is repeat')}`)
}
return false
}
this.$emit('on-http-params', _.cloneDeep(this.httpParamsList))
return true
},
_verifValue (type) {
let arr = []
let flag = true
_.map(this.httpParamsList, v => {
arr.push(v.value)
if (!v.value) {
flag = false
}
})
if (!flag) {
this.$message.warning(`${i18n.$t('value is empty')}`)
return false
}
this.$emit('on-http-params', _.cloneDeep(this.httpParamsList))
return true
}
},
watch: {
// Monitor data changes
udpList () {
this.httpParamsList = this.udpList
}
},
created () {
this.httpParamsList = this.udpList
},
computed: {
inputStyle () {
return "width:30%"
}
},
mounted () {
},
components: { }
}
</script>
<style lang="scss" rel="stylesheet/scss">
.user-def-params-model {
.select-listpp {
margin-bottom: 6px;
.lt-add {
padding-left: 4px;
a {
.iconfont {
font-size: 18px;
vertical-align: middle;
margin-bottom: -2px;
display: inline-block;
}
}
}
}
.add {
a {
color: #000;
.iconfont {
font-size: 18px;
vertical-align: middle;
display: inline-block;
margin-top: 1px;
}
}
}
.add-dp{
a {
color: #0097e0;
.iconfont {
font-size: 18px;
vertical-align: middle;
display: inline-block;
margin-top: 2px;
}
}
}
}
</style>

16
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/listBox.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<div class="clearfix list">
<div class="text-box">

20
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/localParams.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<div class="user-def-params-model">
<div class="select-listpp"
@ -9,7 +25,7 @@
type="text"
v-model="localParamsList[$index].prop"
:placeholder="$t('prop(required)')"
maxlength="64"
maxlength="128"
@on-blur="_verifProp()"
:style="inputStyle">
</x-input>
@ -44,7 +60,7 @@
type="text"
v-model="localParamsList[$index].value"
:placeholder="$t('value(optional)')"
maxlength="64"
maxlength="128"
@on-blur="_handleValue()"
:style="inputStyle">
</x-input>

16
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/resources.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<div class="resource-list-model">
<x-select multiple

16
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/sqlType.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<div class="sql-type-model">
<x-select

16
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/statementList.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<div class="statement-list-model">
<div class="select-listpp"

16
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/udfs.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<div class="udfs-model">
<x-select multiple

29
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/dependent.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<div class="dependence-model">
<m-list-box>
@ -22,7 +38,7 @@
v-if="dependTaskList.length">
{{relation === 'AND' ? $t('and') : $t('or')}}
</span>
<div class="dep-list" v-for="(el,$index) in dependTaskList">
<div class="dep-list" v-for="(el,$index) in dependTaskList" :key='$index'>
<span class="dep-line-pie"
v-if="el.dependItemList.length"
@click="!isDetails && _setRelation($index)">
@ -37,8 +53,10 @@
&#xe611;
</i>
<m-depend-item-list
:dependTaskList='dependTaskList'
v-model="el.dependItemList"
@on-delete-all="_onDeleteAll"
@getDependTaskList="getDependTaskList"
:index="$index">
</m-depend-item-list>
</div>
@ -84,11 +102,18 @@
$('body').find('.tooltip.fade.top.in').remove()
},
_onDeleteAll (i) {
this._deleteDep(i)
this.dependTaskList.map((item,i)=>{
if(item.dependItemList.length === 0){
this.dependTaskList.splice(i,1)
}
})
},
_setGlobalRelation () {
this.relation = this.relation === 'AND' ? 'OR' : 'AND'
},
getDependTaskList(i){
// console.log('getDependTaskList',i)
},
_setRelation (i) {
this.dependTaskList[i].relation = this.dependTaskList[i].relation === 'AND' ? 'OR' : 'AND'
},

389
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue

@ -0,0 +1,389 @@
<template>
<div class="flink-model">
<m-list-box>
<div slot="text">{{$t('Program Type')}}</div>
<div slot="content">
<x-select
style="width: 130px;"
v-model="programType"
:disabled="isDetails">
<x-option
v-for="city in programTypeList"
:key="city.code"
:value="city.code"
:label="city.code">
</x-option>
</x-select>
</div>
</m-list-box>
<m-list-box v-if="programType !== 'PYTHON'">
<div slot="text">{{$t('Main class')}}</div>
<div slot="content">
<x-input
:disabled="isDetails"
type="input"
v-model="mainClass"
:placeholder="$t('Please enter main class')"
autocomplete="off">
</x-input>
</div>
</m-list-box>
<m-list-box>
<div slot="text">{{$t('Main jar package')}}</div>
<div slot="content">
<x-select
style="width: 100%;"
:placeholder="$t('Please enter main jar package')"
v-model="mainJar"
filterable
:disabled="isDetails">
<x-option
v-for="city in mainJarList"
:key="city.code"
:value="city.code"
:label="city.code">
</x-option>
</x-select>
</div>
</m-list-box>
<m-list-box>
<div slot="text">{{$t('Deploy Mode')}}</div>
<div slot="content">
<x-radio-group v-model="deployMode">
<x-radio :label="'cluster'" :disabled="isDetails"></x-radio>
<x-radio :label="'local'" :disabled="isDetails"></x-radio>
</x-radio-group>
</div>
</m-list-box>
<div class="list-box-4p">
<div class="clearfix list">
<span class="sp1">{{$t('slot')}}</span>
<span class="sp2">
<x-input
:disabled="isDetails"
type="input"
v-model="slot"
:placeholder="$t('Please enter driver core number')"
style="width: 200px;"
autocomplete="off">
</x-input>
</span>
<span class="sp1 sp3">{{$t('taskManager')}}</span>
<span class="sp2">
<x-input
:disabled="isDetails"
type="input"
v-model="taskManager"
:placeholder="$t('Please enter driver memory use')"
style="width: 186px;"
autocomplete="off">
</x-input>
</span>
</div>
<div class="clearfix list">
<span class="sp1">{{$t('jobManagerMemory')}}</span>
<span class="sp2">
<x-input
:disabled="isDetails"
type="input"
v-model="jobManagerMemory"
:placeholder="$t('Please enter the number of Executor')"
style="width: 200px;"
autocomplete="off">
</x-input>
</span>
<span class="sp1 sp3">{{$t('taskManagerMemory')}}</span>
<span class="sp2">
<x-input
:disabled="isDetails"
type="input"
v-model="taskManagerMemory"
:placeholder="$t('Please enter the Executor memory')"
style="width: 186px;"
autocomplete="off">
</x-input>
</span>
</div>
</div>
<m-list-box>
<div slot="text">{{$t('Command-line parameters')}}</div>
<div slot="content">
<x-input
:autosize="{minRows:2}"
:disabled="isDetails"
type="textarea"
v-model="mainArgs"
:placeholder="$t('Please enter Command-line parameters')"
autocomplete="off">
</x-input>
</div>
</m-list-box>
<m-list-box>
<div slot="text">{{$t('Other parameters')}}</div>
<div slot="content">
<x-input
:disabled="isDetails"
:autosize="{minRows:2}"
type="textarea"
v-model="others"
:placeholder="$t('Please enter other parameters')">
</x-input>
</div>
</m-list-box>
<m-list-box>
<div slot="text">{{$t('Resources')}}</div>
<div slot="content">
<m-resources
ref="refResources"
@on-resourcesData="_onResourcesData"
:resource-list="resourceList">
</m-resources>
</div>
</m-list-box>
<m-list-box>
<div slot="text">{{$t('Custom Parameters')}}</div>
<div slot="content">
<m-local-params
ref="refLocalParams"
@on-local-params="_onLocalParams"
:udp-list="localParams"
:hide="false">
</m-local-params>
</div>
</m-list-box>
</div>
</template>
<script>
import _ from 'lodash'
import i18n from '@/module/i18n'
import mLocalParams from './_source/localParams'
import mListBox from './_source/listBox'
import mResources from './_source/resources'
import disabledState from '@/module/mixin/disabledState'
export default {
name: 'flink',
data () {
return {
// Main function class
mainClass: '',
// Master jar package
mainJar: null,
// Master jar package(List)
mainJarList: [],
// Deployment method
deployMode: 'cluster',
// Resource(list)
resourceList: [],
// Custom function
localParams: [],
// Driver Number of cores
slot: 1,
// Driver Number of memory
taskManager: '2',
// Executor Number
jobManagerMemory: '1G',
// Executor Number of memory
taskManagerMemory: '2G',
// Executor Number of cores
executorCores: 2,
// Command line argument
mainArgs: '',
// Other parameters
others: '',
// Program type
programType: 'SCALA',
// Program type(List)
programTypeList: [{ code: 'JAVA' }, { code: 'SCALA' }, { code: 'PYTHON' }]
}
},
props: {
backfillItem: Object
},
mixins: [disabledState],
methods: {
/**
* return localParams
*/
_onLocalParams (a) {
this.localParams = a
},
/**
* return resourceList
*/
_onResourcesData (a) {
this.resourceList = a
},
/**
* verification
*/
_verification () {
if (this.programType !== 'PYTHON' && !this.mainClass) {
this.$message.warning(`${i18n.$t('Please enter main class')}`)
return false
}
if (!this.mainJar) {
this.$message.warning(`${i18n.$t('Please enter main jar package')}`)
return false
}
if (!this.jobManagerMemory) {
this.$message.warning(`${i18n.$t('Please enter the number of Executor')}`)
return false
}
if (!Number.isInteger(parseInt(this.jobManagerMemory))) {
this.$message.warning(`${i18n.$t('The number of Executors should be a positive integer')}`)
return false
}
if (!this.taskManagerMemory) {
this.$message.warning(`${i18n.$t('Please enter the Executor memory')}`)
return false
}
if (!this.taskManagerMemory) {
this.$message.warning(`${i18n.$t('Please enter the Executor memory')}`)
return false
}
if (!_.isNumber(parseInt(this.taskManagerMemory))) {
this.$message.warning(`${i18n.$t('Memory should be a positive integer')}`)
return false
}
if (!this.executorCores) {
this.$message.warning(`${i18n.$t('Please enter ExecutorPlease enter Executor core number')}`)
return false
}
if (!Number.isInteger(parseInt(this.executorCores))) {
this.$message.warning(`${i18n.$t('Core number should be positive integer')}`)
return false
}
if (!this.$refs.refResources._verifResources()) {
return false
}
// localParams Subcomponent verification
if (!this.$refs.refLocalParams._verifProp()) {
return false
}
// storage
this.$emit('on-params', {
mainClass: this.mainClass,
mainJar: {
res: this.mainJar
},
deployMode: this.deployMode,
resourceList: this.resourceList,
localParams: this.localParams,
slot: this.slot,
taskManager: this.taskManager,
jobManagerMemory: this.jobManagerMemory,
taskManagerMemory: this.taskManagerMemory,
executorCores: this.executorCores,
mainArgs: this.mainArgs,
others: this.others,
programType: this.programType
})
return true
},
/**
* get resources list
*/
_getResourcesList () {
return new Promise((resolve, reject) => {
let isJar = (alias) => {
return alias.substring(alias.lastIndexOf('.') + 1, alias.length) !== 'jar'
}
this.mainJarList = _.map(_.cloneDeep(this.store.state.dag.resourcesListS), v => {
return {
id: v.id,
code: v.alias,
disabled: isJar(v.alias)
}
})
resolve()
})
}
},
watch: {
// Listening type
programType (type) {
if (type === 'PYTHON') {
this.mainClass = ''
}
}
},
created () {
this._getResourcesList().then(() => {
let o = this.backfillItem
// Non-null objects represent backfill
if (!_.isEmpty(o)) {
this.mainClass = o.params.mainClass || ''
this.mainJar = o.params.mainJar.res || ''
this.deployMode = o.params.deployMode || ''
this.slot = o.params.slot || 1
this.taskManager = o.params.taskManager || '2'
this.jobManagerMemory = o.params.jobManagerMemory || '1G'
this.taskManagerMemory = o.params.taskManagerMemory || '2G'
this.mainArgs = o.params.mainArgs || ''
this.others = o.params.others
this.programType = o.params.programType || 'SCALA'
// backfill resourceList
let resourceList = o.params.resourceList || []
if (resourceList.length) {
this.resourceList = resourceList
}
// backfill localParams
let localParams = o.params.localParams || []
if (localParams.length) {
this.localParams = localParams
}
}
})
},
mounted () {
},
components: { mLocalParams, mListBox, mResources }
}
</script>
<style lang="scss" rel="stylesheet/scss">
.flink-model {
.list-box-4p {
.list {
margin-bottom: 14px;
.sp1 {
float: left;
width: 112px;
text-align: right;
margin-right: 10px;
font-size: 14px;
color: #777;
display: inline-block;
padding-top: 6px;
}
.sp2 {
float: left;
margin-right: 4px;
}
.sp3 {
width: 176px;
}
}
}
}
</style>

191
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/http.vue

@ -0,0 +1,191 @@
/*
* 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.
*/
<template>
<div class="http-model">
<m-list-box>
<div slot="text">{{$t('Http Url')}}</div>
<div slot="content">
<x-input
:autosize="{minRows:2}"
:disabled="isDetails"
type="textarea"
v-model="url"
:placeholder="$t('Please Enter Http Url')"
autocomplete="off">
</x-input>
</div>
</m-list-box>
<m-list-box>
<div slot="text">{{$t('Http Method')}}</div>
<div slot="content">
<x-select
style="width: 150px;"
v-model="httpMethod"
:disabled="isDetails">
<x-option
v-for="city in httpMethodList"
:key="city.code"
:value="city.code"
:label="city.code">
</x-option>
</x-select>
</div>
</m-list-box>
<m-list-box>
<div slot="text">{{$t('Http Parameters')}}</div>
<div slot="content">
<m-http-params
ref="refHttpParams"
@on-http-params="_onHttpParams"
:udp-list="httpParams"
:hide="false">
</m-http-params>
</div>
</m-list-box>
<m-list-box>
<div slot="text">{{$t('Http Check Condition')}}</div>
<div slot="content">
<x-select
style="width: 150px;"
v-model="httpCheckCondition"
:disabled="isDetails">
<x-option
v-for="city in httpCheckConditionList"
:key="city.code"
:value="city.code"
:label="city.value">
</x-option>
</x-select>
</div>
</m-list-box>
<m-list-box>
<div slot="text">{{$t('Http Condition')}}</div>
<div slot="content">
<x-input
:autosize="{minRows:2}"
:disabled="isDetails"
type="textarea"
v-model="condition"
:placeholder="$t('Please Enter Http Condition')"
autocomplete="off">
</x-input>
</div>
</m-list-box>
<m-list-box>
<div slot="text">{{$t('Custom Parameters')}}</div>
<div slot="content">
<m-local-params
ref="refLocalParams"
@on-local-params="_onLocalParams"
:udp-list="localParams"
:hide="false">
</m-local-params>
</div>
</m-list-box>
</div>
</template>
<script>
import _ from 'lodash'
import i18n from '@/module/i18n'
import mLocalParams from './_source/localParams'
import mHttpParams from './_source/httpParams'
import mListBox from './_source/listBox'
import disabledState from '@/module/mixin/disabledState'
export default {
name: 'http',
data () {
return {
url: '',
condition: '',
localParams: [],
httpParams: [],
httpMethod: 'GET',
httpMethodList: [{ code: 'GET' }, { code: 'POST' }, { code: 'HEAD' }, { code: 'PUT' }, { code: 'DELETE' }],
httpCheckCondition: 'STATUS_CODE_DEFAULT',
httpCheckConditionList: [{ code: 'STATUS_CODE_DEFAULT',value:'默认响应码200' }, { code: 'STATUS_CODE_CUSTOM',value:'自定义响应码' }, { code: 'BODY_CONTAINS',value:'内容包含' }, { code: 'BODY_NOT_CONTAINS',value:'内容不包含' }]
}
},
props: {
backfillItem: Object
},
mixins: [disabledState],
methods: {
/**
* return localParams
*/
_onLocalParams (a) {
this.localParams = a
},
_onHttpParams (a) {
this.httpParams = a
},
/**
* verification
*/
_verification () {
if (!this.url) {
this.$message.warning(`${i18n.$t('Please Enter Http Url')}`)
return false
}
// localParams Subcomponent verification
if (!this.$refs.refLocalParams._verifProp()) {
return false
}
if (!this.$refs.refHttpParams._verifProp()) {
return false
}
if (!this.$refs.refHttpParams._verifValue()) {
return false
}
// storage
this.$emit('on-params', {
localParams: this.localParams,
httpParams: this.httpParams,
url: this.url,
httpMethod: this.httpMethod,
httpCheckCondition: this.httpCheckCondition,
condition: this.condition
})
return true
}
},
watch: {
},
created () {
let o = this.backfillItem
// Non-null objects represent backfill
if (!_.isEmpty(o)) {
this.url = o.params.url || ''
this.httpMethod = o.params.httpMethod || 'GET'
this.httpCheckCondition = o.params.httpCheckCondition || 'DEFAULT'
this.condition = o.params.condition || ''
// backfill localParams
let localParams = o.params.localParams || []
if (localParams.length) {
this.localParams = localParams
}
let httpParams = o.params.httpParams || []
if (httpParams.length) {
this.httpParams = httpParams
}
}
},
mounted () {
},
components: { mLocalParams, mHttpParams, mListBox }
}
</script>

16
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/mr.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<div class="spark-model">
<m-list-box>

16
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/procedure.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<div class="procedure-model">
<m-list-box>

16
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<div class="shell-model">
<m-list-box>

16
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<div class="shell-model">
<m-list-box>

16
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<div class="spark-model">
<m-list-box>

22
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sql.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<div class="sql-model">
<m-list-box>
@ -355,7 +371,11 @@
this.sqlType = o.params.sqlType
this.connParams = o.params.connParams || ''
this.localParams = o.params.localParams || []
this.showType = o.params.showType.split(',') || []
if(o.params.showType == '') {
this.showType = []
} else {
this.showType = o.params.showType.split(',') || []
}
this.preStatements = o.params.preStatements || []
this.postStatements = o.params.postStatements || []
this.title = o.params.title || ''

16
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sub_process.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<div class="sub_process-model">
<div class="clearfix list">

16
escheduler-ui/src/js/conf/home/pages/dag/_source/jumpAffirm/index.js

@ -1,3 +1,19 @@
/*
* 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.
*/
import Vue from 'vue'
import mAffirm from './jumpAffirm'

16
escheduler-ui/src/js/conf/home/pages/dag/_source/jumpAffirm/jumpAffirm.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<div class="affirm-model">
<m-popup :ok-text="$t('Save')"

2
escheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/jsPlumbHandle.js

@ -645,7 +645,6 @@ JSP.prototype.saveStore = function () {
})
})
console.log(tasksAll())
_.map(tasksAll(), v => {
locations[v.id] = {
@ -656,7 +655,6 @@ JSP.prototype.saveStore = function () {
}
})
console.log(locations)
// Storage node
store.commit('dag/setTasks', tasks)

16
escheduler-ui/src/js/conf/home/pages/dag/_source/startingParam/index.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<div class="starting-params-dag-index">
<template v-if="isView && isActive">

16
escheduler-ui/src/js/conf/home/pages/dag/_source/udp/_source/selectTenant.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<x-select
:disabled="isDetails"

16
escheduler-ui/src/js/conf/home/pages/dag/_source/udp/udp.vue

@ -1,3 +1,19 @@
/*
* 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.
*/
<template>
<div class="udp-model">
<div class="scrollbar contpi-boxt">

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save