status
stringclasses 1
value | repo_name
stringclasses 31
values | repo_url
stringclasses 31
values | issue_id
int64 1
104k
| title
stringlengths 4
233
| body
stringlengths 0
186k
⌀ | issue_url
stringlengths 38
56
| pull_url
stringlengths 37
54
| before_fix_sha
stringlengths 40
40
| after_fix_sha
stringlengths 40
40
| report_datetime
timestamp[us, tz=UTC] | language
stringclasses 5
values | commit_datetime
timestamp[us, tz=UTC] | updated_file
stringlengths 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | Tenant tenant = tenantMapper.queryById(tenantId);
if (PropertyUtils.getResUploadStartupState()) {
storageOperate.createTenantDirIfNotExists(tenant.getTenantCode());
}
result.put(Constants.DATA_LIST, user);
putMsg(result, Status.SUCCESS);
return result;
}
@Override
@Transactional
public User createUser(String userName,
String userPassword,
String email,
int tenantId,
String phone,
String queue,
int state) {
User user = new User();
Date now = new Date();
user.setUserName(userName);
user.setUserPassword(EncryptionUtils.getMd5(userPassword));
user.setEmail(email);
user.setTenantId(tenantId);
user.setPhone(phone);
user.setState(state);
user.setUserType(UserType.GENERAL_USER);
user.setCreateTime(now);
user.setUpdateTime(now); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | if (StringUtils.isEmpty(queue)) {
queue = "";
}
user.setQueue(queue);
userMapper.insert(user);
return user;
}
/***
* create User for ldap login
*/
@Override
@Transactional
public User createUser(UserType userType, String userId, String email) {
User user = new User();
Date now = new Date();
user.setUserName(userId);
user.setEmail(email);
user.setUserType(userType);
user.setCreateTime(now);
user.setUpdateTime(now);
user.setQueue("");
user.setState(Flag.YES.getCode());
userMapper.insert(user);
return user;
}
/**
* get user by user name |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | *
* @param userName user name
* @return exist user or null
*/
@Override
public User getUserByUserName(String userName) {
return userMapper.queryByUserNameAccurately(userName);
}
/**
* query user by id
*
* @param id id
* @return user info
*/
@Override
public User queryUser(int id) {
return userMapper.selectById(id);
}
@Override
public List<User> queryUser(List<Integer> ids) {
if (CollectionUtils.isEmpty(ids)) {
return new ArrayList<>();
}
return userMapper.selectByIds(ids);
}
/**
* query user
*
* @param name name
* @return user info |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | */
@Override
public User queryUser(String name) {
return userMapper.queryByUserNameAccurately(name);
}
/**
* query user
*
* @param name name
* @param password password
* @return user info
*/
@Override
public User queryUser(String name, String password) {
String md5 = EncryptionUtils.getMd5(password);
return userMapper.queryUserByNamePassword(name, md5);
}
/**
* get user id by user name
*
* @param name user name
* @return if name empty 0, user not exists -1, user exist user id
*/
@Override
public int getUserIdByName(String name) {
int executorId = 0;
if (StringUtils.isNotEmpty(name)) {
User executor = queryUser(name);
if (null != executor) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | executorId = executor.getId();
} else {
executorId = -1;
}
}
return executorId;
}
/**
* query user list
*
* @param loginUser login user
* @param pageNo page number
* @param searchVal search value
* @param pageSize page size
* @return user list page
*/
@Override
public Result<Object> queryUserList(User loginUser, String searchVal, Integer pageNo, Integer pageSize) {
Result<Object> result = new Result<>();
if(resourcePermissionCheckService.functionDisabled()){
putMsg(result, Status.FUNCTION_DISABLED);
return result;
}
if (!isAdmin(loginUser)) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
Page<User> page = new Page<>(pageNo, pageSize);
IPage<User> scheduleList = userMapper.queryUserPaging(page, searchVal);
PageInfo<User> pageInfo = new PageInfo<>(pageNo, pageSize); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | pageInfo.setTotal((int) scheduleList.getTotal());
pageInfo.setTotalList(scheduleList.getRecords());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* updateProcessInstance user
*
* @param userId user id
* @param userName user name
* @param userPassword user password
* @param email email
* @param tenantId tenant id
* @param phone phone
* @param queue queue
* @param state state
* @param timeZone timeZone
* @return update result code
* @throws Exception exception
*/
@Override
public Map<String, Object> updateUser(User loginUser, int userId,
String userName,
String userPassword,
String email,
int tenantId,
String phone,
String queue,
int state, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | String timeZone) throws IOException {
Map<String, Object> result = new HashMap<>();
result.put(Constants.STATUS, false);
if(resourcePermissionCheckService.functionDisabled()){
putMsg(result, Status.FUNCTION_DISABLED);
return result;
}
if (check(result, !canOperator(loginUser, userId), Status.USER_NO_OPERATION_PERM)) {
return result;
}
User user = userMapper.selectById(userId);
if (user == null) {
putMsg(result, Status.USER_NOT_EXIST, userId);
return result;
}
if (StringUtils.isNotEmpty(userName)) {
if (!CheckUtils.checkUserName(userName)) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, userName);
return result;
}
User tempUser = userMapper.queryByUserNameAccurately(userName);
if (tempUser != null && tempUser.getId() != userId) {
putMsg(result, Status.USER_NAME_EXIST);
return result;
}
user.setUserName(userName);
}
if (StringUtils.isNotEmpty(userPassword)) {
if (!CheckUtils.checkPasswordLength(userPassword)) {
putMsg(result, Status.USER_PASSWORD_LENGTH_ERROR); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | return result;
}
user.setUserPassword(EncryptionUtils.getMd5(userPassword));
}
if (StringUtils.isNotEmpty(email)) {
if (!CheckUtils.checkEmail(email)) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, email);
return result;
}
user.setEmail(email);
}
if (StringUtils.isNotEmpty(phone) && !CheckUtils.checkPhone(phone)) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, phone);
return result;
}
if (state == 0 && user.getState() != state && loginUser.getId() == user.getId()) {
putMsg(result, Status.NOT_ALLOW_TO_DISABLE_OWN_ACCOUNT);
return result;
}
if (StringUtils.isNotEmpty(timeZone)) {
if (!CheckUtils.checkTimeZone(timeZone)) {
putMsg(result, Status.TIME_ZONE_ILLEGAL, timeZone);
return result;
}
user.setTimeZone(timeZone);
}
user.setPhone(phone);
user.setQueue(queue);
user.setState(state);
Date now = new Date(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | user.setUpdateTime(now);
user.setTenantId(tenantId);
userMapper.updateById(user);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* delete user
*
* @param loginUser login user
* @param id user id
* @return delete result code
* @throws Exception exception when operate hdfs
*/
@Override
@Transactional
public Map<String, Object> deleteUserById(User loginUser, int id) throws IOException {
Map<String, Object> result = new HashMap<>();
if(resourcePermissionCheckService.functionDisabled()){
putMsg(result, Status.FUNCTION_DISABLED);
return result;
}
if (!isAdmin(loginUser)) {
putMsg(result, Status.USER_NO_OPERATION_PERM, id);
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | User tempUser = userMapper.selectById(id);
if (tempUser == null) {
putMsg(result, Status.USER_NOT_EXIST, id);
return result;
}
List<Project> projects = projectMapper.queryProjectCreatedByUser(id);
if (CollectionUtils.isNotEmpty(projects)) {
String projectNames = projects.stream().map(Project::getName).collect(Collectors.joining(","));
putMsg(result, Status.TRANSFORM_PROJECT_OWNERSHIP, projectNames);
return result;
}
userMapper.queryTenantCodeByUserId(id);
accessTokenMapper.deleteAccessTokenByUserId(id);
userMapper.deleteById(id);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* grant project
*
* @param loginUser login user
* @param userId user id
* @param projectIds project id array
* @return grant result code
*/
@Override
@Transactional
public Map<String, Object> grantProject(User loginUser, int userId, String projectIds) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | Map<String, Object> result = new HashMap<>();
result.put(Constants.STATUS, false);
if(resourcePermissionCheckService.functionDisabled()){
putMsg(result, Status.FUNCTION_DISABLED);
return result;
}
User tempUser = userMapper.selectById(userId);
if (tempUser == null) {
putMsg(result, Status.USER_NOT_EXIST, userId);
return result;
}
projectUserMapper.deleteProjectRelation(0, userId);
if (check(result, StringUtils.isEmpty(projectIds), Status.SUCCESS)) {
return result;
}
Arrays.stream(projectIds.split(",")).distinct().forEach(projectId -> {
Date now = new Date();
ProjectUser projectUser = new ProjectUser();
projectUser.setUserId(userId);
projectUser.setProjectId(Integer.parseInt(projectId));
projectUser.setPerm(Constants.AUTHORIZE_WRITABLE_PERM);
projectUser.setCreateTime(now);
projectUser.setUpdateTime(now);
projectUserMapper.insert(projectUser);
});
putMsg(result, Status.SUCCESS);
return result;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | * grant project by code
*
* @param loginUser login user
* @param userId user id
* @param projectCode project code
* @return grant result code
*/
@Override
public Map<String, Object> grantProjectByCode(final User loginUser, final int userId, final long projectCode) {
Map<String, Object> result = new HashMap<>();
result.put(Constants.STATUS, false);
if(resourcePermissionCheckService.functionDisabled()){
putMsg(result, Status.FUNCTION_DISABLED);
return result;
}
User tempUser = this.userMapper.selectById(userId);
if (tempUser == null) {
this.putMsg(result, Status.USER_NOT_EXIST, userId);
return result;
}
Project project = this.projectMapper.queryByCode(projectCode);
if (project == null) {
this.putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
return result;
}
if (!this.canOperator(loginUser, project.getUserId())) {
this.putMsg(result, Status.USER_NO_OPERATION_PERM); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | return result;
}
ProjectUser projectUser = projectUserMapper.queryProjectRelation(project.getId(), userId);
if (projectUser == null) {
Date today = new Date();
projectUser = new ProjectUser();
projectUser.setUserId(userId);
projectUser.setProjectId(project.getId());
projectUser.setPerm(7);
projectUser.setCreateTime(today);
projectUser.setUpdateTime(today);
this.projectUserMapper.insert(projectUser);
}
this.putMsg(result, Status.SUCCESS);
return result;
}
/**
* revoke the project permission for specified user.
*
* @param loginUser Login user
* @param userId User id
* @param projectCode Project Code
* @return
*/
@Override
public Map<String, Object> revokeProject(User loginUser, int userId, long projectCode) {
Map<String, Object> result = new HashMap<>();
result.put(Constants.STATUS, false);
if(resourcePermissionCheckService.functionDisabled()){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | putMsg(result, Status.FUNCTION_DISABLED);
return result;
}
if (this.check(result, !this.isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
User user = this.userMapper.selectById(userId);
if (user == null) {
this.putMsg(result, Status.USER_NOT_EXIST, userId);
return result;
}
Project project = this.projectMapper.queryByCode(projectCode);
if (project == null) {
this.putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
return result;
}
this.projectUserMapper.deleteProjectRelation(project.getId(), user.getId());
this.putMsg(result, Status.SUCCESS);
return result;
}
/**
* grant resource
*
* @param loginUser login user
* @param userId user id
* @param resourceIds resource id array |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | * @return grant result code
*/
@Override
@Transactional
public Map<String, Object> grantResources(User loginUser, int userId, String resourceIds) {
Map<String, Object> result = new HashMap<>();
if(resourcePermissionCheckService.functionDisabled()){
putMsg(result, Status.FUNCTION_DISABLED);
return result;
}
User user = userMapper.selectById(userId);
if (user == null) {
putMsg(result, Status.USER_NOT_EXIST, userId);
return result;
}
Set<Integer> needAuthorizeResIds = new HashSet<>();
if (StringUtils.isNotBlank(resourceIds)) {
String[] resourceFullIdArr = resourceIds.split(",");
for (String resourceFullId : resourceFullIdArr) {
String[] resourceIdArr = resourceFullId.split("-");
for (int i = 0; i <= resourceIdArr.length - 1; i++) {
int resourceIdValue = Integer.parseInt(resourceIdArr[i]);
needAuthorizeResIds.add(resourceIdValue);
}
}
}
List<Integer> resIds = resourceUserMapper.queryResourcesIdListByUserIdAndPerm(userId, Constants.AUTHORIZE_WRITABLE_PERM);
List<Resource> oldAuthorizedRes = CollectionUtils.isEmpty(resIds) ? new ArrayList<>() : resourceMapper.queryResourceListById(resIds); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | Set<Integer> oldAuthorizedResIds = oldAuthorizedRes.stream().map(Resource::getId).collect(Collectors.toSet());
oldAuthorizedResIds.removeAll(needAuthorizeResIds);
if (CollectionUtils.isNotEmpty(oldAuthorizedResIds)) {
List<Map<String, Object>> list = processDefinitionMapper.listResourcesByUser(userId);
Map<Integer, Set<Long>> resourceProcessMap = ResourceProcessDefinitionUtils.getResourceProcessDefinitionMap(list);
Set<Integer> resourceIdSet = resourceProcessMap.keySet();
resourceIdSet.retainAll(oldAuthorizedResIds);
if (CollectionUtils.isNotEmpty(resourceIdSet)) {
logger.error("can't be deleted,because it is used of process definition");
for (Integer resId : resourceIdSet) {
logger.error("resource id:{} is used of process definition {}", resId, resourceProcessMap.get(resId));
}
putMsg(result, Status.RESOURCE_IS_USED);
return result;
}
}
resourceUserMapper.deleteResourceUser(userId, 0);
if (check(result, StringUtils.isEmpty(resourceIds), Status.SUCCESS)) {
return result;
}
for (int resourceIdValue : needAuthorizeResIds) {
Resource resource = resourceMapper.selectById(resourceIdValue);
if (resource == null) {
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
Date now = new Date(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | ResourcesUser resourcesUser = new ResourcesUser();
resourcesUser.setUserId(userId);
resourcesUser.setResourcesId(resourceIdValue);
if (resource.isDirectory()) {
resourcesUser.setPerm(Constants.AUTHORIZE_READABLE_PERM);
} else {
resourcesUser.setPerm(Constants.AUTHORIZE_WRITABLE_PERM);
}
resourcesUser.setCreateTime(now);
resourcesUser.setUpdateTime(now);
resourceUserMapper.insert(resourcesUser);
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* grant udf function
*
* @param loginUser login user
* @param userId user id
* @param udfIds udf id array
* @return grant result code
*/
@Override
@Transactional
public Map<String, Object> grantUDFFunction(User loginUser, int userId, String udfIds) {
Map<String, Object> result = new HashMap<>();
if(resourcePermissionCheckService.functionDisabled()){
putMsg(result, Status.FUNCTION_DISABLED);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | }
User user = userMapper.selectById(userId);
if (user == null) {
putMsg(result, Status.USER_NOT_EXIST, userId);
return result;
}
udfUserMapper.deleteByUserId(userId);
if (check(result, StringUtils.isEmpty(udfIds), Status.SUCCESS)) {
return result;
}
String[] resourcesIdArr = udfIds.split(",");
for (String udfId : resourcesIdArr) {
Date now = new Date();
UDFUser udfUser = new UDFUser();
udfUser.setUserId(userId);
udfUser.setUdfId(Integer.parseInt(udfId));
udfUser.setPerm(Constants.AUTHORIZE_WRITABLE_PERM);
udfUser.setCreateTime(now);
udfUser.setUpdateTime(now);
udfUserMapper.insert(udfUser);
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* grant namespace
*
* @param loginUser login user
* @param userId user id
* @param namespaceIds namespace id array |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | * @return grant result code
*/
@Override
@Transactional
public Map<String, Object> grantNamespaces(User loginUser, int userId, String namespaceIds) {
Map<String, Object> result = new HashMap<>();
result.put(Constants.STATUS, false);
if(resourcePermissionCheckService.functionDisabled()){
putMsg(result, Status.FUNCTION_DISABLED);
return result;
}
if (this.check(result, !this.isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
User tempUser = userMapper.selectById(userId);
if (tempUser == null) {
putMsg(result, Status.USER_NOT_EXIST, userId);
return result;
}
k8sNamespaceUserMapper.deleteNamespaceRelation(0, userId);
if (StringUtils.isNotEmpty(namespaceIds)) {
String[] namespaceIdArr = namespaceIds.split(",");
for (String namespaceId : namespaceIdArr) {
Date now = new Date();
K8sNamespaceUser namespaceUser = new K8sNamespaceUser();
namespaceUser.setUserId(userId);
namespaceUser.setNamespaceId(Integer.parseInt(namespaceId));
namespaceUser.setPerm(7); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | namespaceUser.setCreateTime(now);
namespaceUser.setUpdateTime(now);
k8sNamespaceUserMapper.insert(namespaceUser);
}
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* grant datasource
*
* @param loginUser login user
* @param userId user id
* @param datasourceIds data source id array
* @return grant result code
*/
@Override
@Transactional
public Map<String, Object> grantDataSource(User loginUser, int userId, String datasourceIds) {
Map<String, Object> result = new HashMap<>();
result.put(Constants.STATUS, false);
if(resourcePermissionCheckService.functionDisabled()){
putMsg(result, Status.FUNCTION_DISABLED);
return result;
}
User user = userMapper.selectById(userId);
if (user == null) {
putMsg(result, Status.USER_NOT_EXIST, userId);
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | datasourceUserMapper.deleteByUserId(userId);
if (check(result, StringUtils.isEmpty(datasourceIds), Status.SUCCESS)) {
return result;
}
String[] datasourceIdArr = datasourceIds.split(",");
for (String datasourceId : datasourceIdArr) {
Date now = new Date();
DatasourceUser datasourceUser = new DatasourceUser();
datasourceUser.setUserId(userId);
datasourceUser.setDatasourceId(Integer.parseInt(datasourceId));
datasourceUser.setPerm(Constants.AUTHORIZE_WRITABLE_PERM);
datasourceUser.setCreateTime(now);
datasourceUser.setUpdateTime(now);
datasourceUserMapper.insert(datasourceUser);
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query user info
*
* @param loginUser login user
* @return user info
*/
@Override
public Map<String, Object> getUserInfo(User loginUser) {
Map<String, Object> result = new HashMap<>();
if(resourcePermissionCheckService.functionDisabled()){
putMsg(result, Status.FUNCTION_DISABLED);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | }
User user = null;
if (loginUser.getUserType() == UserType.ADMIN_USER) {
user = loginUser;
} else {
user = userMapper.queryDetailsById(loginUser.getId());
List<AlertGroup> alertGroups = alertGroupMapper.queryByUserId(loginUser.getId());
StringBuilder sb = new StringBuilder();
if (alertGroups != null && !alertGroups.isEmpty()) {
for (int i = 0; i < alertGroups.size() - 1; i++) {
sb.append(alertGroups.get(i).getGroupName()).append(",");
}
sb.append(alertGroups.get(alertGroups.size() - 1));
user.setAlertGroup(sb.toString());
}
}
if (StringUtils.isEmpty(user.getTimeZone())) {
user.setTimeZone(TimeZone.getDefault().toZoneId().getId());
}
result.put(Constants.DATA_LIST, user);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query user list
*
* @param loginUser login user
* @return user list
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | @Override
public Map<String, Object> queryAllGeneralUsers(User loginUser) {
Map<String, Object> result = new HashMap<>();
if(resourcePermissionCheckService.functionDisabled()){
putMsg(result, Status.FUNCTION_DISABLED);
return result;
}
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
List<User> userList = userMapper.queryAllGeneralUser();
result.put(Constants.DATA_LIST, userList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query user list
*
* @param loginUser login user
* @return user list
*/
@Override
public Map<String, Object> queryUserList(User loginUser) {
Map<String, Object> result = new HashMap<>();
if (!canOperatorPermissions(loginUser,null, AuthorizationType.ACCESS_TOKEN, USER_MANAGER)) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | QueryWrapper<User> queryWrapper = new QueryWrapper<>();
queryWrapper.ge("id", 0);
if (loginUser.getUserType().equals(UserType.GENERAL_USER)) {
queryWrapper.eq("id", loginUser.getId());
}
List<User> userList = userMapper.selectList(null);
result.put(Constants.DATA_LIST, userList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* verify user name exists
*
* @param userName user name
* @return true if user name not exists, otherwise return false
*/
@Override
public Result<Object> verifyUserName(String userName) {
Result<Object> result = new Result<>();
User user = userMapper.queryByUserNameAccurately(userName);
if (user != null) {
putMsg(result, Status.USER_NAME_EXIST);
} else {
putMsg(result, Status.SUCCESS);
}
return result;
}
/**
* unauthorized user
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | * @param loginUser login user
* @param alertgroupId alert group id
* @return unauthorize result code
*/
@Override
public Map<String, Object> unauthorizedUser(User loginUser, Integer alertgroupId) {
Map<String, Object> result = new HashMap<>();
if(resourcePermissionCheckService.functionDisabled()){
putMsg(result, Status.FUNCTION_DISABLED);
return result;
}
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
List<User> userList = userMapper.selectList(null);
List<User> resultUsers = new ArrayList<>();
Set<User> userSet = null;
if (userList != null && !userList.isEmpty()) {
userSet = new HashSet<>(userList);
List<User> authedUserList = userMapper.queryUserListByAlertGroupId(alertgroupId);
Set<User> authedUserSet = null;
if (authedUserList != null && !authedUserList.isEmpty()) {
authedUserSet = new HashSet<>(authedUserList);
userSet.removeAll(authedUserSet);
}
resultUsers = new ArrayList<>(userSet);
}
result.put(Constants.DATA_LIST, resultUsers);
putMsg(result, Status.SUCCESS); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | return result;
}
/**
* authorized user
*
* @param loginUser login user
* @param alertGroupId alert group id
* @return authorized result code
*/
@Override
public Map<String, Object> authorizedUser(User loginUser, Integer alertGroupId) {
Map<String, Object> result = new HashMap<>();
if(resourcePermissionCheckService.functionDisabled()){
putMsg(result, Status.FUNCTION_DISABLED);
return result;
}
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
List<User> userList = userMapper.queryUserListByAlertGroupId(alertGroupId);
result.put(Constants.DATA_LIST, userList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* @param tenantId tenant id
* @return true if tenant exists, otherwise return false
*/
private boolean checkTenantExists(int tenantId) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | return tenantMapper.queryById(tenantId) != null;
}
/**
* @return if check failed return the field, otherwise return null
*/
private String checkUserParams(String userName, String password, String email, String phone) {
String msg = null;
if (!CheckUtils.checkUserName(userName)) {
msg = userName;
} else if (!CheckUtils.checkPassword(password)) {
msg = password;
} else if (!CheckUtils.checkEmail(email)) {
msg = email;
} else if (!CheckUtils.checkPhone(phone)) {
msg = phone;
}
return msg;
}
/**
* copy resource files
* xxx unchecked
*
* @param resourceComponent resource component
* @param srcBasePath src base path
* @param dstBasePath dst base path
* @throws IOException io exception
*/
private void copyResourceFiles(String oldTenantCode, String newTenantCode, ResourceComponent resourceComponent, String srcBasePath, String dstBasePath) {
List<ResourceComponent> components = resourceComponent.getChildren();
try { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | if (CollectionUtils.isNotEmpty(components)) {
for (ResourceComponent component : components) {
if (!storageOperate.exists(oldTenantCode, String.format(Constants.FORMAT_S_S, srcBasePath, component.getFullName()))) {
logger.error("resource file: {} not exist,copy error", component.getFullName());
throw new ServiceException(Status.RESOURCE_NOT_EXIST);
}
if (!component.isDirctory()) {
storageOperate.copy(String.format(Constants.FORMAT_S_S, srcBasePath, component.getFullName()), String.format(Constants.FORMAT_S_S, dstBasePath, component.getFullName()), false, true);
continue;
}
if (CollectionUtils.isEmpty(component.getChildren())) {
if (!storageOperate.exists(oldTenantCode, String.format(Constants.FORMAT_S_S, dstBasePath, component.getFullName()))) {
storageOperate.mkdir(newTenantCode, String.format(Constants.FORMAT_S_S, dstBasePath, component.getFullName()));
}
} else {
copyResourceFiles(oldTenantCode, newTenantCode, component, srcBasePath, dstBasePath);
}
}
}
} catch (IOException e) {
logger.error("copy the resources failed,the error message is {}", e.getMessage());
}
}
/**
* registry user, default state is 0, default tenant_id is 1, no phone, no queue
*
* @param userName user name |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | * @param userPassword user password
* @param repeatPassword repeat password
* @param email email
* @return registry result code
* @throws Exception exception
*/
@Override
@Transactional
public Map<String, Object> registerUser(String userName, String userPassword, String repeatPassword, String email) {
Map<String, Object> result = new HashMap<>();
String msg = this.checkUserParams(userName, userPassword, email, "");
if(resourcePermissionCheckService.functionDisabled()){
putMsg(result, Status.FUNCTION_DISABLED);
return result;
}
if (!StringUtils.isEmpty(msg)) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, msg);
return result;
}
if (!userPassword.equals(repeatPassword)) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "two passwords are not same");
return result;
}
User user = createUser(userName, userPassword, email, 1, "", "", Flag.NO.ordinal());
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, user);
return result;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | * activate user, only system admin have permission, change user state code 0 to 1
*
* @param loginUser login user
* @param userName user name
* @return create result code
*/
@Override
public Map<String, Object> activateUser(User loginUser, String userName) {
Map<String, Object> result = new HashMap<>();
result.put(Constants.STATUS, false);
if(resourcePermissionCheckService.functionDisabled()){
putMsg(result, Status.FUNCTION_DISABLED);
return result;
}
if (!isAdmin(loginUser)) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
if (!CheckUtils.checkUserName(userName)) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, userName);
return result;
}
User user = userMapper.queryByUserNameAccurately(userName);
if (user == null) {
putMsg(result, Status.USER_NOT_EXIST, userName);
return result;
}
if (user.getState() != Flag.NO.ordinal()) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, userName);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | }
user.setState(Flag.YES.ordinal());
Date now = new Date();
user.setUpdateTime(now);
userMapper.updateById(user);
User responseUser = userMapper.queryByUserNameAccurately(userName);
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, responseUser);
return result;
}
/**
* activate user, only system admin have permission, change users state code 0 to 1
*
* @param loginUser login user
* @param userNames user name
* @return create result code
*/
@Override
public Map<String, Object> batchActivateUser(User loginUser, List<String> userNames) {
Map<String, Object> result = new HashMap<>();
if(resourcePermissionCheckService.functionDisabled()){
putMsg(result, Status.FUNCTION_DISABLED);
return result;
}
if (!isAdmin(loginUser)) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
int totalSuccess = 0;
List<String> successUserNames = new ArrayList<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | Map<String, Object> successRes = new HashMap<>();
int totalFailed = 0;
List<Map<String, String>> failedInfo = new ArrayList<>();
Map<String, Object> failedRes = new HashMap<>();
for (String userName : userNames) {
Map<String, Object> tmpResult = activateUser(loginUser, userName);
if (tmpResult.get(Constants.STATUS) != Status.SUCCESS) {
totalFailed++;
Map<String, String> failedBody = new HashMap<>();
failedBody.put("userName", userName);
Status status = (Status) tmpResult.get(Constants.STATUS);
String errorMessage = MessageFormat.format(status.getMsg(), userName);
failedBody.put("msg", errorMessage);
failedInfo.add(failedBody);
} else {
totalSuccess++;
successUserNames.add(userName);
}
}
successRes.put("sum", totalSuccess);
successRes.put("userName", successUserNames);
failedRes.put("sum", totalFailed);
failedRes.put("info", failedInfo);
Map<String, Object> res = new HashMap<>();
res.put("success", successRes);
res.put("failed", failedRes);
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, res);
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,760 | [Feature][dolphinscheduler-api] Some variables are redundant | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Subclasses that inherit BaseServiceImpl and have the resourcePermissionCheckService attribute should remove this attribute in the subclass. Because this attribute already exists in the BaseServiceImpl class (eg:DataSourceServiceImpl ,ProjectServiceImpl)
### Use case
remove the resourcePermissionCheckService attribute
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10760 | https://github.com/apache/dolphinscheduler/pull/11213 | 163df5f1a3acccea6f6cd68e2921a892b6dc8935 | cb001b581aa7649f6bde5b15cbc022ba8b989874 | 2022-07-04T05:53:40Z | java | 2022-08-01T01:24:02Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | /**
* Make sure user with given name exists, and create the user if not exists
* <p>
* ONLY for python gateway server, and should not use this in web ui function
*
* @param userName user name
* @param userPassword user password
* @param email user email
* @param phone user phone
* @param tenantCode tenant code
* @param queue queue
* @param state state
* @return create result code
*/
@Override
@Transactional
public User createUserIfNotExists(String userName, String userPassword, String email, String phone, String tenantCode,
String queue,
int state) throws IOException {
User user = userMapper.queryByUserNameAccurately(userName);
if (Objects.isNull(user)) {
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
user = createUser(userName, userPassword, email, tenant.getId(), phone, queue, state);
return user;
}
updateUser(user, user.getId(), userName, userPassword, email, user.getTenantId(), phone, queue, state, null);
return user;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertChannel.java | /*
* Licensed to 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. Apache Software Foundation (ASF) licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.dolphinscheduler.alert.api;
/**
* alert channel for sending alerts
*/
public interface AlertChannel { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertChannel.java | /**
* process and send alert
* @param info alert info
* @return process alarm result
*/
AlertResult process(AlertInfo info);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertData.java | /*
* Licensed to 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. Apache Software Foundation (ASF) licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.dolphinscheduler.alert.api;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* alert data
*/
@AllArgsConstructor |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertData.java | @Builder
@Data
@NoArgsConstructor
public class AlertData {
/**
* alert id
*/
private int id;
/**
* alert tile
*/
private String title;
/**
* alert content
*/
private String content;
/**
* alert log
*/
private String log;
/**
* 0 do not send warning;
* 1 send if process success;
* 2 send if process failed;
* 3 send if process ends, whatever the result;
*/
private int warnType;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertResult.java | /*
* Licensed to 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. Apache Software Foundation (ASF) licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.dolphinscheduler.alert.api;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* alert result
*/
@AllArgsConstructor |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertResult.java | @Data
@NoArgsConstructor
public class AlertResult {
/**
* false or true
*/
private String status;
/**
* alert result message
*/
private String message;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.java | /*
* 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 |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.java | * limitations under the License.
*/
package org.apache.dolphinscheduler.alert;
import org.apache.dolphinscheduler.alert.api.AlertChannel;
import org.apache.dolphinscheduler.alert.api.AlertConstants;
import org.apache.dolphinscheduler.alert.api.AlertData;
import org.apache.dolphinscheduler.alert.api.AlertInfo;
import org.apache.dolphinscheduler.alert.api.AlertResult;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.AlertStatus;
import org.apache.dolphinscheduler.common.enums.WarningType;
import org.apache.dolphinscheduler.common.thread.Stopper;
import org.apache.dolphinscheduler.common.thread.ThreadUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.AlertDao;
import org.apache.dolphinscheduler.dao.entity.Alert;
import org.apache.dolphinscheduler.dao.entity.AlertPluginInstance;
import org.apache.dolphinscheduler.remote.command.alert.AlertSendResponseCommand;
import org.apache.dolphinscheduler.remote.command.alert.AlertSendResponseResult;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@Service |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.java | public final class AlertSenderService extends Thread {
private static final Logger logger = LoggerFactory.getLogger(AlertSenderService.class);
private final AlertDao alertDao;
private final AlertPluginManager alertPluginManager;
private final AlertConfig alertConfig;
public AlertSenderService(AlertDao alertDao, AlertPluginManager alertPluginManager, AlertConfig alertConfig) {
this.alertDao = alertDao;
this.alertPluginManager = alertPluginManager;
this.alertConfig = alertConfig;
}
@Override
public synchronized void start() {
super.setName("AlertSenderService");
super.start();
}
@Override
public void run() { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.java | logger.info("alert sender started");
while (Stopper.isRunning()) {
try {
List<Alert> alerts = alertDao.listPendingAlerts();
this.send(alerts);
ThreadUtils.sleep(Constants.SLEEP_TIME_MILLIS * 5L);
} catch (Exception e) {
logger.error("alert sender thread error", e);
}
}
}
public void send(List<Alert> alerts) {
for (Alert alert : alerts) {
int alertId = Optional.ofNullable(alert.getId()).orElse(0);
int alertGroupId = Optional.ofNullable(alert.getAlertGroupId()).orElse(0);
List<AlertPluginInstance> alertInstanceList = alertDao.listInstanceByAlertGroupId(alertGroupId);
if (CollectionUtils.isEmpty(alertInstanceList)) {
logger.error("send alert msg fail,no bind plugin instance.");
alertDao.updateAlert(AlertStatus.EXECUTION_FAILURE, "no bind plugin instance", alertId);
continue;
}
AlertData alertData = AlertData.builder()
.id(alertId)
.content(alert.getContent())
.log(alert.getLog())
.title(alert.getTitle())
.warnType(alert.getWarningType().getCode())
.build();
int sendSuccessCount = 0; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.java | for (AlertPluginInstance instance : alertInstanceList) {
AlertResult alertResult = this.alertResultHandler(instance, alertData);
if (alertResult != null) {
AlertStatus sendStatus = Boolean.parseBoolean(String.valueOf(alertResult.getStatus())) ? AlertStatus.EXECUTION_SUCCESS : AlertStatus.EXECUTION_FAILURE;
alertDao.addAlertSendStatus(sendStatus,alertResult.getMessage(),alertId,instance.getId());
if (sendStatus.equals(AlertStatus.EXECUTION_SUCCESS)) {
sendSuccessCount++;
}
}
}
AlertStatus alertStatus = AlertStatus.EXECUTION_SUCCESS;
if (sendSuccessCount == 0) {
alertStatus = AlertStatus.EXECUTION_FAILURE;
} else if (sendSuccessCount < alertInstanceList.size()) {
alertStatus = AlertStatus.EXECUTION_PARTIAL_SUCCESS;
}
alertDao.updateAlert(alertStatus, "", alertId);
}
}
/**
* sync send alert handler
*
* @param alertGroupId alertGroupId
* @param title title
* @param content content
* @return AlertSendResponseCommand
*/
public AlertSendResponseCommand syncHandler(int alertGroupId, String title, String content, int warnType) {
List<AlertPluginInstance> alertInstanceList = alertDao.listInstanceByAlertGroupId(alertGroupId);
AlertData alertData = AlertData.builder() |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.java | .content(content)
.title(title)
.warnType(warnType)
.build();
boolean sendResponseStatus = true;
List<AlertSendResponseResult> sendResponseResults = new ArrayList<>();
if (CollectionUtils.isEmpty(alertInstanceList)) {
AlertSendResponseResult alertSendResponseResult = new AlertSendResponseResult();
String message = String.format("Alert GroupId %s send error : not found alert instance", alertGroupId);
alertSendResponseResult.setStatus(false);
alertSendResponseResult.setMessage(message);
sendResponseResults.add(alertSendResponseResult);
logger.error("Alert GroupId {} send error : not found alert instance", alertGroupId);
return new AlertSendResponseCommand(false, sendResponseResults);
}
for (AlertPluginInstance instance : alertInstanceList) {
AlertResult alertResult = this.alertResultHandler(instance, alertData);
if (alertResult != null) {
AlertSendResponseResult alertSendResponseResult = new AlertSendResponseResult(
Boolean.parseBoolean(String.valueOf(alertResult.getStatus())), alertResult.getMessage());
sendResponseStatus = sendResponseStatus && alertSendResponseResult.getStatus();
sendResponseResults.add(alertSendResponseResult);
}
}
return new AlertSendResponseCommand(sendResponseStatus, sendResponseResults);
}
/**
* alert result handler
*
* @param instance instance |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.java | * @param alertData alertData
* @return AlertResult
*/
private AlertResult alertResultHandler(AlertPluginInstance instance, AlertData alertData) {
Optional<AlertChannel> alertChannel = alertPluginManager.getAlertChannel(instance.getPluginDefineId());
AlertResult alertResultExtend = new AlertResult();
String pluginInstanceName = instance.getInstanceName();
if (!alertChannel.isPresent()) {
String message = String.format("Alert Plugin %s send error : return value is null", pluginInstanceName);
alertResultExtend.setStatus(String.valueOf(false));
alertResultExtend.setMessage(message);
logger.error("Alert Plugin {} send error : not found plugin {}", pluginInstanceName, instance.getPluginDefineId());
return alertResultExtend;
}
Map<String, String> paramsMap = JSONUtils.toMap(instance.getPluginInstanceParams());
String instanceWarnType = WarningType.ALL.getDescp();
if (paramsMap != null) {
instanceWarnType = paramsMap.getOrDefault(AlertConstants.NAME_WARNING_TYPE, WarningType.ALL.getDescp());
}
WarningType warningType = WarningType.of(instanceWarnType);
if (warningType == null) {
String message = String.format("Alert Plugin %s send error : plugin warnType is null", pluginInstanceName);
alertResultExtend.setStatus(String.valueOf(false));
alertResultExtend.setMessage(message);
logger.error("Alert Plugin {} send error : plugin warnType is null", pluginInstanceName);
return alertResultExtend;
}
boolean sendWarning = false;
switch (warningType) {
case ALL: |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.java | sendWarning = true;
break;
case SUCCESS:
if (alertData.getWarnType() == WarningType.SUCCESS.getCode()) {
sendWarning = true;
}
break;
case FAILURE:
if (alertData.getWarnType() == WarningType.FAILURE.getCode()) {
sendWarning = true;
}
break;
default:
}
if (!sendWarning) {
logger.info("Alert Plugin {} send ignore warning type not match: plugin warning type is {}, alert data warning type is {}",
pluginInstanceName, warningType.getCode(), alertData.getWarnType());
return null;
}
AlertInfo alertInfo = AlertInfo.builder()
.alertData(alertData)
.alertParams(paramsMap)
.build();
int waitTimeout = alertConfig.getWaitTimeout();
AlertResult alertResult;
try {
if (waitTimeout <= 0) {
alertResult = alertChannel.get().process(alertInfo);
} else {
CompletableFuture<AlertResult> future = |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.java | CompletableFuture.supplyAsync(() -> alertChannel.get().process(alertInfo));
alertResult = future.get(waitTimeout, TimeUnit.MILLISECONDS);
}
} catch (InterruptedException e) {
alertResult = new AlertResult("false", e.getMessage());
logger.error("send alert error alert data id :{},", alertData.getId(), e);
Thread.currentThread().interrupt();
} catch (Exception e) {
alertResult = new AlertResult("false", e.getMessage());
logger.error("send alert error alert data id :{},", alertData.getId(), e);
}
if (alertResult == null) {
String message = String.format("Alert Plugin %s send error : return alertResult value is null", pluginInstanceName);
alertResultExtend.setStatus(String.valueOf(false));
alertResultExtend.setMessage(message);
logger.info("Alert Plugin {} send error : return alertResult value is null", pluginInstanceName);
} else if (!Boolean.parseBoolean(String.valueOf(alertResult.getStatus()))) {
alertResultExtend.setStatus(String.valueOf(false));
alertResultExtend.setMessage(alertResult.getMessage());
logger.info("Alert Plugin {} send error : {}", pluginInstanceName, alertResult.getMessage());
} else {
String message = String.format("Alert Plugin %s send success", pluginInstanceName);
alertResultExtend.setStatus(String.valueOf(true));
alertResultExtend.setMessage(message);
logger.info("Alert Plugin {} send success", pluginInstanceName);
}
return alertResultExtend;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/AlertType.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.common.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/AlertType.java | * describe the reason why alert generates
*/
public enum AlertType {
/**
* 0 process instance failure, 1 process instance success, 2 process instance blocked, 3 process instance timeout, 4 fault tolerance warning,
* 5 task failure, 6 task success, 7 task timeout
*/
PROCESS_INSTANCE_FAILURE(0, "process instance failure"),
PROCESS_INSTANCE_SUCCESS(1, "process instance success"),
PROCESS_INSTANCE_BLOCKED(2, "process instance blocked"),
PROCESS_INSTANCE_TIMEOUT(3, "process instance timeout"),
FAULT_TOLERANCE_WARNING(4, "fault tolerance warning"),
TASK_FAILURE(5, "task failure"),
TASK_SUCCESS(6, "task success"),
TASK_TIMEOUT(7, "task timeout"),;
AlertType(int code, String descp) {
this.code = code;
this.descp = descp;
}
@EnumValue
private final int code;
private final String descp;
public int getCode() {
return code;
}
public String getDescp() {
return descp;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java | /*
* 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 |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java | *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.dao;
import org.apache.dolphinscheduler.common.enums.AlertEvent;
import org.apache.dolphinscheduler.common.enums.AlertStatus;
import org.apache.dolphinscheduler.common.enums.AlertType;
import org.apache.dolphinscheduler.common.enums.AlertWarnLevel;
import org.apache.dolphinscheduler.common.enums.WarningType;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.entity.Alert;
import org.apache.dolphinscheduler.dao.entity.AlertPluginInstance;
import org.apache.dolphinscheduler.dao.entity.AlertSendStatus;
import org.apache.dolphinscheduler.dao.entity.ProcessAlertContent;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.ProjectUser;
import org.apache.dolphinscheduler.dao.entity.ServerAlertContent;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.dao.mapper.AlertGroupMapper;
import org.apache.dolphinscheduler.dao.mapper.AlertMapper;
import org.apache.dolphinscheduler.dao.mapper.AlertPluginInstanceMapper;
import org.apache.dolphinscheduler.dao.mapper.AlertSendStatusMapper;
import org.apache.commons.codec.digest.DigestUtils;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.ArrayList; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java | import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
@Component
public class AlertDao {
@Value("${alert.alarm-suppression.crash:60}")
private Integer crashAlarmSuppression;
@Autowired
private AlertMapper alertMapper;
@Autowired
private AlertPluginInstanceMapper alertPluginInstanceMapper;
@Autowired
private AlertGroupMapper alertGroupMapper;
@Autowired
private AlertSendStatusMapper alertSendStatusMapper;
/**
* insert alert
*
* @param alert alert
* @return add alert result
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java | public int addAlert(Alert alert) {
String sign = generateSign(alert);
alert.setSign(sign);
return alertMapper.insert(alert);
}
/**
* update alert sending(execution) status
*
* @param alertStatus alertStatus
* @param log log
* @param id id
* @return update alert result
*/
public int updateAlert(AlertStatus alertStatus, String log, int id) {
Alert alert = new Alert();
alert.setId(id);
alert.setAlertStatus(alertStatus);
alert.setUpdateTime(new Date());
alert.setLog(log);
return alertMapper.updateById(alert);
}
/**
* generate sign for alert
*
* @param alert alert
* @return sign's str
*/
private String generateSign (Alert alert) {
return Optional.of(alert)
.map(Alert::getContent) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java | .map(DigestUtils::sha1Hex)
.map(String::toLowerCase)
.orElse("");
}
/**
* add AlertSendStatus
*
* @param sendStatus alert send status
* @param log log
* @param alertId alert id
* @param alertPluginInstanceId alert plugin instance id
* @return insert count
*/
public int addAlertSendStatus(AlertStatus sendStatus, String log, int alertId, int alertPluginInstanceId) {
AlertSendStatus alertSendStatus = new AlertSendStatus();
alertSendStatus.setAlertId(alertId);
alertSendStatus.setAlertPluginInstanceId(alertPluginInstanceId);
alertSendStatus.setSendStatus(sendStatus);
alertSendStatus.setLog(log);
alertSendStatus.setCreateTime(new Date());
return alertSendStatusMapper.insert(alertSendStatus);
}
/**
* MasterServer or WorkerServer stopped
*
* @param alertGroupId alertGroupId
* @param host host
* @param serverType serverType
*/
public void sendServerStoppedAlert(int alertGroupId, String host, String serverType) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java | ServerAlertContent serverStopAlertContent = ServerAlertContent.newBuilder().
type(serverType)
.host(host)
.event(AlertEvent.SERVER_DOWN)
.warningLevel(AlertWarnLevel.SERIOUS).
build();
String content = JSONUtils.toJsonString(Lists.newArrayList(serverStopAlertContent));
Alert alert = new Alert();
alert.setTitle("Fault tolerance warning");
alert.setWarningType(WarningType.FAILURE);
alert.setAlertStatus(AlertStatus.WAIT_EXECUTION);
alert.setContent(content);
alert.setAlertGroupId(alertGroupId);
alert.setCreateTime(new Date());
alert.setUpdateTime(new Date());
alert.setAlertType(AlertType.FAULT_TOLERANCE_WARNING);
alert.setSign(generateSign(alert));
Date crashAlarmSuppressionStartTime = Date.from(LocalDateTime.now().plusMinutes(-crashAlarmSuppression).atZone(ZoneId.systemDefault()).toInstant());
alertMapper.insertAlertWhenServerCrash(alert, crashAlarmSuppressionStartTime);
}
/**
* process time out alert
*
* @param processInstance processInstance
* @param projectUser projectUser
*/
public void sendProcessTimeoutAlert(ProcessInstance processInstance, ProjectUser projectUser) {
int alertGroupId = processInstance.getWarningGroupId(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java | Alert alert = new Alert();
List<ProcessAlertContent> processAlertContentList = new ArrayList<>(1);
ProcessAlertContent processAlertContent = ProcessAlertContent.newBuilder()
.projectCode(projectUser.getProjectCode())
.projectName(projectUser.getProjectName())
.owner(projectUser.getUserName())
.processId(processInstance.getId())
.processDefinitionCode(processInstance.getProcessDefinitionCode())
.processName(processInstance.getName())
.processType(processInstance.getCommandType())
.processState(processInstance.getState())
.runTimes(processInstance.getRunTimes())
.processStartTime(processInstance.getStartTime())
.processHost(processInstance.getHost())
.event(AlertEvent.TIME_OUT)
.warningLevel(AlertWarnLevel.MIDDLE)
.build();
processAlertContentList.add(processAlertContent);
String content = JSONUtils.toJsonString(processAlertContentList);
alert.setTitle("Process Timeout Warn");
alert.setProjectCode(projectUser.getProjectCode());
alert.setProcessDefinitionCode(processInstance.getProcessDefinitionCode());
alert.setProcessInstanceId(processInstance.getId());
alert.setAlertType(AlertType.PROCESS_INSTANCE_TIMEOUT);
saveTaskTimeoutAlert(alert, content, alertGroupId);
}
private void saveTaskTimeoutAlert(Alert alert, String content, int alertGroupId) {
alert.setAlertGroupId(alertGroupId);
alert.setWarningType(WarningType.FAILURE);
alert.setContent(content); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java | alert.setCreateTime(new Date());
alert.setUpdateTime(new Date());
String sign = generateSign(alert);
alert.setSign(sign);
alertMapper.insert(alert);
}
/**
* task timeout warn
*
* @param processInstance processInstanceId
* @param taskInstance taskInstance
* @param projectUser projectUser
*/
public void sendTaskTimeoutAlert(ProcessInstance processInstance, TaskInstance taskInstance, ProjectUser projectUser) {
Alert alert = new Alert();
List<ProcessAlertContent> processAlertContentList = new ArrayList<>(1);
ProcessAlertContent processAlertContent = ProcessAlertContent.newBuilder()
.projectCode(projectUser.getProjectCode())
.projectName(projectUser.getProjectName())
.owner(projectUser.getUserName())
.processId(processInstance.getId())
.processDefinitionCode(processInstance.getProcessDefinitionCode())
.processName(processInstance.getName())
.taskCode(taskInstance.getTaskCode())
.taskName(taskInstance.getName())
.taskType(taskInstance.getTaskType())
.taskStartTime(taskInstance.getStartTime())
.taskHost(taskInstance.getHost())
.event(AlertEvent.TIME_OUT)
.warningLevel(AlertWarnLevel.MIDDLE) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java | .build();
processAlertContentList.add(processAlertContent);
String content = JSONUtils.toJsonString(processAlertContentList);
alert.setTitle("Task Timeout Warn");
alert.setProjectCode(projectUser.getProjectCode());
alert.setProcessDefinitionCode(processInstance.getProcessDefinitionCode());
alert.setProcessInstanceId(processInstance.getId());
alert.setAlertType(AlertType.TASK_TIMEOUT);
saveTaskTimeoutAlert(alert, content, processInstance.getWarningGroupId());
}
/**
* List alerts that are pending for execution
*/
public List<Alert> listPendingAlerts() {
LambdaQueryWrapper<Alert> wrapper = new QueryWrapper<>(new Alert()).lambda()
.eq(Alert::getAlertStatus, AlertStatus.WAIT_EXECUTION);
return alertMapper.selectList(wrapper);
}
/**
* for test
*
* @return AlertMapper
*/
public AlertMapper getAlertMapper() {
return alertMapper;
}
/**
* list all alert plugin instance by alert group id
*
* @param alertGroupId alert group id |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/AlertDao.java | * @return AlertPluginInstance list
*/
public List<AlertPluginInstance> listInstanceByAlertGroupId(int alertGroupId) {
String alertInstanceIdsParam = alertGroupMapper.queryAlertGroupInstanceIdsById(alertGroupId);
if (!Strings.isNullOrEmpty(alertInstanceIdsParam)) {
String[] idsArray = alertInstanceIdsParam.split(",");
List<Integer> ids = Arrays.stream(idsArray)
.map(s -> Integer.parseInt(s.trim()))
.collect(Collectors.toList());
return alertPluginInstanceMapper.queryByIds(ids);
}
return null;
}
public AlertPluginInstanceMapper getAlertPluginInstanceMapper() {
return alertPluginInstanceMapper;
}
public void setAlertPluginInstanceMapper(AlertPluginInstanceMapper alertPluginInstanceMapper) {
this.alertPluginInstanceMapper = alertPluginInstanceMapper;
}
public AlertGroupMapper getAlertGroupMapper() {
return alertGroupMapper;
}
public void setAlertGroupMapper(AlertGroupMapper alertGroupMapper) {
this.alertGroupMapper = alertGroupMapper;
}
public void setCrashAlarmSuppression(Integer crashAlarmSuppression) {
this.crashAlarmSuppression = crashAlarmSuppression;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | /*
* Lcensed to the Apache Software Foundaton (ASF) under one or more
* contrbutor lcense agreements. See the NOTICE fle dstrbuted wth
* ths work for addtonal nformaton regardng copyrght ownershp.
* The ASF lcenses ths fle to You under the Apache Lcense, Verson 2.0
* (the "Lcense"); you may not use ths fle except n complance wth
* the Lcense. You may obtan a copy of the Lcense at
*
* http://www.apache.org/lcenses/LICENSE-2.0
*
* Unless requred by applcable law or agreed to n wrtng, software
* dstrbuted under the Lcense s dstrbuted on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, ether express or mpled.
* See the Lcense for the specfc language governng permssons and |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | * lmtatons under the Lcense.
*/
package org.apache.dolphnscheduler.server.master.runner;
mport statc org.apache.dolphnscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE;
mport statc org.apache.dolphnscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST;
mport statc org.apache.dolphnscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_START_DATE;
mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_RECOVERY_START_NODE_STRING;
mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_RECOVER_PROCESS_ID_STRING;
mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_START_NODES;
mport statc org.apache.dolphnscheduler.common.Constants.COMMA;
mport statc org.apache.dolphnscheduler.common.Constants.DEFAULT_WORKER_GROUP;
mport statc org.apache.dolphnscheduler.common.Constants.YYYY_MM_DD_HH_MM_SS;
mport statc org.apache.dolphnscheduler.plugn.task.ap.TaskConstants.TASK_TYPE_BLOCKING;
mport statc org.apache.dolphnscheduler.plugn.task.ap.enums.DataType.VARCHAR;
mport statc org.apache.dolphnscheduler.plugn.task.ap.enums.Drect.IN;
mport org.apache.dolphnscheduler.common.Constants;
mport org.apache.dolphnscheduler.common.enums.CommandType;
mport org.apache.dolphnscheduler.common.enums.FalureStrategy;
mport org.apache.dolphnscheduler.common.enums.Flag;
mport org.apache.dolphnscheduler.common.enums.Prorty;
mport org.apache.dolphnscheduler.common.enums.StateEventType;
mport org.apache.dolphnscheduler.common.enums.TaskDependType;
mport org.apache.dolphnscheduler.common.enums.TaskGroupQueueStatus;
mport org.apache.dolphnscheduler.common.graph.DAG;
mport org.apache.dolphnscheduler.common.model.TaskNode;
mport org.apache.dolphnscheduler.common.model.TaskNodeRelaton;
mport org.apache.dolphnscheduler.common.process.ProcessDag;
mport org.apache.dolphnscheduler.common.thread.ThreadUtls;
mport org.apache.dolphnscheduler.common.utls.DateUtls;
mport org.apache.dolphnscheduler.common.utls.JSONUtls; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | mport org.apache.dolphnscheduler.common.utls.LoggerUtls;
mport org.apache.dolphnscheduler.common.utls.NetUtls;
mport org.apache.dolphnscheduler.dao.entty.Command;
mport org.apache.dolphnscheduler.dao.entty.Envronment;
mport org.apache.dolphnscheduler.dao.entty.ProcessDefnton;
mport org.apache.dolphnscheduler.dao.entty.ProcessInstance;
mport org.apache.dolphnscheduler.dao.entty.ProcessTaskRelaton;
mport org.apache.dolphnscheduler.dao.entty.ProjectUser;
mport org.apache.dolphnscheduler.dao.entty.Schedule;
mport org.apache.dolphnscheduler.dao.entty.TaskDefntonLog;
mport org.apache.dolphnscheduler.dao.entty.TaskGroupQueue;
mport org.apache.dolphnscheduler.dao.entty.TaskInstance;
mport org.apache.dolphnscheduler.dao.utls.DagHelper;
mport org.apache.dolphnscheduler.plugn.task.ap.enums.DependResult;
mport org.apache.dolphnscheduler.plugn.task.ap.enums.Drect;
mport org.apache.dolphnscheduler.plugn.task.ap.enums.ExecutonStatus;
mport org.apache.dolphnscheduler.plugn.task.ap.model.Property;
mport org.apache.dolphnscheduler.remote.command.HostUpdateCommand;
mport org.apache.dolphnscheduler.remote.utls.Host;
mport org.apache.dolphnscheduler.server.master.confg.MasterConfg;
mport org.apache.dolphnscheduler.server.master.dspatch.executor.NettyExecutorManager;
mport org.apache.dolphnscheduler.server.master.event.StateEvent;
mport org.apache.dolphnscheduler.server.master.event.StateEventHandleError;
mport org.apache.dolphnscheduler.server.master.event.StateEventHandleExcepton;
mport org.apache.dolphnscheduler.server.master.event.StateEventHandler;
mport org.apache.dolphnscheduler.server.master.event.StateEventHandlerManager;
mport org.apache.dolphnscheduler.server.master.metrcs.TaskMetrcs;
mport org.apache.dolphnscheduler.server.master.runner.task.ITaskProcessor;
mport org.apache.dolphnscheduler.server.master.runner.task.TaskActon;
mport org.apache.dolphnscheduler.server.master.runner.task.TaskProcessorFactory; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | mport org.apache.dolphnscheduler.servce.alert.ProcessAlertManager;
mport org.apache.dolphnscheduler.servce.cron.CronUtls;
mport org.apache.dolphnscheduler.servce.exceptons.CronParseExcepton;
mport org.apache.dolphnscheduler.servce.expand.CurngParamsServce;
mport org.apache.dolphnscheduler.servce.process.ProcessServce;
mport org.apache.dolphnscheduler.servce.queue.PeerTaskInstancePrortyQueue;
mport org.apache.commons.collectons.CollectonUtls;
mport org.apache.commons.lang3.ArrayUtls;
mport org.apache.commons.lang3.StrngUtls;
mport org.apache.commons.lang3.math.NumberUtls;
mport java.utl.ArrayLst;
mport java.utl.Arrays;
mport java.utl.Collecton;
mport java.utl.Collectons;
mport java.utl.Date;
mport java.utl.HashMap;
mport java.utl.HashSet;
mport java.utl.Iterator;
mport java.utl.Lst;
mport java.utl.Map;
mport java.utl.Objects;
mport java.utl.Optonal;
mport java.utl.Set;
mport java.utl.concurrent.Callable;
mport java.utl.concurrent.ConcurrentHashMap;
mport java.utl.concurrent.ConcurrentLnkedQueue;
mport java.utl.concurrent.atomc.AtomcBoolean;
mport java.utl.stream.Collectors;
mport org.slf4j.Logger;
mport org.slf4j.LoggerFactory; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | mport org.sprngframework.beans.BeanUtls;
mport com.google.common.collect.Lsts;
mport lombok.NonNull;
/**
* Workflow execute task, used to execute a workflow nstance.
*/
publc class WorkflowExecuteRunnable mplements Callable<WorkflowSubmtStatue> {
prvate statc fnal Logger logger = LoggerFactory.getLogger(WorkflowExecuteRunnable.class);
prvate fnal ProcessServce processServce;
prvate fnal ProcessAlertManager processAlertManager;
prvate fnal NettyExecutorManager nettyExecutorManager;
prvate fnal ProcessInstance processInstance;
prvate ProcessDefnton processDefnton;
prvate DAG<Strng, TaskNode, TaskNodeRelaton> dag;
/**
* unque key of workflow
*/
prvate Strng key;
prvate WorkflowRunnableStatus workflowRunnableStatus = WorkflowRunnableStatus.CREATED;
/**
* submt falure nodes
*/
prvate boolean taskFaledSubmt = false;
/**
* task nstance hash map, taskId as key
*/
prvate fnal Map<Integer, TaskInstance> taskInstanceMap = new ConcurrentHashMap<>();
/**
* runnng taskProcessor, taskCode as key, taskProcessor as value
* only on taskProcessor per taskCode |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | */
prvate fnal Map<Long, ITaskProcessor> actveTaskProcessorMaps = new ConcurrentHashMap<>();
/**
* vald task map, taskCode as key, taskId as value
* n a DAG, only one taskInstance per taskCode s vald
*/
prvate fnal Map<Long, Integer> valdTaskMap = new ConcurrentHashMap<>();
/**
* error task map, taskCode as key, taskInstanceId as value
* n a DAG, only one taskInstance per taskCode s vald
*/
prvate fnal Map<Long, Integer> errorTaskMap = new ConcurrentHashMap<>();
/**
* complete task map, taskCode as key, taskInstanceId as value
* n a DAG, only one taskInstance per taskCode s vald
*/
prvate fnal Map<Long, Integer> completeTaskMap = new ConcurrentHashMap<>();
/**
* depend faled task map, taskCode as key, taskId as value
*/
prvate fnal Map<Long, Integer> dependFaledTaskMap = new ConcurrentHashMap<>();
/**
* forbdden task map, code as key
*/
prvate fnal Map<Long, TaskNode> forbddenTaskMap = new ConcurrentHashMap<>();
/**
* skp task map, code as key
*/
prvate fnal Map<Strng, TaskNode> skpTaskNodeMap = new ConcurrentHashMap<>();
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | * complement date lst
*/
prvate Lst<Date> complementLstDate = Lsts.newLnkedLst();
/**
* state event queue
*/
prvate fnal ConcurrentLnkedQueue<StateEvent> stateEvents = new ConcurrentLnkedQueue<>();
/**
* The StandBy task lst, wll be executed, need to know, the taskInstance n ths queue may doesn't have d.
*/
prvate fnal PeerTaskInstancePrortyQueue readyToSubmtTaskQueue = new PeerTaskInstancePrortyQueue();
/**
* wat to retry taskInstance map, taskCode as key, taskInstance as value
* before retry, the taskInstance d s 0
*/
prvate fnal Map<Long, TaskInstance> watToRetryTaskInstanceMap = new ConcurrentHashMap<>();
prvate fnal StateWheelExecuteThread stateWheelExecuteThread;
prvate fnal CurngParamsServce curngParamsServce;
prvate fnal Strng masterAddress;
/**
* @param processInstance processInstance
* @param processServce processServce
* @param nettyExecutorManager nettyExecutorManager
* @param processAlertManager processAlertManager
* @param masterConfg masterConfg
* @param stateWheelExecuteThread stateWheelExecuteThread
*/
publc WorkflowExecuteRunnable(
@NonNull ProcessInstance processInstance,
@NonNull ProcessServce processServce, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | @NonNull NettyExecutorManager nettyExecutorManager,
@NonNull ProcessAlertManager processAlertManager,
@NonNull MasterConfg masterConfg,
@NonNull StateWheelExecuteThread stateWheelExecuteThread,
@NonNull CurngParamsServce curngParamsServce) {
ths.processServce = processServce;
ths.processInstance = processInstance;
ths.nettyExecutorManager = nettyExecutorManager;
ths.processAlertManager = processAlertManager;
ths.stateWheelExecuteThread = stateWheelExecuteThread;
ths.curngParamsServce = curngParamsServce;
ths.masterAddress = NetUtls.getAddr(masterConfg.getLstenPort());
TaskMetrcs.regsterTaskPrepared(readyToSubmtTaskQueue::sze);
}
/**
* the process start nodes are submtted completely.
*/
publc boolean sStart() {
return WorkflowRunnableStatus.STARTED == workflowRunnableStatus;
}
/**
* handle event
*/
publc vod handleEvents() {
f (!sStart()) {
logger.nfo(
"The workflow nstance s not started, wll not handle ts state event, current state event sze: {}",
stateEvents);
return;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | StateEvent stateEvent = null;
whle (!ths.stateEvents.sEmpty()) {
try {
stateEvent = ths.stateEvents.peek();
LoggerUtls.setWorkflowAndTaskInstanceIDMDC(stateEvent.getProcessInstanceId(),
stateEvent.getTaskInstanceId());
checkProcessInstance(stateEvent);
StateEventHandler stateEventHandler =
StateEventHandlerManager.getStateEventHandler(stateEvent.getType())
.orElseThrow(() -> new StateEventHandleError("Cannot fnd handler for the gven state event"));
logger.nfo("Begn to handle state event, {}", stateEvent);
f (stateEventHandler.handleStateEvent(ths, stateEvent)) {
ths.stateEvents.remove(stateEvent);
}
} catch (StateEventHandleError stateEventHandleError) {
logger.error("State event handle error, wll remove ths event: {}", stateEvent, stateEventHandleError);
ths.stateEvents.remove(stateEvent);
ThreadUtls.sleep(Constants.SLEEP_TIME_MILLIS);
} catch (StateEventHandleExcepton stateEventHandleExcepton) {
logger.error("State event handle error, wll retry ths event: {}",
stateEvent,
stateEventHandleExcepton);
ThreadUtls.sleep(Constants.SLEEP_TIME_MILLIS);
} catch (Excepton e) {
logger.error("State event handle error, get a unknown excepton, wll retry ths event: {}",
stateEvent,
e); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | ThreadUtls.sleep(Constants.SLEEP_TIME_MILLIS);
} fnally {
LoggerUtls.removeWorkflowAndTaskInstanceIdMDC();
}
}
}
publc Strng getKey() {
f (StrngUtls.sNotEmpty(key) || ths.processDefnton == null) {
return key;
}
key = Strng.format("%d_%d_%d",
ths.processDefnton.getCode(),
ths.processDefnton.getVerson(),
ths.processInstance.getId());
return key;
}
publc boolean addStateEvent(StateEvent stateEvent) {
f (processInstance.getId() != stateEvent.getProcessInstanceId()) {
logger.nfo("state event would be abounded :{}", stateEvent);
return false;
}
ths.stateEvents.add(stateEvent);
return true;
}
publc nt eventSze() {
return ths.stateEvents.sze();
}
publc ProcessInstance getProcessInstance() {
return ths.processInstance;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | publc boolean checkForceStartAndWakeUp(StateEvent stateEvent) {
TaskGroupQueue taskGroupQueue = ths.processServce.loadTaskGroupQueue(stateEvent.getTaskInstanceId());
f (taskGroupQueue.getForceStart() == Flag.YES.getCode()) {
TaskInstance taskInstance = ths.processServce.fndTaskInstanceById(stateEvent.getTaskInstanceId());
ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(taskInstance.getTaskCode());
taskProcessor.acton(TaskActon.DISPATCH);
ths.processServce.updateTaskGroupQueueStatus(taskGroupQueue.getTaskId(),
TaskGroupQueueStatus.ACQUIRE_SUCCESS.getCode());
return true;
}
f (taskGroupQueue.getInQueue() == Flag.YES.getCode()) {
boolean acqureTaskGroup = processServce.acqureTaskGroupAgan(taskGroupQueue);
f (acqureTaskGroup) {
TaskInstance taskInstance = ths.processServce.fndTaskInstanceById(stateEvent.getTaskInstanceId());
ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(taskInstance.getTaskCode());
taskProcessor.acton(TaskActon.DISPATCH);
return true;
}
}
return false;
}
publc vod processTmeout() {
ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId());
ths.processAlertManager.sendProcessTmeoutAlert(ths.processInstance, projectUser);
}
publc vod taskTmeout(TaskInstance taskInstance) {
ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId());
processAlertManager.sendTaskTmeoutAlert(processInstance, taskInstance, projectUser);
}
publc vod taskFnshed(TaskInstance taskInstance) throws StateEventHandleExcepton { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | logger.nfo("TaskInstance fnshed task code:{} state:{}", taskInstance.getTaskCode(), taskInstance.getState());
try {
actveTaskProcessorMaps.remove(taskInstance.getTaskCode());
stateWheelExecuteThread.removeTask4TmeoutCheck(processInstance, taskInstance);
stateWheelExecuteThread.removeTask4RetryCheck(processInstance, taskInstance);
stateWheelExecuteThread.removeTask4StateCheck(processInstance, taskInstance);
f (taskInstance.getState().typeIsSuccess()) {
completeTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId());
processInstance.setVarPool(taskInstance.getVarPool());
processServce.saveProcessInstance(processInstance);
f (!processInstance.sBlocked()) {
submtPostNode(Long.toStrng(taskInstance.getTaskCode()));
}
} else f (taskInstance.taskCanRetry() && processInstance.getState() != ExecutonStatus.READY_STOP) {
logger.nfo("Retry taskInstance taskInstance state: {}", taskInstance.getState());
retryTaskInstance(taskInstance);
} else f (taskInstance.getState().typeIsFalure()) {
completeTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId());
f (processInstance.getFalureStrategy() == FalureStrategy.CONTINUE && DagHelper.haveAllNodeAfterNode(
Long.toStrng(taskInstance.getTaskCode()),
dag)) {
submtPostNode(Long.toStrng(taskInstance.getTaskCode()));
} else {
errorTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId());
f (processInstance.getFalureStrategy() == FalureStrategy.END) {
kllAllTasks();
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | }
} else f (taskInstance.getState().typeIsFnshed()) {
completeTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId());
}
logger.nfo("TaskInstance fnshed wll try to update the workflow nstance state, task code:{} state:{}",
taskInstance.getTaskCode(),
taskInstance.getState());
ths.updateProcessInstanceState();
} catch (Excepton ex) {
logger.error("Task fnsh faled, get a excepton, wll remove ths taskInstance from completeTaskMap", ex);
completeTaskMap.remove(taskInstance.getTaskCode());
throw ex;
}
}
/**
* release task group
*
* @param taskInstance
*/
publc vod releaseTaskGroup(TaskInstance taskInstance) {
f (taskInstance.getTaskGroupId() > 0) {
TaskInstance nextTaskInstance = ths.processServce.releaseTaskGroup(taskInstance);
f (nextTaskInstance != null) {
f (nextTaskInstance.getProcessInstanceId() == taskInstance.getProcessInstanceId()) {
StateEvent nextEvent = new StateEvent();
nextEvent.setProcessInstanceId(ths.processInstance.getId());
nextEvent.setTaskInstanceId(nextTaskInstance.getId());
nextEvent.setType(StateEventType.WAIT_TASK_GROUP); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | ths.stateEvents.add(nextEvent);
} else {
ProcessInstance processInstance = ths.processServce.fndProcessInstanceById(nextTaskInstance.getProcessInstanceId());
ths.processServce.sendStartTask2Master(processInstance, nextTaskInstance.getId(), org.apache.dolphnscheduler.remote.command.CommandType.TASK_WAKEUP_EVENT_REQUEST);
}
}
}
}
/**
* crate new task nstance to retry, dfferent objects from the orgnal
*
* @param taskInstance
*/
prvate vod retryTaskInstance(TaskInstance taskInstance) throws StateEventHandleExcepton {
f (!taskInstance.taskCanRetry()) {
return;
}
TaskInstance newTaskInstance = cloneRetryTaskInstance(taskInstance);
f (newTaskInstance == null) {
logger.error("retry fal, new taskInstance s null, task code:{}, task d:{}",
taskInstance.getTaskCode(),
taskInstance.getId());
return;
}
watToRetryTaskInstanceMap.put(newTaskInstance.getTaskCode(), newTaskInstance);
f (!taskInstance.retryTaskIntervalOverTme()) {
logger.nfo("falure task wll be submtted: process d: {}, task nstance code: {} state:{} retry tmes:{} / {}, nterval:{}", processInstance.getId(), newTaskInstance.getTaskCode(),
newTaskInstance.getState(), newTaskInstance.getRetryTmes(), newTaskInstance.getMaxRetryTmes(), newTaskInstance.getRetryInterval());
stateWheelExecuteThread.addTask4TmeoutCheck(processInstance, newTaskInstance);
stateWheelExecuteThread.addTask4RetryCheck(processInstance, newTaskInstance); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | } else {
addTaskToStandByLst(newTaskInstance);
submtStandByTask();
watToRetryTaskInstanceMap.remove(newTaskInstance.getTaskCode());
}
}
/**
* update process nstance
*/
publc vod refreshProcessInstance(nt processInstanceId) {
logger.nfo("process nstance update: {}", processInstanceId);
ProcessInstance newProcessInstance = processServce.fndProcessInstanceById(processInstanceId);
BeanUtls.copyPropertes(newProcessInstance, processInstance);
processDefnton = processServce.fndProcessDefnton(processInstance.getProcessDefntonCode(),
processInstance.getProcessDefntonVerson());
processInstance.setProcessDefnton(processDefnton);
}
/**
* update task nstance
*/
publc vod refreshTaskInstance(nt taskInstanceId) {
logger.nfo("task nstance update: {} ", taskInstanceId);
TaskInstance taskInstance = processServce.fndTaskInstanceById(taskInstanceId);
f (taskInstance == null) {
logger.error("can not fnd task nstance, d:{}", taskInstanceId);
return;
}
processServce.packageTaskInstance(taskInstance, processInstance);
taskInstanceMap.put(taskInstance.getId(), taskInstance); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | valdTaskMap.remove(taskInstance.getTaskCode());
f (Flag.YES == taskInstance.getFlag()) {
valdTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId());
}
}
/**
* check process nstance by state event
*/
publc vod checkProcessInstance(StateEvent stateEvent) throws StateEventHandleError {
f (ths.processInstance.getId() != stateEvent.getProcessInstanceId()) {
throw new StateEventHandleError("The event doesn't contans process nstance d");
}
}
/**
* check f task nstance exst by state event
*/
publc vod checkTaskInstanceByStateEvent(StateEvent stateEvent) throws StateEventHandleError {
f (stateEvent.getTaskInstanceId() == 0) {
throw new StateEventHandleError("The taskInstanceId s 0");
}
f (!taskInstanceMap.contansKey(stateEvent.getTaskInstanceId())) {
throw new StateEventHandleError("Cannot fnd the taskInstance from taskInstanceMap");
}
}
/**
* check f task nstance exst by d
*/
publc boolean checkTaskInstanceById(nt taskInstanceId) {
f (taskInstanceMap.sEmpty()) {
return false; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | }
return taskInstanceMap.contansKey(taskInstanceId);
}
/**
* get task nstance from memory
*/
publc Optonal<TaskInstance> getTaskInstance(nt taskInstanceId) {
f (taskInstanceMap.contansKey(taskInstanceId)) {
return Optonal.ofNullable(taskInstanceMap.get(taskInstanceId));
}
return Optonal.empty();
}
publc Optonal<TaskInstance> getTaskInstance(long taskCode) {
f (taskInstanceMap.sEmpty()) {
return Optonal.empty();
}
for (TaskInstance taskInstance : taskInstanceMap.values()) {
f (taskInstance.getTaskCode() == taskCode) {
return Optonal.of(taskInstance);
}
}
return Optonal.empty();
}
publc Optonal<TaskInstance> getActveTaskInstanceByTaskCode(long taskCode) {
Integer taskInstanceId = valdTaskMap.get(taskCode);
f (taskInstanceId != null) {
return Optonal.ofNullable(taskInstanceMap.get(taskInstanceId));
}
return Optonal.empty();
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | publc Optonal<TaskInstance> getRetryTaskInstanceByTaskCode(long taskCode) {
f (watToRetryTaskInstanceMap.contansKey(taskCode)) {
return Optonal.ofNullable(watToRetryTaskInstanceMap.get(taskCode));
}
return Optonal.empty();
}
publc vod processBlock() {
ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId());
processAlertManager.sendProcessBlockngAlert(processInstance, projectUser);
logger.nfo("processInstance {} block alert send successful!", processInstance.getId());
}
publc boolean processComplementData() {
f (!needComplementProcess()) {
return false;
}
f (processInstance.getState() == ExecutonStatus.READY_STOP || !processInstance.getState().typeIsFnshed()) {
return false;
}
Date scheduleDate = processInstance.getScheduleTme();
f (scheduleDate == null) {
scheduleDate = complementLstDate.get(0);
} else f (processInstance.getState().typeIsFnshed()) {
endProcess();
f (complementLstDate.sEmpty()) {
logger.nfo("process complement end. process d:{}", processInstance.getId());
return true;
}
nt ndex = complementLstDate.ndexOf(scheduleDate); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | f (ndex >= complementLstDate.sze() - 1 || !processInstance.getState().typeIsSuccess()) {
logger.nfo("process complement end. process d:{}", processInstance.getId());
return true;
}
logger.nfo("process complement contnue. process d:{}, schedule tme:{} complementLstDate:{}", processInstance.getId(), processInstance.getScheduleTme(), complementLstDate);
scheduleDate = complementLstDate.get(ndex + 1);
}
nt create = ths.createComplementDataCommand(scheduleDate);
f (create > 0) {
logger.nfo("create complement data command successfully.");
}
return true;
}
prvate nt createComplementDataCommand(Date scheduleDate) {
Command command = new Command();
command.setScheduleTme(scheduleDate);
command.setCommandType(CommandType.COMPLEMENT_DATA);
command.setProcessDefntonCode(processInstance.getProcessDefntonCode());
Map<Strng, Strng> cmdParam = JSONUtls.toMap(processInstance.getCommandParam());
f (cmdParam.contansKey(Constants.CMD_PARAM_RECOVERY_START_NODE_STRING)) {
cmdParam.remove(Constants.CMD_PARAM_RECOVERY_START_NODE_STRING);
}
f (cmdParam.contansKey(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST)) {
cmdParam.replace(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST,
cmdParam.get(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST)
.substrng(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST).ndexOf(COMMA) + 1));
}
f (cmdParam.contansKey(CMDPARAM_COMPLEMENT_DATA_START_DATE)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | cmdParam.replace(CMDPARAM_COMPLEMENT_DATA_START_DATE, DateUtls.format(scheduleDate, YYYY_MM_DD_HH_MM_SS, null));
}
command.setCommandParam(JSONUtls.toJsonStrng(cmdParam));
command.setTaskDependType(processInstance.getTaskDependType());
command.setFalureStrategy(processInstance.getFalureStrategy());
command.setWarnngType(processInstance.getWarnngType());
command.setWarnngGroupId(processInstance.getWarnngGroupId());
command.setStartTme(new Date());
command.setExecutorId(processInstance.getExecutorId());
command.setUpdateTme(new Date());
command.setProcessInstanceProrty(processInstance.getProcessInstanceProrty());
command.setWorkerGroup(processInstance.getWorkerGroup());
command.setEnvronmentCode(processInstance.getEnvronmentCode());
command.setDryRun(processInstance.getDryRun());
command.setProcessInstanceId(0);
command.setProcessDefntonVerson(processInstance.getProcessDefntonVerson());
return processServce.createCommand(command);
}
prvate boolean needComplementProcess() {
f (processInstance.sComplementData() && Flag.NO == processInstance.getIsSubProcess()) {
return true;
}
return false;
}
/**
* ProcessInstance start entrypont.
*/
@Overrde
publc WorkflowSubmtStatue call() {
f (sStart()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | logger.warn("[WorkflowInstance-{}] The workflow has already been started", processInstance.getId());
return WorkflowSubmtStatue.DUPLICATED_SUBMITTED;
}
try {
LoggerUtls.setWorkflowInstanceIdMDC(processInstance.getId());
f (workflowRunnableStatus == WorkflowRunnableStatus.CREATED) {
buldFlowDag();
workflowRunnableStatus = WorkflowRunnableStatus.INITIALIZE_DAG;
logger.nfo("workflowStatue changed to :{}", workflowRunnableStatus);
}
f (workflowRunnableStatus == WorkflowRunnableStatus.INITIALIZE_DAG) {
ntTaskQueue();
workflowRunnableStatus = WorkflowRunnableStatus.INITIALIZE_QUEUE;
logger.nfo("workflowStatue changed to :{}", workflowRunnableStatus);
}
f (workflowRunnableStatus == WorkflowRunnableStatus.INITIALIZE_QUEUE) {
submtPostNode(null);
workflowRunnableStatus = WorkflowRunnableStatus.STARTED;
logger.nfo("workflowStatue changed to :{}", workflowRunnableStatus);
}
return WorkflowSubmtStatue.SUCCESS;
} catch (Excepton e) {
logger.error("Start workflow error", e);
return WorkflowSubmtStatue.FAILED;
} fnally {
LoggerUtls.removeWorkflowInstanceIdMDC();
}
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | * process end handle
*/
publc vod endProcess() {
ths.stateEvents.clear();
f (processDefnton.getExecutonType().typeIsSeralWat() || processDefnton.getExecutonType().typeIsSeralProrty()) {
checkSeralProcess(processDefnton);
}
f (processInstance.getState().typeIsWatngThread()) {
processServce.createRecoveryWatngThreadCommand(null, processInstance);
}
f (processAlertManager.sNeedToSendWarnng(processInstance)) {
ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId());
processAlertManager.sendAlertProcessInstance(processInstance, getValdTaskLst(), projectUser);
}
f (checkTaskQueue()) {
processServce.releaseAllTaskGroup(processInstance.getId());
}
}
publc vod checkSeralProcess(ProcessDefnton processDefnton) {
nt nextInstanceId = processInstance.getNextProcessInstanceId();
f (nextInstanceId == 0) {
ProcessInstance nextProcessInstance =
ths.processServce.loadNextProcess4Seral(processInstance.getProcessDefnton().getCode(), ExecutonStatus.SERIAL_WAIT.getCode(), processInstance.getId());
f (nextProcessInstance == null) {
return;
}
ProcessInstance nextReadyStopProcessInstance =
ths.processServce.loadNextProcess4Seral(processInstance.getProcessDefnton().getCode(), ExecutonStatus.READY_STOP.getCode(), processInstance.getId());
f (processDefnton.getExecutonType().typeIsSeralProrty() && nextReadyStopProcessInstance != null) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | return;
}
nextInstanceId = nextProcessInstance.getId();
}
ProcessInstance nextProcessInstance = ths.processServce.fndProcessInstanceById(nextInstanceId);
f (nextProcessInstance.getState().typeIsFnshed() || nextProcessInstance.getState().typeIsRunnng()) {
return;
}
Map<Strng, Object> cmdParam = new HashMap<>();
cmdParam.put(CMD_PARAM_RECOVER_PROCESS_ID_STRING, nextInstanceId);
Command command = new Command();
command.setCommandType(CommandType.RECOVER_SERIAL_WAIT);
command.setProcessInstanceId(nextProcessInstance.getId());
command.setProcessDefntonCode(processDefnton.getCode());
command.setProcessDefntonVerson(processDefnton.getVerson());
command.setCommandParam(JSONUtls.toJsonStrng(cmdParam));
processServce.createCommand(command);
}
/**
* Generate process dag
*
* @throws Excepton excepton
*/
prvate vod buldFlowDag() throws Excepton {
processDefnton = processServce.fndProcessDefnton(processInstance.getProcessDefntonCode(), processInstance.getProcessDefntonVerson());
processInstance.setProcessDefnton(processDefnton);
Lst<TaskInstance> recoverNodeLst = getRecoverTaskInstanceLst(processInstance.getCommandParam());
Lst<ProcessTaskRelaton> processTaskRelatons = processServce.fndRelatonByCode(processDefnton.getCode(), processDefnton.getVerson());
Lst<TaskDefntonLog> taskDefntonLogs = processServce.getTaskDefneLogLstByRelaton(processTaskRelatons);
Lst<TaskNode> taskNodeLst = processServce.transformTask(processTaskRelatons, taskDefntonLogs); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | forbddenTaskMap.clear();
taskNodeLst.forEach(taskNode -> {
f (taskNode.sForbdden()) {
forbddenTaskMap.put(taskNode.getCode(), taskNode);
}
});
Lst<Strng> recoveryNodeCodeLst = getRecoveryNodeCodeLst(recoverNodeLst);
Lst<Strng> startNodeNameLst = parseStartNodeName(processInstance.getCommandParam());
ProcessDag processDag = generateFlowDag(taskNodeLst, startNodeNameLst, recoveryNodeCodeLst, processInstance.getTaskDependType());
f (processDag == null) {
logger.error("processDag s null");
return;
}
dag = DagHelper.buldDagGraph(processDag);
logger.nfo("Buld dag success, dag: {}", dag);
}
/**
* nt task queue
*/
prvate vod ntTaskQueue() throws StateEventHandleExcepton, CronParseExcepton {
taskFaledSubmt = false;
actveTaskProcessorMaps.clear();
dependFaledTaskMap.clear();
completeTaskMap.clear();
errorTaskMap.clear();
f (!sNewProcessInstance()) {
logger.nfo("The workflowInstance s not a newly runnng nstance, runtmes: {}, recover flag: {}",
processInstance.getRunTmes(), |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | processInstance.getRecovery());
Lst<TaskInstance> valdTaskInstanceLst =
processServce.fndValdTaskLstByProcessId(processInstance.getId());
for (TaskInstance task : valdTaskInstanceLst) {
try {
LoggerUtls.setWorkflowAndTaskInstanceIDMDC(task.getProcessInstanceId(), task.getId());
logger.nfo(
"Check the taskInstance from a exst workflowInstance, exstTaskInstanceCode: {}, taskInstanceStatus: {}",
task.getTaskCode(),
task.getState());
f (valdTaskMap.contansKey(task.getTaskCode())) {
nt oldTaskInstanceId = valdTaskMap.get(task.getTaskCode());
TaskInstance oldTaskInstance = taskInstanceMap.get(oldTaskInstanceId);
f (!oldTaskInstance.getState().typeIsFnshed() && task.getState().typeIsFnshed()) {
task.setFlag(Flag.NO);
processServce.updateTaskInstance(task);
contnue;
}
logger.warn("have same taskCode taskInstance when nt task queue, taskCode:{}",
task.getTaskCode());
}
valdTaskMap.put(task.getTaskCode(), task.getId());
taskInstanceMap.put(task.getId(), task);
f (task.sTaskComplete()) {
completeTaskMap.put(task.getTaskCode(), task.getId());
contnue;
}
f (task.sCondtonsTask() || DagHelper.haveCondtonsAfterNode(Long.toStrng(task.getTaskCode()),
dag)) {
contnue; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | }
f (task.taskCanRetry()) {
f (task.getState() == ExecutonStatus.NEED_FAULT_TOLERANCE) {
TaskInstance tolerantTaskInstance = cloneTolerantTaskInstance(task);
addTaskToStandByLst(tolerantTaskInstance);
} else {
retryTaskInstance(task);
}
contnue;
}
f (task.getState().typeIsFalure()) {
errorTaskMap.put(task.getTaskCode(), task.getId());
}
} fnally {
LoggerUtls.removeWorkflowAndTaskInstanceIdMDC();
}
}
} else {
logger.nfo("The current workflowInstance s a newly runnng workflowInstance");
}
f (processInstance.sComplementData() && complementLstDate.sEmpty()) {
Map<Strng, Strng> cmdParam = JSONUtls.toMap(processInstance.getCommandParam());
f (cmdParam != null) {
setGlobalParamIfCommanded(processDefnton, cmdParam);
Date start = null;
Date end = null;
f (cmdParam.contansKey(CMDPARAM_COMPLEMENT_DATA_START_DATE) && cmdParam.contansKey(CMDPARAM_COMPLEMENT_DATA_END_DATE)) {
start = DateUtls.strngToDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | end = DateUtls.strngToDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_END_DATE));
}
Lst<Schedule> schedules = processServce.queryReleaseSchedulerLstByProcessDefntonCode(processInstance.getProcessDefntonCode());
f (complementLstDate.sEmpty() && needComplementProcess()) {
f (start != null && end != null) {
complementLstDate = CronUtls.getSelfFreDateLst(start, end, schedules);
}
f (cmdParam.contansKey(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST)) {
complementLstDate = CronUtls.getSelfScheduleDateLst(cmdParam);
}
logger.nfo(" process defnton code:{} complement data: {}", processInstance.getProcessDefntonCode(), complementLstDate);
f (!complementLstDate.sEmpty() && Flag.NO == processInstance.getIsSubProcess()) {
processInstance.setScheduleTme(complementLstDate.get(0));
Strng globalParams = curngParamsServce.curngGlobalParams(processInstance.getId(),
processDefnton.getGlobalParamMap(),
processDefnton.getGlobalParamLst(),
CommandType.COMPLEMENT_DATA,
processInstance.getScheduleTme(),
cmdParam.get(Constants.SCHEDULE_TIMEZONE));
processInstance.setGlobalParams(globalParams);
processServce.updateProcessInstance(processInstance);
}
}
}
}
logger.nfo("Intalze task queue, dependFaledTaskMap: {}, completeTaskMap: {}, errorTaskMap: {}",
dependFaledTaskMap,
completeTaskMap,
errorTaskMap);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | /**
* submt task to execute
*
* @param taskInstance task nstance
* @return TaskInstance
*/
prvate Optonal<TaskInstance> submtTaskExec(TaskInstance taskInstance) {
try {
processServce.packageTaskInstance(taskInstance, processInstance);
ITaskProcessor taskProcessor = TaskProcessorFactory.getTaskProcessor(taskInstance.getTaskType());
taskProcessor.nt(taskInstance, processInstance);
f (taskInstance.getState() == ExecutonStatus.RUNNING_EXECUTION && taskProcessor.getType().equalsIgnoreCase(Constants.COMMON_TASK_TYPE)) {
notfyProcessHostUpdate(taskInstance);
}
boolean submt = taskProcessor.acton(TaskActon.SUBMIT);
f (!submt) {
logger.error("process d:{} name:{} submt standby task d:{} name:{} faled!",
processInstance.getId(),
processInstance.getName(),
taskInstance.getId(),
taskInstance.getName());
return Optonal.empty();
}
f (valdTaskMap.contansKey(taskInstance.getTaskCode())) {
nt oldTaskInstanceId = valdTaskMap.get(taskInstance.getTaskCode());
f (taskInstance.getId() != oldTaskInstanceId) {
TaskInstance oldTaskInstance = taskInstanceMap.get(oldTaskInstanceId);
oldTaskInstance.setFlag(Flag.NO); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | processServce.updateTaskInstance(oldTaskInstance);
valdTaskMap.remove(taskInstance.getTaskCode());
actveTaskProcessorMaps.remove(taskInstance.getTaskCode());
}
}
valdTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId());
taskInstanceMap.put(taskInstance.getId(), taskInstance);
actveTaskProcessorMaps.put(taskInstance.getTaskCode(), taskProcessor);
boolean dspatchSuccess = taskProcessor.acton(TaskActon.DISPATCH);
f (!dspatchSuccess) {
logger.error("process d:{} name:{} dspatch standby task d:{} name:{} faled!",
processInstance.getId(),
processInstance.getName(),
taskInstance.getId(),
taskInstance.getName());
return Optonal.empty();
}
taskProcessor.acton(TaskActon.RUN);
stateWheelExecuteThread.addTask4TmeoutCheck(processInstance, taskInstance);
stateWheelExecuteThread.addTask4StateCheck(processInstance, taskInstance);
f (taskProcessor.taskInstance().getState().typeIsFnshed()) {
f (processInstance.sBlocked()) {
StateEvent processBlockEvent = new StateEvent();
processBlockEvent.setProcessInstanceId(ths.processInstance.getId());
processBlockEvent.setTaskInstanceId(taskInstance.getId());
processBlockEvent.setExecutonStatus(taskProcessor.taskInstance().getState());
processBlockEvent.setType(StateEventType.PROCESS_BLOCKED);
ths.stateEvents.add(processBlockEvent);
}
StateEvent taskStateChangeEvent = new StateEvent(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | taskStateChangeEvent.setProcessInstanceId(ths.processInstance.getId());
taskStateChangeEvent.setTaskInstanceId(taskInstance.getId());
taskStateChangeEvent.setExecutonStatus(taskProcessor.taskInstance().getState());
taskStateChangeEvent.setType(StateEventType.TASK_STATE_CHANGE);
ths.stateEvents.add(taskStateChangeEvent);
}
return Optonal.of(taskInstance);
} catch (Excepton e) {
logger.error("submt standby task error, taskCode: {}, taskInstanceId: {}",
taskInstance.getTaskCode(),
taskInstance.getId(),
e);
return Optonal.empty();
}
}
prvate vod notfyProcessHostUpdate(TaskInstance taskInstance) {
f (StrngUtls.sEmpty(taskInstance.getHost())) {
return;
}
try {
HostUpdateCommand hostUpdateCommand = new HostUpdateCommand();
hostUpdateCommand.setProcessHost(masterAddress);
hostUpdateCommand.setTaskInstanceId(taskInstance.getId());
Host host = new Host(taskInstance.getHost());
nettyExecutorManager.doExecute(host, hostUpdateCommand.convert2Command());
} catch (Excepton e) {
logger.error("notfy process host update", e);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | /**
* fnd task nstance n db.
* n case submt more than one same name task n the same tme.
*
* @param taskCode task code
* @param taskVerson task verson
* @return TaskInstance
*/
prvate TaskInstance fndTaskIfExsts(Long taskCode, nt taskVerson) {
Lst<TaskInstance> valdTaskInstanceLst = getValdTaskLst();
for (TaskInstance taskInstance : valdTaskInstanceLst) {
f (taskInstance.getTaskCode() == taskCode && taskInstance.getTaskDefntonVerson() == taskVerson) {
return taskInstance;
}
}
return null;
}
/**
* encapsulaton task, ths method wll only create a new task nstance, the return task nstance wll not contan d.
*
* @param processInstance process nstance
* @param taskNode taskNode
* @return TaskInstance
*/
prvate TaskInstance createTaskInstance(ProcessInstance processInstance, TaskNode taskNode) {
TaskInstance taskInstance = fndTaskIfExsts(taskNode.getCode(), taskNode.getVerson());
f (taskInstance != null) {
return taskInstance;
}
return newTaskInstance(processInstance, taskNode); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | }
/**
* clone a new taskInstance for retry and reset some logc felds
*
* @return
*/
publc TaskInstance cloneRetryTaskInstance(TaskInstance taskInstance) {
TaskNode taskNode = dag.getNode(Long.toStrng(taskInstance.getTaskCode()));
f (taskNode == null) {
logger.error("taskNode s null, code:{}", taskInstance.getTaskCode());
return null;
}
TaskInstance newTaskInstance = newTaskInstance(processInstance, taskNode);
newTaskInstance.setTaskDefne(taskInstance.getTaskDefne());
newTaskInstance.setProcessDefne(taskInstance.getProcessDefne());
newTaskInstance.setProcessInstance(processInstance);
newTaskInstance.setRetryTmes(taskInstance.getRetryTmes() + 1);
newTaskInstance.setState(taskInstance.getState());
newTaskInstance.setEndTme(taskInstance.getEndTme());
return newTaskInstance;
}
/**
* clone a new taskInstance for tolerant and reset some logc felds
*
* @return
*/
publc TaskInstance cloneTolerantTaskInstance(TaskInstance taskInstance) {
TaskNode taskNode = dag.getNode(Long.toStrng(taskInstance.getTaskCode()));
f (taskNode == null) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | logger.error("taskNode s null, code:{}", taskInstance.getTaskCode());
return null;
}
TaskInstance newTaskInstance = newTaskInstance(processInstance, taskNode);
newTaskInstance.setTaskDefne(taskInstance.getTaskDefne());
newTaskInstance.setProcessDefne(taskInstance.getProcessDefne());
newTaskInstance.setProcessInstance(processInstance);
newTaskInstance.setRetryTmes(taskInstance.getRetryTmes());
newTaskInstance.setState(taskInstance.getState());
return newTaskInstance;
}
/**
* new a taskInstance
*
* @param processInstance
* @param taskNode
* @return
*/
publc TaskInstance newTaskInstance(ProcessInstance processInstance, TaskNode taskNode) {
TaskInstance taskInstance = new TaskInstance();
taskInstance.setTaskCode(taskNode.getCode());
taskInstance.setTaskDefntonVerson(taskNode.getVerson());
taskInstance.setName(taskNode.getName());
taskInstance.setState(ExecutonStatus.SUBMITTED_SUCCESS);
taskInstance.setProcessInstanceId(processInstance.getId());
taskInstance.setTaskType(taskNode.getType().toUpperCase()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | taskInstance.setAlertFlag(Flag.NO);
taskInstance.setStartTme(null);
taskInstance.setFlag(Flag.YES);
taskInstance.setDryRun(processInstance.getDryRun());
taskInstance.setRetryTmes(0);
taskInstance.setMaxRetryTmes(taskNode.getMaxRetryTmes());
taskInstance.setRetryInterval(taskNode.getRetryInterval());
taskInstance.setTaskParams(taskNode.getTaskParams());
taskInstance.setTaskGroupId(taskNode.getTaskGroupId());
taskInstance.setTaskGroupProrty(taskNode.getTaskGroupProrty());
taskInstance.setCpuQuota(taskNode.getCpuQuota());
taskInstance.setMemoryMax(taskNode.getMemoryMax());
f (taskNode.getTaskInstanceProrty() == null) {
taskInstance.setTaskInstanceProrty(Prorty.MEDIUM);
} else {
taskInstance.setTaskInstanceProrty(taskNode.getTaskInstanceProrty());
}
Strng processWorkerGroup = processInstance.getWorkerGroup();
processWorkerGroup = StrngUtls.sBlank(processWorkerGroup) ? DEFAULT_WORKER_GROUP : processWorkerGroup; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | Strng taskWorkerGroup = StrngUtls.sBlank(taskNode.getWorkerGroup()) ? processWorkerGroup : taskNode.getWorkerGroup();
Long processEnvronmentCode = Objects.sNull(processInstance.getEnvronmentCode()) ? -1 : processInstance.getEnvronmentCode();
Long taskEnvronmentCode = Objects.sNull(taskNode.getEnvronmentCode()) ? processEnvronmentCode : taskNode.getEnvronmentCode();
f (!processWorkerGroup.equals(DEFAULT_WORKER_GROUP) && taskWorkerGroup.equals(DEFAULT_WORKER_GROUP)) {
taskInstance.setWorkerGroup(processWorkerGroup);
taskInstance.setEnvronmentCode(processEnvronmentCode);
} else {
taskInstance.setWorkerGroup(taskWorkerGroup);
taskInstance.setEnvronmentCode(taskEnvronmentCode);
}
f (!taskInstance.getEnvronmentCode().equals(-1L)) {
Envronment envronment = processServce.fndEnvronmentByCode(taskInstance.getEnvronmentCode());
f (Objects.nonNull(envronment) && StrngUtls.sNotEmpty(envronment.getConfg())) {
taskInstance.setEnvronmentConfg(envronment.getConfg());
}
}
taskInstance.setDelayTme(taskNode.getDelayTme());
return taskInstance;
}
publc vod getPreVarPool(TaskInstance taskInstance, Set<Strng> preTask) {
Map<Strng, Property> allProperty = new HashMap<>();
Map<Strng, TaskInstance> allTaskInstance = new HashMap<>();
f (CollectonUtls.sNotEmpty(preTask)) {
for (Strng preTaskCode : preTask) {
Integer taskId = completeTaskMap.get(Long.parseLong(preTaskCode));
f (taskId == null) {
contnue;
}
TaskInstance preTaskInstance = taskInstanceMap.get(taskId); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | f (preTaskInstance == null) {
contnue;
}
Strng preVarPool = preTaskInstance.getVarPool();
f (StrngUtls.sNotEmpty(preVarPool)) {
Lst<Property> propertes = JSONUtls.toLst(preVarPool, Property.class);
for (Property nfo : propertes) {
setVarPoolValue(allProperty, allTaskInstance, preTaskInstance, nfo);
}
}
}
f (allProperty.sze() > 0) {
taskInstance.setVarPool(JSONUtls.toJsonStrng(allProperty.values()));
}
} else {
f (StrngUtls.sNotEmpty(processInstance.getVarPool())) {
taskInstance.setVarPool(processInstance.getVarPool());
}
}
}
publc Collecton<TaskInstance> getAllTaskInstances() {
return taskInstanceMap.values();
}
prvate vod setVarPoolValue(Map<Strng, Property> allProperty, Map<Strng, TaskInstance> allTaskInstance, TaskInstance preTaskInstance, Property thsProperty) {
thsProperty.setDrect(Drect.IN);
Strng proName = thsProperty.getProp();
f (allProperty.contansKey(proName)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | Property otherPro = allProperty.get(proName);
f (StrngUtls.sEmpty(thsProperty.getValue())) {
allProperty.put(proName, otherPro);
} else f (StrngUtls.sNotEmpty(otherPro.getValue())) {
TaskInstance otherTask = allTaskInstance.get(proName);
f (otherTask.getEndTme().getTme() > preTaskInstance.getEndTme().getTme()) {
allProperty.put(proName, thsProperty);
allTaskInstance.put(proName, preTaskInstance);
} else {
allProperty.put(proName, otherPro);
}
} else {
allProperty.put(proName, thsProperty);
allTaskInstance.put(proName, preTaskInstance);
}
} else {
allProperty.put(proName, thsProperty);
allTaskInstance.put(proName, preTaskInstance);
}
}
/**
* get complete task nstance map, taskCode as key
*/
prvate Map<Strng, TaskInstance> getCompleteTaskInstanceMap() {
Map<Strng, TaskInstance> completeTaskInstanceMap = new HashMap<>();
for (Map.Entry<Long, Integer> entry : completeTaskMap.entrySet()) {
Long taskConde = entry.getKey(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | Integer taskInstanceId = entry.getValue();
TaskInstance taskInstance = taskInstanceMap.get(taskInstanceId);
f (taskInstance == null) {
logger.warn("Cannot fnd the taskInstance from taskInstanceMap, taskInstanceId: {}, taskConde: {}",
taskInstanceId,
taskConde);
contnue;
}
completeTaskInstanceMap.put(Long.toStrng(taskInstance.getTaskCode()), taskInstance);
}
return completeTaskInstanceMap;
}
/**
* get vald task lst
*/
prvate Lst<TaskInstance> getValdTaskLst() {
Lst<TaskInstance> valdTaskInstanceLst = new ArrayLst<>();
for (Integer taskInstanceId : valdTaskMap.values()) {
valdTaskInstanceLst.add(taskInstanceMap.get(taskInstanceId));
}
return valdTaskInstanceLst;
}
prvate vod submtPostNode(Strng parentNodeCode) throws StateEventHandleExcepton {
Set<Strng> submtTaskNodeLst =
DagHelper.parsePostNodes(parentNodeCode, skpTaskNodeMap, dag, getCompleteTaskInstanceMap());
Lst<TaskInstance> taskInstances = new ArrayLst<>();
for (Strng taskNode : submtTaskNodeLst) {
TaskNode taskNodeObject = dag.getNode(taskNode);
Optonal<TaskInstance> exstTaskInstanceOptonal = getTaskInstance(taskNodeObject.getCode()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | f (exstTaskInstanceOptonal.sPresent()) {
taskInstances.add(exstTaskInstanceOptonal.get());
contnue;
}
TaskInstance task = createTaskInstance(processInstance, taskNodeObject);
taskInstances.add(task);
}
f (StrngUtls.sNotEmpty(parentNodeCode) && dag.getEndNode().contans(parentNodeCode)) {
TaskInstance endTaskInstance = taskInstanceMap.get(completeTaskMap.get(NumberUtls.toLong(parentNodeCode)));
Strng taskInstanceVarPool = endTaskInstance.getVarPool();
f (StrngUtls.sNotEmpty(taskInstanceVarPool)) {
Set<Property> taskPropertes = new HashSet<>(JSONUtls.toLst(taskInstanceVarPool, Property.class));
Strng processInstanceVarPool = processInstance.getVarPool();
f (StrngUtls.sNotEmpty(processInstanceVarPool)) {
Set<Property> propertes = new HashSet<>(JSONUtls.toLst(processInstanceVarPool, Property.class));
propertes.addAll(taskPropertes);
processInstance.setVarPool(JSONUtls.toJsonStrng(propertes));
} else {
processInstance.setVarPool(JSONUtls.toJsonStrng(taskPropertes));
}
}
}
for (TaskInstance task : taskInstances) {
f (readyToSubmtTaskQueue.contans(task)) {
logger.warn("Task s already at submt queue, taskInstanceId: {}", task.getId());
contnue;
}
f (task.getId() > 0 && completeTaskMap.contansKey(task.getTaskCode())) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 11,225 | [Feature][Alert] Add close alert method | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Right now, we can set the alert when workflow executes failure.
In some cases, if the alert plugin is a third party service like [pagerduty](https://www.pagerduty.com), when we send an alert we will call the service to send an alert, and it may send 5 minutes unless we close the alert(We can close the alert by manual too).
But we may hope when the workflow success, the before alert can close automatically, so this issue is want to discuss add a new method closeAlert in alert plugin, we will provide a default method, the default method will do nothing, you can override this.
When the workflow execute success we will check if there exist a alert, and insert a close alert event, the AlertServer side will consume the event and execute the closeMethod.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/11225 | https://github.com/apache/dolphinscheduler/pull/11221 | 01fc6c8a3a3aa68a45879ec5130250c99492a86b | 8e21c38c0041aa2689eb9d9bc703f67292c98e88 | 2022-08-01T03:59:56Z | java | 2022-08-01T05:04:27Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | logger.nfo("task {} has already run success", task.getName());
contnue;
}
f (task.getState().typeIsPause() || task.getState().typeIsCancel()) {
logger.nfo("task {} stopped, the state s {}", task.getName(), task.getState());
contnue;
}
addTaskToStandByLst(task);
}
submtStandByTask();
updateProcessInstanceState();
}
/**
* determne whether the dependences of the task node are complete
*
* @return DependResult
*/
prvate DependResult sTaskDepsComplete(Strng taskCode) {
Collecton<Strng> startNodes = dag.getBegnNode();
f (startNodes.contans(taskCode)) {
return DependResult.SUCCESS;
}
TaskNode taskNode = dag.getNode(taskCode);
Lst<Strng> ndrectDepCodeLst = new ArrayLst<>();
setIndrectDepLst(taskCode, ndrectDepCodeLst);
for (Strng depsNode : ndrectDepCodeLst) {
f (dag.contansNode(depsNode) && !skpTaskNodeMap.contansKey(depsNode)) {
Long despNodeTaskCode = Long.parseLong(depsNode); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.