Browse Source

Optimizing code (#2240)

* updated

* optimized the code

* Delete ParameterUtils.java

* rollback source code

* rollback source code

* rollback source code

Co-authored-by: dailidong <dailidong66@gmail.com>
pull/2/head
John Liu 4 years ago committed by GitHub
parent
commit
0714971453
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 94
      CONTRIBUTING.md
  2. 27
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java

94
CONTRIBUTING.md

@ -1,35 +1,53 @@
* First from the remote repository *https://github.com/apache/incubator-dolphinscheduler.git* fork code to your own repository
* there are three branches in the remote repository currently: # Development
* master normal delivery branch
After the stable version is released, the code for the stable version branch is merged into the master branch.
* dev daily development branch Start by forking the dolphinscheduler GitHub repository, make changes in a branch and then send a pull request.
The daily development branch, the newly submitted code can pull requests to this branch.
## Set up your dolphinscheduler GitHub Repository
* Clone your own warehouse to your local There are three branches in the remote repository currently:
- `master` : normal delivery branch. After the stable version is released, the code for the stable version branch is merged into the master branch.
- `dev` : daily development branch. The daily development branch, the newly submitted code can pull requests to this branch.
- `x.x.x-release` : the stable release version.
`git clone https://github.com/apache/incubator-dolphinscheduler.git` So, you should fork the `dev` branch.
* Add remote repository address, named upstream After forking the [dolphinscheduler upstream source repository](https://github.com/apache/incubator-dolphinscheduler/fork) to your personal repository, you can set your personal development environment.
`git remote add upstream https://github.com/apache/incubator-dolphinscheduler.git` ```sh
$ cd <your work direcotry>
$ git clone < your personal forked dolphinscheduler repo>
$ cd incubator-dolphinscheduler
```
* View repository: ## Set git remote as ``upstream``
`git remote -v` Add remote repository address, named upstream
> There will be two repositories at this time: origin (your own warehouse) and upstream (remote repository) ```sh
git remote add upstream https://github.com/apache/incubator-dolphinscheduler.git
```
* Get/update remote repository code (already the latest code, skip it) View repository:
`git fetch upstream` ```sh
git remote -v
```
There will be two repositories at this time: origin (your own warehouse) and upstream (remote repository)
* Synchronize remote repository code to local repository Get/update remote repository code (already the latest code, skip it).
```sh
git fetch upstream
``` ```
Synchronize remote repository code to local repository
```sh
git checkout origin/dev git checkout origin/dev
git merge --no-ff upstream/dev git merge --no-ff upstream/dev
``` ```
@ -41,24 +59,46 @@ git checkout -b dev-1.0 upstream/dev-1.0
git push --set-upstream origin dev1.0 git push --set-upstream origin dev1.0
``` ```
* After modifying the code locally, submit it to your own repository: ## Create your feature branch
Before making code changes, make sure you create a separate branch for them.
```sh
$ git checkout -b <your-feature>
```
## Commit changes
After modifying the code locally, submit it to your own repository:
```sh
git commit -m 'information about your feature'
```
## Push to the branch
Push your locally committed changes to the remote origin (your fork).
`git commit -m 'test commit'` ```
`git push` $ git push origin <your-feature>
```
## Create a pull request
* Submit changes to the remote repository After submitting changes to your remote repository, you should click on the new pull request On the following github page.
* On the github page, click on the new pull request.
<p align = "center"> <p align = "center">
<img src = "http://geek.analysys.cn/static/upload/221/2019-04-02/90f3abbf-70ef-4334-b8d6-9014c9cf4c7f.png"width ="60%"/> <img src = "http://geek.analysys.cn/static/upload/221/2019-04-02/90f3abbf-70ef-4334-b8d6-9014c9cf4c7f.png" width ="60%"/>
</ p> </p>
Select the modified local branch and the branch to merge past to create a pull request.
* Select the modified local branch and the branch to merge past to create a pull request.
<p align = "center"> <p align = "center">
<img src = "http://geek.analysys.cn/static/upload/221/2019-04-02/fe7eecfe-2720-4736-951b-b3387cf1ae41.png"width ="60%"/> <img src = "http://geek.analysys.cn/static/upload/221/2019-04-02/fe7eecfe-2720-4736-951b-b3387cf1ae41.png" width ="60%"/>
</ p> </p>
* Next, the administrator is responsible for **merging** to complete the pull request Next, the administrator is responsible for **merging** to complete the pull request.

27
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java

@ -99,13 +99,7 @@ public class AlertDao extends AbstractBaseDao {
String content = String.format("[{'type':'%s','host':'%s','event':'server down','warning level':'serious'}]", String content = String.format("[{'type':'%s','host':'%s','event':'server down','warning level':'serious'}]",
serverType, host); serverType, host);
alert.setTitle("Fault tolerance warning"); alert.setTitle("Fault tolerance warning");
alert.setShowType(ShowType.TABLE); saveTaskTimeoutAlert(alert, content, alertgroupId, null, null);
alert.setContent(content);
alert.setAlertType(AlertType.EMAIL);
alert.setAlertGroupId(alertgroupId);
alert.setCreateTime(new Date());
alert.setUpdateTime(new Date());
alertMapper.insert(alert);
} }
/** /**
@ -121,6 +115,11 @@ public class AlertDao extends AbstractBaseDao {
String content = String.format("[{'id':'%d','name':'%s','event':'timeout','warnLevel':'middle'}]", String content = String.format("[{'id':'%d','name':'%s','event':'timeout','warnLevel':'middle'}]",
processInstance.getId(), processInstance.getName()); processInstance.getId(), processInstance.getName());
alert.setTitle("Process Timeout Warn"); alert.setTitle("Process Timeout Warn");
saveTaskTimeoutAlert(alert, content, alertgroupId, receivers, receiversCc);
}
private void saveTaskTimeoutAlert(Alert alert, String content, int alertgroupId,
String receivers, String receiversCc){
alert.setShowType(ShowType.TABLE); alert.setShowType(ShowType.TABLE);
alert.setContent(content); alert.setContent(content);
alert.setAlertType(AlertType.EMAIL); alert.setAlertType(AlertType.EMAIL);
@ -150,19 +149,7 @@ public class AlertDao extends AbstractBaseDao {
String content = String.format("[{'process instance id':'%d','task name':'%s','task id':'%d','task name':'%s'," + String content = String.format("[{'process instance id':'%d','task name':'%s','task id':'%d','task name':'%s'," +
"'event':'timeout','warnLevel':'middle'}]", processInstanceId, processInstanceName, taskId, taskName); "'event':'timeout','warnLevel':'middle'}]", processInstanceId, processInstanceName, taskId, taskName);
alert.setTitle("Task Timeout Warn"); alert.setTitle("Task Timeout Warn");
alert.setShowType(ShowType.TABLE); saveTaskTimeoutAlert(alert, content, alertgroupId, receivers, receiversCc);
alert.setContent(content);
alert.setAlertType(AlertType.EMAIL);
alert.setAlertGroupId(alertgroupId);
if (StringUtils.isNotEmpty(receivers)) {
alert.setReceivers(receivers);
}
if (StringUtils.isNotEmpty(receiversCc)) {
alert.setReceiversCc(receiversCc);
}
alert.setCreateTime(new Date());
alert.setUpdateTime(new Date());
alertMapper.insert(alert);
} }
/** /**

Loading…
Cancel
Save