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
unknown | language
stringclasses 5
values | commit_datetime
unknown | updated_file
stringlengths 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | if (StringUtils.isNotEmpty(phone) && !CheckUtils.checkPhone(phone)) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, phone);
return result;
}
user.setPhone(phone);
user.setQueue(queue);
user.setState(state);
Date now = new Date();
user.setUpdateTime(now);
if (user.getTenantId() != tenantId) {
Tenant oldTenant = tenantMapper.queryById(user.getTenantId());
Tenant newTenant = tenantMapper.queryById(tenantId);
if (newTenant != null) {
if (PropertyUtils.getResUploadStartupState() && oldTenant != null) {
String newTenantCode = newTenant.getTenantCode();
String oldResourcePath = HadoopUtils.getHdfsResDir(oldTenant.getTenantCode());
String oldUdfsPath = HadoopUtils.getHdfsUdfDir(oldTenant.getTenantCode());
if (HadoopUtils.getInstance().exists(oldResourcePath)) {
String newResourcePath = HadoopUtils.getHdfsResDir(newTenantCode);
String newUdfsPath = HadoopUtils.getHdfsUdfDir(newTenantCode);
List<Resource> fileResourcesList = resourceMapper.queryResourceList(
null, userId, ResourceType.FILE.ordinal());
if (CollectionUtils.isNotEmpty(fileResourcesList)) {
ResourceTreeVisitor resourceTreeVisitor = new ResourceTreeVisitor(fileResourcesList);
ResourceComponent resourceComponent = resourceTreeVisitor.visit(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | copyResourceFiles(resourceComponent, oldResourcePath, newResourcePath);
}
List<Resource> udfResourceList = resourceMapper.queryResourceList(
null, userId, ResourceType.UDF.ordinal());
if (CollectionUtils.isNotEmpty(udfResourceList)) {
ResourceTreeVisitor resourceTreeVisitor = new ResourceTreeVisitor(udfResourceList);
ResourceComponent resourceComponent = resourceTreeVisitor.visit();
copyResourceFiles(resourceComponent, oldUdfsPath, newUdfsPath);
}
String oldUserPath = HadoopUtils.getHdfsUserDir(oldTenant.getTenantCode(), userId);
HadoopUtils.getInstance().delete(oldUserPath, true);
} else {
createTenantDirIfNotExists(oldTenant.getTenantCode());
}
if (HadoopUtils.getInstance().exists(HadoopUtils.getHdfsTenantDir(newTenant.getTenantCode()))) {
String newUserPath = HadoopUtils.getHdfsUserDir(newTenant.getTenantCode(), user.getId());
HadoopUtils.getInstance().mkdir(newUserPath);
} else {
createTenantDirIfNotExists(newTenant.getTenantCode());
}
}
}
user.setTenantId(tenantId);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | 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(rollbackFor = RuntimeException.class)
public Map<String, Object> deleteUserById(User loginUser, int id) throws IOException {
Map<String, Object> result = new HashMap<>();
if (!isAdmin(loginUser)) {
putMsg(result, Status.USER_NO_OPERATION_PERM, id);
return result;
}
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)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | String projectNames = projects.stream().map(Project::getName).collect(Collectors.joining(","));
putMsg(result, Status.TRANSFORM_PROJECT_OWNERSHIP, projectNames);
return result;
}
User user = userMapper.queryTenantCodeByUserId(id);
if (user != null) {
if (PropertyUtils.getResUploadStartupState()) {
String userPath = HadoopUtils.getHdfsUserDir(user.getTenantCode(), id);
if (HadoopUtils.getInstance().exists(userPath)) {
HadoopUtils.getInstance().delete(userPath, true);
}
}
}
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(rollbackFor = RuntimeException.class)
public Map<String, Object> grantProject(User loginUser, int userId, String projectIds) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | 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 (check(result, !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;
}
if (check(result, StringUtils.isEmpty(projectIds), Status.SUCCESS)) {
projectUserMapper.deleteProjectRelation(0, userId);
return result;
}
String[] projectIdArr = projectIds.split(",");
for (String projectId : projectIdArr) {
Date now = new Date();
ProjectUser projectUser = new ProjectUser();
projectUser.setUserId(userId);
projectUser.setProjectId(Integer.parseInt(projectId));
projectUser.setPerm(7);
projectUser.setCreateTime(now);
projectUser.setUpdateTime(now);
projectUserMapper.insert(projectUser);
}
putMsg(result, Status.SUCCESS);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | 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 projectCodes project code array
* @return grant result code
*/
@Override
public Map<String, Object> grantProjectByCode(final User loginUser, final int userId, final String projectCodes) {
Map<String, Object> result = new HashMap<>();
result.put(Constants.STATUS, false);
if (this.check(result, !this.isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
User tempUser = this.userMapper.selectById(userId);
if (tempUser == null) {
putMsg(result, Status.USER_NOT_EXIST, userId);
return result;
}
if (this.check(result, StringUtils.isEmpty(projectCodes), Status.SUCCESS)) {
this.projectUserMapper.deleteProjectRelation(0, userId);
return result;
}
Set<Long> projectCodeSet = Arrays.stream(projectCodes.split(Constants.COMMA)).map(Long::parseLong).collect(Collectors.toSet()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | final List<Project> projectList = this.projectMapper.queryByCodes(projectCodeSet);
if (CollectionUtils.isEmpty(projectList)) {
logger.info("project not exists");
putMsg(result, Status.PROJECT_NOT_FOUNT, projectCodes);
return result;
}
for (final Project project : projectList) {
final Date today = new Date();
ProjectUser projectUser = new ProjectUser();
projectUser.setUserId(userId);
projectUser.setProjectId(project.getId());
projectUser.setPerm(7);
projectUser.setCreateTime(today);
projectUser.setUpdateTime(today);
this.projectUserMapper.insert(projectUser);
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* grant resource
*
* @param loginUser login user
* @param userId user id
* @param resourceIds resource id array
* @return grant result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> grantResources(User loginUser, int userId, String resourceIds) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | Map<String, Object> result = new HashMap<>();
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
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);
Set<Integer> oldAuthorizedResIds = oldAuthorizedRes.stream().map(Resource::getId).collect(Collectors.toSet());
oldAuthorizedResIds.removeAll(needAuthorizeResIds);
if (CollectionUtils.isNotEmpty(oldAuthorizedResIds)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | 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();
ResourcesUser resourcesUser = new ResourcesUser();
resourcesUser.setUserId(userId);
resourcesUser.setResourcesId(resourceIdValue);
if (resource.isDirectory()) {
resourcesUser.setPerm(Constants.AUTHORIZE_READABLE_PERM); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | } 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(rollbackFor = RuntimeException.class)
public Map<String, Object> grantUDFFunction(User loginUser, int userId, String udfIds) {
Map<String, Object> result = new HashMap<>();
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
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 | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | }
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(7);
udfUser.setCreateTime(now);
udfUser.setUpdateTime(now);
udfUserMapper.insert(udfUser);
}
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(rollbackFor = RuntimeException.class)
public Map<String, Object> grantDataSource(User loginUser, int userId, String datasourceIds) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | 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 (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
User user = userMapper.selectById(userId);
if (user == null) {
putMsg(result, Status.USER_NOT_EXIST, userId);
return result;
}
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(7);
datasourceUser.setCreateTime(now);
datasourceUser.setUpdateTime(now);
datasourceUserMapper.insert(datasourceUser);
}
putMsg(result, Status.SUCCESS);
return result;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | * query user info
*
* @param loginUser login user
* @return user info
*/
@Override
public Map<String, Object> getUserInfo(User loginUser) {
Map<String, Object> result = new HashMap<>();
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() + ",");
}
sb.append(alertGroups.get(alertGroups.size() - 1));
user.setAlertGroup(sb.toString());
}
}
result.put(Constants.DATA_LIST, user);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query user list
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | * @param loginUser login user
* @return user list
*/
@Override
public Map<String, Object> queryAllGeneralUsers(User loginUser) {
Map<String, Object> result = new HashMap<>();
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 (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
return result;
}
List<User> userList = userMapper.selectList(null);
result.put(Constants.DATA_LIST, userList); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | 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
*
* @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<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | 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);
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) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | Map<String, Object> result = new HashMap<>();
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) {
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; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | }
return msg;
}
/**
* copy resource files
*
* @param resourceComponent resource component
* @param srcBasePath src base path
* @param dstBasePath dst base path
* @throws IOException io exception
*/
private void copyResourceFiles(ResourceComponent resourceComponent, String srcBasePath, String dstBasePath) throws IOException {
List<ResourceComponent> components = resourceComponent.getChildren();
if (CollectionUtils.isNotEmpty(components)) {
for (ResourceComponent component : components) {
if (!HadoopUtils.getInstance().exists(String.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()) {
HadoopUtils.getInstance().copy(String.format("%s/%s", srcBasePath, component.getFullName()), String.format("%s/%s", dstBasePath, component.getFullName()), false, true);
continue;
}
if (CollectionUtils.isEmpty(component.getChildren())) {
if (!HadoopUtils.getInstance().exists(String.format("%s/%s", dstBasePath, component.getFullName()))) {
HadoopUtils.getInstance().mkdir(String.format("%s/%s", dstBasePath, component.getFullName()));
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | } else {
copyResourceFiles(component, srcBasePath, dstBasePath);
}
}
}
}
/**
* registry user, default state is 0, default tenant_id is 1, no phone, no queue
*
* @param userName user name
* @param userPassword user password
* @param repeatPassword repeat password
* @param email email
* @return registry result code
* @throws Exception exception
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
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 (!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;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | User user = createUser(userName, userPassword, email, 1, "", "", Flag.NO.ordinal());
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, user);
return result;
}
/**
* 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 (!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()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, userName);
return result;
}
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 (!isAdmin(loginUser)) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
int totalSuccess = 0;
List<String> successUserNames = new ArrayList<>();
Map<String, Object> successRes = new HashMap<>();
int totalFailed = 0; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java | 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 | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/UsersControllerTest.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.api.controller;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/UsersControllerTest.java | import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
/**
* users controller test
*/
public class UsersControllerTest extends AbstractControllerTest {
private static final Logger logger = LoggerFactory.getLogger(UsersControllerTest.class);
@Test
public void testCreateUser() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("userName", "user_test");
paramsMap.add("userPassword", "123456qwe?");
paramsMap.add("tenantId", "109");
paramsMap.add("queue", "1");
paramsMap.add("email", "[email protected]");
paramsMap.add("phone", "15800000000");
MvcResult mvcResult = mockMvc.perform(post("/users/create")
.header(SESSION_ID, sessionId)
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.CREATE_USER_ERROR.getCode(), result.getCode().intValue()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/UsersControllerTest.java | logger.info(mvcResult.getResponse().getContentAsString());
}
@Test
public void testUpdateUser() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("id", "32");
paramsMap.add("userName", "user_test");
paramsMap.add("userPassword", "123456qwe?");
paramsMap.add("tenantId", "9");
paramsMap.add("queue", "1");
paramsMap.add("email", "[email protected]");
paramsMap.add("phone", "15800000000");
MvcResult mvcResult = mockMvc.perform(post("/users/update")
.header(SESSION_ID, sessionId)
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.UPDATE_USER_ERROR.getCode(), result.getCode().intValue());
}
@Test
public void testGrantProject() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("userId", "32");
paramsMap.add("projectIds", "3");
MvcResult mvcResult = mockMvc.perform(post("/users/grant-project")
.header(SESSION_ID, sessionId)
.params(paramsMap))
.andExpect(status().isOk()) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/UsersControllerTest.java | .andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.USER_NOT_EXIST.getCode(), result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
@Test
public void testGrantProjectByCode() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("userId", "32");
paramsMap.add("projectCodes", "3682329499136,3643998558592");
MvcResult mvcResult = mockMvc.perform(post("/users/grant-project-by-code")
.header(SESSION_ID, sessionId)
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.USER_NOT_EXIST.getCode(), result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
@Test
public void testGrantResource() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("userId", "32");
paramsMap.add("resourceIds", "5");
MvcResult mvcResult = mockMvc.perform(post("/users/grant-file")
.header(SESSION_ID, sessionId)
.params(paramsMap))
.andExpect(status().isOk()) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/UsersControllerTest.java | .andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.USER_NOT_EXIST.getCode(), result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
@Test
public void testGrantUDFFunc() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("userId", "32");
paramsMap.add("udfIds", "5");
MvcResult mvcResult = mockMvc.perform(post("/users/grant-udf-func")
.header(SESSION_ID, sessionId)
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.USER_NOT_EXIST.getCode(), result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
@Test
public void testGrantDataSource() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("userId", "32");
paramsMap.add("datasourceIds", "5");
MvcResult mvcResult = mockMvc.perform(post("/users/grant-datasource")
.header(SESSION_ID, sessionId)
.params(paramsMap))
.andExpect(status().isOk()) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/UsersControllerTest.java | .andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.USER_NOT_EXIST.getCode(), result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
@Test
public void testGetUserInfo() throws Exception {
MvcResult mvcResult = mockMvc.perform(get("/users/get-user-info")
.header(SESSION_ID, sessionId))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
@Test
public void testListAll() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("userName", "test");
MvcResult mvcResult = mockMvc.perform(get("/users/list-all")
.header(SESSION_ID, sessionId)
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/UsersControllerTest.java | }
@Ignore
@Test
public void testAuthorizedUser() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("alertgroupId", "1");
MvcResult mvcResult = mockMvc.perform(get("/users/authed-user")
.header(SESSION_ID, sessionId)
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
@Ignore
@Test
public void testUnauthorizedUser() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("alertgroupId", "1");
MvcResult mvcResult = mockMvc.perform(get("/users/unauth-user")
.header(SESSION_ID, sessionId)
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/UsersControllerTest.java | Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
@Test
public void testVerifyUserName() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("userName", "hello");
MvcResult mvcResult = mockMvc.perform(get("/users/verify-user-name")
.header(SESSION_ID, sessionId)
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
@Test
public void testDelUserById() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("id", "32");
MvcResult mvcResult = mockMvc.perform(post("/users/delete")
.header(SESSION_ID, sessionId)
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.USER_NOT_EXIST.getCode(), result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/UsersControllerTest.java | }
@Test
public void testQueryList() throws Exception {
MvcResult mvcResult = mockMvc.perform(get("/users/list")
.header(SESSION_ID, sessionId))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue());
logger.info(mvcResult.getResponse().getContentAsString());
}
@Test
public void testRegisterUser() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("userName", "user_test");
paramsMap.add("userPassword", "123456qwe?");
paramsMap.add("repeatPassword", "123456qwe?");
paramsMap.add("email", "[email protected]");
MvcResult mvcResult = mockMvc.perform(post("/users/register")
.header(SESSION_ID, sessionId)
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue());
}
@Test
@Ignore |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/UsersControllerTest.java | public void testActivateUser() throws Exception {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("userName", "user_test");
MvcResult mvcResult = mockMvc.perform(post("/users/activate")
.header(SESSION_ID, sessionId)
.params(paramsMap))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue());
}
@Test
public void testBatchActivateUser() throws Exception {
List<String> userNames = new ArrayList<>();
userNames.add("user_sky_cxl");
userNames.add("19990323");
userNames.add("test_sky_post_11");
String jsonUserNames = JSONUtils.toJsonString(userNames);
MvcResult mvcResult = mockMvc.perform(post("/users/batch/activate")
.header(SESSION_ID, sessionId)
.contentType(MediaType.APPLICATION_JSON)
.content(jsonUserNames))
.andExpect(status().isOk())
.andReturn();
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.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.api.service;
import static org.mockito.ArgumentMatchers.any; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.service.impl.UsersServiceImpl;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.common.utils.EncryptionUtils;
import org.apache.dolphinscheduler.dao.entity.AlertGroup;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.Resource;
import org.apache.dolphinscheduler.dao.entity.Tenant;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.AccessTokenMapper;
import org.apache.dolphinscheduler.dao.mapper.AlertGroupMapper;
import org.apache.dolphinscheduler.dao.mapper.DataSourceUserMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectUserMapper;
import org.apache.dolphinscheduler.dao.mapper.ResourceMapper;
import org.apache.dolphinscheduler.dao.mapper.ResourceUserMapper;
import org.apache.dolphinscheduler.dao.mapper.TenantMapper;
import org.apache.dolphinscheduler.dao.mapper.UDFUserMapper;
import org.apache.dolphinscheduler.dao.mapper.UserMapper;
import org.apache.dolphinscheduler.spi.enums.ResourceType;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.junit.After; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
/**
* users service test
*/
@RunWith(MockitoJUnitRunner.class)
public class UsersServiceTest {
private static final Logger logger = LoggerFactory.getLogger(UsersServiceTest.class);
@InjectMocks
private UsersServiceImpl usersService;
@Mock
private UserMapper userMapper;
@Mock
private AccessTokenMapper accessTokenMapper;
@Mock
private TenantMapper tenantMapper;
@Mock
private ResourceMapper resourceMapper;
@Mock |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | private AlertGroupMapper alertGroupMapper;
@Mock
private DataSourceUserMapper datasourceUserMapper;
@Mock
private ProjectUserMapper projectUserMapper;
@Mock
private ResourceUserMapper resourceUserMapper;
@Mock
private UDFUserMapper udfUserMapper;
@Mock
private ProjectMapper projectMapper;
private String queueName = "UsersServiceTestQueue";
@Before
public void before() {
}
@After
public void after() {
}
@Test
public void testCreateUserForLdap() {
String userName = "user1";
String email = "[email protected]";
User user = usersService.createUser(UserType.ADMIN_USER, userName, email);
Assert.assertNotNull(user);
}
@Test
public void testCreateUser() {
User user = new User();
user.setUserType(UserType.ADMIN_USER);
String userName = "userTest0001~"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | String userPassword = "userTest";
String email = "[email protected]";
int tenantId = Integer.MAX_VALUE;
String phone = "13456432345";
int state = 1;
try {
Map<String, Object> result = usersService.createUser(user, userName, userPassword, email, tenantId, phone, queueName, state);
logger.info(result.toString());
Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, result.get(Constants.STATUS));
userName = "userTest0001";
userPassword = "userTest000111111111111111";
result = usersService.createUser(user, userName, userPassword, email, tenantId, phone, queueName, state);
logger.info(result.toString());
Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, result.get(Constants.STATUS));
userPassword = "userTest0001";
email = "1q.com";
result = usersService.createUser(user, userName, userPassword, email, tenantId, phone, queueName, state);
logger.info(result.toString());
Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, result.get(Constants.STATUS));
email = "[email protected]";
phone = "2233";
result = usersService.createUser(user, userName, userPassword, email, tenantId, phone, queueName, state);
logger.info(result.toString());
Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, result.get(Constants.STATUS));
phone = "13456432345"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | result = usersService.createUser(user, userName, userPassword, email, tenantId, phone, queueName, state);
logger.info(result.toString());
Assert.assertEquals(Status.TENANT_NOT_EXIST, result.get(Constants.STATUS));
Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant());
result = usersService.createUser(user, userName, userPassword, email, 1, phone, queueName, state);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
} catch (Exception e) {
logger.error(Status.CREATE_USER_ERROR.getMsg(), e);
Assert.assertTrue(false);
}
}
@Test
public void testQueryUser() {
String userName = "userTest0001";
String userPassword = "userTest0001";
when(userMapper.queryUserByNamePassword(userName, EncryptionUtils.getMd5(userPassword))).thenReturn(getGeneralUser());
User queryUser = usersService.queryUser(userName, userPassword);
logger.info(queryUser.toString());
Assert.assertTrue(queryUser != null);
}
@Test
public void testSelectByIds() {
List<Integer> ids = new ArrayList<>();
List<User> users = usersService.queryUser(ids);
Assert.assertTrue(users.isEmpty());
ids.add(1);
List<User> userList = new ArrayList<>();
userList.add(new User()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | when(userMapper.selectByIds(ids)).thenReturn(userList);
List<User> userList1 = usersService.queryUser(ids);
Assert.assertFalse(userList1.isEmpty());
}
@Test
public void testGetUserIdByName() {
User user = new User();
user.setId(1);
user.setUserType(UserType.ADMIN_USER);
user.setUserName("test_user");
int userId = usersService.getUserIdByName("");
Assert.assertEquals(0, userId);
when(usersService.queryUser(user.getUserName())).thenReturn(null);
int userNotExistId = usersService.getUserIdByName(user.getUserName());
Assert.assertEquals(-1, userNotExistId);
when(usersService.queryUser(user.getUserName())).thenReturn(user);
int userExistId = usersService.getUserIdByName(user.getUserName());
Assert.assertEquals(user.getId(), userExistId);
}
@Test
public void testQueryUserList() {
User user = new User();
Map<String, Object> result = usersService.queryUserList(user);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | user.setUserType(UserType.ADMIN_USER);
when(userMapper.selectList(null)).thenReturn(getUserList());
result = usersService.queryUserList(user);
List<User> userList = (List<User>) result.get(Constants.DATA_LIST);
Assert.assertTrue(userList.size() > 0);
}
@Test
public void testQueryUserListPage() {
User user = new User();
IPage<User> page = new Page<>(1, 10);
page.setRecords(getUserList());
when(userMapper.queryUserPaging(any(Page.class), eq("userTest"))).thenReturn(page);
Result result = usersService.queryUserList(user, "userTest", 1, 10);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NO_OPERATION_PERM.getCode(), (int) result.getCode());
user.setUserType(UserType.ADMIN_USER);
result = usersService.queryUserList(user, "userTest", 1, 10);
Assert.assertEquals(Status.SUCCESS.getCode(), (int) result.getCode());
PageInfo<User> pageInfo = (PageInfo<User>) result.getData();
Assert.assertTrue(pageInfo.getTotalList().size() > 0);
}
@Test
public void testUpdateUser() {
String userName = "userTest0001";
String userPassword = "userTest0001";
try {
Map<String, Object> result = usersService.updateUser(getLoginUser(), 0, userName, userPassword, "[email protected]", 1, "13457864543", "queue", 1); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | Assert.assertEquals(Status.USER_NOT_EXIST, result.get(Constants.STATUS));
logger.info(result.toString());
when(userMapper.selectById(1)).thenReturn(getUser());
result = usersService.updateUser(getLoginUser(), 1, userName, userPassword, "[email protected]", 1, "13457864543", "queue", 1);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
} catch (Exception e) {
logger.error("update user error", e);
Assert.assertTrue(false);
}
}
@Test
public void testDeleteUserById() {
User loginUser = new User();
try {
when(userMapper.queryTenantCodeByUserId(1)).thenReturn(getUser());
when(userMapper.selectById(1)).thenReturn(getUser());
when(accessTokenMapper.deleteAccessTokenByUserId(1)).thenReturn(0);
Map<String, Object> result = usersService.deleteUserById(loginUser, 3);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
loginUser.setUserType(UserType.ADMIN_USER);
result = usersService.deleteUserById(loginUser, 3);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NOT_EXIST, result.get(Constants.STATUS));
Mockito.when(projectMapper.queryProjectCreatedByUser(1)).thenReturn(Lists.newArrayList(new Project())); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | result = usersService.deleteUserById(loginUser, 1);
Assert.assertEquals(Status.TRANSFORM_PROJECT_OWNERSHIP, result.get(Constants.STATUS));
Mockito.when(projectMapper.queryProjectCreatedByUser(1)).thenReturn(null);
result = usersService.deleteUserById(loginUser, 1);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
} catch (Exception e) {
logger.error("delete user error", e);
Assert.assertTrue(false);
}
}
@Test
public void testGrantProject() {
when(userMapper.selectById(1)).thenReturn(getUser());
User loginUser = new User();
String projectIds = "100000,120000";
Map<String, Object> result = usersService.grantProject(loginUser, 1, projectIds);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
loginUser.setUserType(UserType.ADMIN_USER);
result = usersService.grantProject(loginUser, 2, projectIds);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NOT_EXIST, result.get(Constants.STATUS));
result = usersService.grantProject(loginUser, 1, projectIds);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | @Test
public void testGrantProjectByCode() {
when(userMapper.selectById(1)).thenReturn(getUser());
User loginUser = new User();
String projectCodes = "3682329499136,3643998558592";
Map<String, Object> result = this.usersService.grantProjectByCode(loginUser, 1, projectCodes);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
loginUser.setUserType(UserType.ADMIN_USER);
result = this.usersService.grantProjectByCode(loginUser, 2, projectCodes);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NOT_EXIST, result.get(Constants.STATUS));
Mockito.when(this.projectMapper.queryByCodes(Mockito.anyCollection())).thenReturn(Lists.newArrayList(new Project()));
result = this.usersService.grantProjectByCode(loginUser, 1, projectCodes);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
}
@Test
public void testGrantResources() {
String resourceIds = "100000,120000";
when(userMapper.selectById(1)).thenReturn(getUser());
User loginUser = new User();
Map<String, Object> result = usersService.grantResources(loginUser, 1, resourceIds);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
loginUser.setUserType(UserType.ADMIN_USER); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | result = usersService.grantResources(loginUser, 2, resourceIds);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NOT_EXIST, result.get(Constants.STATUS));
when(resourceMapper.selectById(Mockito.anyInt())).thenReturn(getResource());
when(resourceUserMapper.deleteResourceUser(1, 0)).thenReturn(1);
result = usersService.grantResources(loginUser, 1, resourceIds);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
}
@Test
public void testGrantUDFFunction() {
String udfIds = "100000,120000";
when(userMapper.selectById(1)).thenReturn(getUser());
User loginUser = new User();
Map<String, Object> result = usersService.grantUDFFunction(loginUser, 1, udfIds);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
loginUser.setUserType(UserType.ADMIN_USER);
result = usersService.grantUDFFunction(loginUser, 2, udfIds);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NOT_EXIST, result.get(Constants.STATUS));
when(udfUserMapper.deleteByUserId(1)).thenReturn(1);
result = usersService.grantUDFFunction(loginUser, 1, udfIds);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
}
@Test |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | public void testGrantDataSource() {
String datasourceIds = "100000,120000";
when(userMapper.selectById(1)).thenReturn(getUser());
User loginUser = new User();
Map<String, Object> result = usersService.grantDataSource(loginUser, 1, datasourceIds);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
loginUser.setUserType(UserType.ADMIN_USER);
result = usersService.grantDataSource(loginUser, 2, datasourceIds);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NOT_EXIST, result.get(Constants.STATUS));
when(datasourceUserMapper.deleteByUserId(Mockito.anyInt())).thenReturn(1);
result = usersService.grantDataSource(loginUser, 1, datasourceIds);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
}
private User getLoginUser() {
User loginUser = new User();
loginUser.setId(1);
loginUser.setUserType(UserType.ADMIN_USER);
return loginUser;
}
@Test
public void getUserInfo() {
User loginUser = new User();
loginUser.setUserName("admin");
loginUser.setUserType(UserType.ADMIN_USER); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | Map<String, Object> result = usersService.getUserInfo(loginUser);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
User tempUser = (User) result.get(Constants.DATA_LIST);
Assert.assertEquals("admin", tempUser.getUserName());
loginUser.setUserType(null);
loginUser.setId(1);
when(userMapper.queryDetailsById(1)).thenReturn(getGeneralUser());
when(alertGroupMapper.queryByUserId(1)).thenReturn(getAlertGroups());
result = usersService.getUserInfo(loginUser);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
tempUser = (User) result.get(Constants.DATA_LIST);
Assert.assertEquals("userTest0001", tempUser.getUserName());
}
@Test
public void testQueryAllGeneralUsers() {
User loginUser = new User();
Map<String, Object> result = usersService.queryAllGeneralUsers(loginUser);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
loginUser.setUserType(UserType.ADMIN_USER);
when(userMapper.queryAllGeneralUser()).thenReturn(getUserList());
result = usersService.queryAllGeneralUsers(loginUser);
logger.info(result.toString()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
List<User> userList = (List<User>) result.get(Constants.DATA_LIST);
Assert.assertTrue(CollectionUtils.isNotEmpty(userList));
}
@Test
public void testVerifyUserName() {
Result result = usersService.verifyUserName("admin89899");
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS.getMsg(), result.getMsg());
when(userMapper.queryByUserNameAccurately("userTest0001")).thenReturn(getUser());
result = usersService.verifyUserName("userTest0001");
logger.info(result.toString());
Assert.assertEquals(Status.USER_NAME_EXIST.getMsg(), result.getMsg());
}
@Test
public void testUnauthorizedUser() {
User loginUser = new User();
when(userMapper.selectList(null)).thenReturn(getUserList());
when(userMapper.queryUserListByAlertGroupId(2)).thenReturn(getUserList());
Map<String, Object> result = usersService.unauthorizedUser(loginUser, 2);
logger.info(result.toString());
loginUser.setUserType(UserType.ADMIN_USER);
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
result = usersService.unauthorizedUser(loginUser, 2);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | }
@Test
public void testAuthorizedUser() {
User loginUser = new User();
when(userMapper.queryUserListByAlertGroupId(2)).thenReturn(getUserList());
Map<String, Object> result = usersService.authorizedUser(loginUser, 2);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
loginUser.setUserType(UserType.ADMIN_USER);
result = usersService.authorizedUser(loginUser, 2);
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
List<User> userList = (List<User>) result.get(Constants.DATA_LIST);
logger.info(result.toString());
Assert.assertTrue(CollectionUtils.isNotEmpty(userList));
}
@Test
public void testRegisterUser() {
String userName = "userTest0002~";
String userPassword = "userTest";
String repeatPassword = "userTest";
String email = "[email protected]";
try {
Map<String, Object> result = usersService.registerUser(userName, userPassword, repeatPassword, email);
Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, result.get(Constants.STATUS));
userName = "userTest0002";
userPassword = "userTest000111111111111111"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | result = usersService.registerUser(userName, userPassword, repeatPassword, email);
Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, result.get(Constants.STATUS));
userPassword = "userTest0002";
email = "1q.com";
result = usersService.registerUser(userName, userPassword, repeatPassword, email);
Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, result.get(Constants.STATUS));
email = "[email protected]";
repeatPassword = "userPassword";
result = usersService.registerUser(userName, userPassword, repeatPassword, email);
Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, result.get(Constants.STATUS));
repeatPassword = "userTest0002";
result = usersService.registerUser(userName, userPassword, repeatPassword, email);
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
} catch (Exception e) {
Assert.assertTrue(false);
}
}
@Test
public void testActivateUser() {
User user = new User();
user.setUserType(UserType.GENERAL_USER);
String userName = "userTest0002~";
try {
Map<String, Object> result = usersService.activateUser(user, userName);
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | user.setUserType(UserType.ADMIN_USER);
result = usersService.activateUser(user, userName);
Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, result.get(Constants.STATUS));
userName = "userTest10013";
result = usersService.activateUser(user, userName);
Assert.assertEquals(Status.USER_NOT_EXIST, result.get(Constants.STATUS));
userName = "userTest0001";
when(userMapper.queryByUserNameAccurately(userName)).thenReturn(getUser());
result = usersService.activateUser(user, userName);
Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, result.get(Constants.STATUS));
when(userMapper.queryByUserNameAccurately(userName)).thenReturn(getDisabledUser());
result = usersService.activateUser(user, userName);
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
} catch (Exception e) {
Assert.assertTrue(false);
}
}
@Test
public void testBatchActivateUser() {
User user = new User();
user.setUserType(UserType.GENERAL_USER);
List<String> userNames = new ArrayList<>();
userNames.add("userTest0001");
userNames.add("userTest0002");
userNames.add("userTest0003~");
userNames.add("userTest0004");
try { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | Map<String, Object> result = usersService.batchActivateUser(user, userNames);
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
user.setUserType(UserType.ADMIN_USER);
when(userMapper.queryByUserNameAccurately("userTest0001")).thenReturn(getUser());
when(userMapper.queryByUserNameAccurately("userTest0002")).thenReturn(getDisabledUser());
result = usersService.batchActivateUser(user, userNames);
Map<String, Object> responseData = (Map<String, Object>) result.get(Constants.DATA_LIST);
Map<String, Object> successData = (Map<String, Object>) responseData.get("success");
int totalSuccess = (Integer) successData.get("sum");
Map<String, Object> failedData = (Map<String, Object>) responseData.get("failed");
int totalFailed = (Integer) failedData.get("sum");
Assert.assertEquals(1, totalSuccess);
Assert.assertEquals(3, totalFailed);
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
} catch (Exception e) {
Assert.assertTrue(false);
}
}
/**
* get disabled user
*/
private User getDisabledUser() {
User user = new User();
user.setUserType(UserType.GENERAL_USER);
user.setUserName("userTest0001");
user.setUserPassword("userTest0001");
user.setState(0);
return user; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | }
/**
* get user
*/
private User getGeneralUser() {
User user = new User();
user.setUserType(UserType.GENERAL_USER);
user.setUserName("userTest0001");
user.setUserPassword("userTest0001");
return user;
}
private List<User> getUserList() {
List<User> userList = new ArrayList<>();
userList.add(getGeneralUser());
return userList;
}
/**
* get user
*/
private User getUser() {
User user = new User();
user.setUserType(UserType.ADMIN_USER);
user.setUserName("userTest0001");
user.setUserPassword("userTest0001");
user.setState(1);
return user;
}
/**
* get tenant
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,180 | [Feature][dolphinscheduler-api] Revoke project permission for specified user | ### 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
Revoke project permission for specified user
### 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/7180 | https://github.com/apache/dolphinscheduler/pull/7185 | 2dc09c627fe1d32c63e9a7551390540581916d7d | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | "2021-12-04T17:08:06Z" | java | "2021-12-05T06:13:23Z" | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java | * @return tenant
*/
private Tenant getTenant() {
Tenant tenant = new Tenant();
tenant.setId(1);
return tenant;
}
/**
* get resource
*
* @return resource
*/
private Resource getResource() {
Resource resource = new Resource();
resource.setPid(-1);
resource.setUserId(1);
resource.setDescription("ResourcesServiceTest.jar");
resource.setAlias("ResourcesServiceTest.jar");
resource.setFullName("/ResourcesServiceTest.jar");
resource.setType(ResourceType.FILE);
return resource;
}
private List<AlertGroup> getAlertGroups() {
List<AlertGroup> alertGroups = new ArrayList<>();
AlertGroup alertGroup = new AlertGroup();
alertGroups.add(alertGroup);
return alertGroups;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.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
* 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_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.DEFAULT_WORKER_GROUP;
mport org.apache.dolphnscheduler.common.Constants;
mport org.apache.dolphnscheduler.common.enums.CommandType;
mport org.apache.dolphnscheduler.common.enums.DependResult; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | mport org.apache.dolphnscheduler.common.enums.Drect;
mport org.apache.dolphnscheduler.common.enums.ExecutonStatus;
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.StateEvent;
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.enums.TaskTmeoutStrategy;
mport org.apache.dolphnscheduler.common.enums.TmeoutFlag;
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.process.Property;
mport org.apache.dolphnscheduler.common.utls.DateUtls;
mport org.apache.dolphnscheduler.common.utls.JSONUtls;
mport org.apache.dolphnscheduler.common.utls.NetUtls;
mport org.apache.dolphnscheduler.common.utls.ParameterUtls;
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.ProjectUser;
mport org.apache.dolphnscheduler.dao.entty.Schedule;
mport org.apache.dolphnscheduler.dao.entty.TaskDefnton;
mport org.apache.dolphnscheduler.dao.entty.TaskGroupQueue;
mport org.apache.dolphnscheduler.dao.entty.TaskInstance;
mport org.apache.dolphnscheduler.dao.utls.DagHelper; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | 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.runner.task.ITaskProcessor;
mport org.apache.dolphnscheduler.server.master.runner.task.TaskActon;
mport org.apache.dolphnscheduler.server.master.runner.task.TaskProcessorFactory;
mport org.apache.dolphnscheduler.servce.alert.ProcessAlertManager;
mport org.apache.dolphnscheduler.servce.process.ProcessServce;
mport org.apache.dolphnscheduler.servce.quartz.cron.CronUtls;
mport org.apache.dolphnscheduler.servce.queue.PeerTaskInstancePrortyQueue;
mport org.apache.commons.collectons.CollectonUtls;
mport org.apache.commons.lang.StrngUtls;
mport java.utl.ArrayLst;
mport java.utl.Arrays;
mport java.utl.Collecton;
mport java.utl.Date;
mport java.utl.HashMap;
mport java.utl.Iterator;
mport java.utl.Lst;
mport java.utl.Map;
mport java.utl.Objects;
mport java.utl.Set;
mport java.utl.concurrent.ConcurrentHashMap;
mport java.utl.concurrent.ConcurrentLnkedQueue;
mport org.slf4j.Logger;
mport org.slf4j.LoggerFactory;
mport com.google.common.collect.Lsts;
/**
* master exec thread,splt dag |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | */
publc class WorkflowExecuteThread mplements Runnable {
/**
* logger of WorkflowExecuteThread
*/
prvate statc fnal Logger logger = LoggerFactory.getLogger(WorkflowExecuteThread.class);
/**
* master confg
*/
prvate MasterConfg masterConfg;
/**
* process servce
*/
prvate ProcessServce processServce;
/**
* alert manager
*/
prvate ProcessAlertManager processAlertManager;
/**
* netty executor manager
*/
prvate NettyExecutorManager nettyExecutorManager;
/**
* process nstance
*/
prvate ProcessInstance processInstance;
/**
* process defnton
*/
prvate ProcessDefnton processDefnton; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | /**
* the object of DAG
*/
prvate DAG<Strng, TaskNode, TaskNodeRelaton> dag;
/**
* key of workflow
*/
prvate Strng key;
/**
* start flag, true: start nodes submt completely
*/
prvate boolean sStart = false;
/**
* submt falure nodes
*/
prvate boolean taskFaledSubmt = false;
/**
* task nstance hash map, taskId as key
*/
prvate Map<Integer, TaskInstance> taskInstanceMap = new ConcurrentHashMap<>();
/**
* runnng TaskNode, taskId as key
*/
prvate fnal Map<Integer, ITaskProcessor> actveTaskProcessorMaps = new ConcurrentHashMap<>();
/**
* vald task map, taskCode as key, taskId as value
*/
prvate Map<Strng, Integer> valdTaskMap = new ConcurrentHashMap<>();
/**
* error task map, taskCode as key, taskId as value |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | */
prvate Map<Strng, Integer> errorTaskMap = new ConcurrentHashMap<>();
/**
* complete task map, taskCode as key, taskId as value
*/
prvate Map<Strng, Integer> completeTaskMap = new ConcurrentHashMap<>();
/**
* depend faled task map, taskCode as key, taskId as value
*/
prvate Map<Strng, Integer> dependFaledTaskMap = new ConcurrentHashMap<>();
/**
* forbdden task map, code as key
*/
prvate Map<Strng, TaskNode> forbddenTaskMap = new ConcurrentHashMap<>();
/**
* skp task map, code as key
*/
prvate Map<Strng, TaskNode> skpTaskNodeMap = new ConcurrentHashMap<>();
/**
* complement date lst
*/
prvate Lst<Date> complementLstDate = Lsts.newLnkedLst();
/**
* task tmeout check lst
*/
prvate ConcurrentHashMap<Integer, TaskInstance> taskTmeoutCheckLst;
/**
* state event queue
*/
prvate ConcurrentLnkedQueue<StateEvent> stateEvents = new ConcurrentLnkedQueue<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | /**
* ready to submt task queue
*/
prvate PeerTaskInstancePrortyQueue readyToSubmtTaskQueue = new PeerTaskInstancePrortyQueue();
/**
* constructor of WorkflowExecuteThread
*
* @param processInstance processInstance
* @param processServce processServce
* @param nettyExecutorManager nettyExecutorManager
*/
publc WorkflowExecuteThread(ProcessInstance processInstance
, ProcessServce processServce
, NettyExecutorManager nettyExecutorManager
, ProcessAlertManager processAlertManager
, MasterConfg masterConfg
, ConcurrentHashMap<Integer, TaskInstance> taskTmeoutCheckLst) {
ths.processServce = processServce;
ths.processInstance = processInstance;
ths.masterConfg = masterConfg;
ths.nettyExecutorManager = nettyExecutorManager;
ths.processAlertManager = processAlertManager;
ths.taskTmeoutCheckLst = taskTmeoutCheckLst;
}
@Overrde
publc vod run() {
try {
f (!ths.sStart()) {
startProcess();
} else { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | handleEvents();
}
} catch (Excepton e) {
logger.error("handler error:", e);
}
}
/**
* the process start nodes are submtted completely.
*/
publc boolean sStart() {
return ths.sStart;
}
prvate vod handleEvents() {
whle (!ths.stateEvents.sEmpty()) {
try {
StateEvent stateEvent = ths.stateEvents.peek();
f (stateEventHandler(stateEvent)) {
ths.stateEvents.remove(stateEvent);
}
} catch (Excepton e) {
logger.error("state handle error:", e);
}
}
}
publc Strng getKey() {
f (StrngUtls.sNotEmpty(key)
|| ths.processDefnton == null) {
return key;
}
key = Strng.format("%d_%d_%d", |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | 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.toStrng());
return false;
}
ths.stateEvents.add(stateEvent);
return true;
}
publc nt eventSze() {
return ths.stateEvents.sze();
}
publc ProcessInstance getProcessInstance() {
return ths.processInstance;
}
prvate boolean stateEventHandler(StateEvent stateEvent) {
logger.nfo("process event: {}", stateEvent.toStrng());
f (!checkProcessInstance(stateEvent)) {
return false;
}
boolean result = false;
swtch (stateEvent.getType()) {
case PROCESS_STATE_CHANGE:
result = processStateChangeHandler(stateEvent);
break;
case TASK_STATE_CHANGE: |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | result = taskStateChangeHandler(stateEvent);
break;
case PROCESS_TIMEOUT:
result = processTmeout();
break;
case TASK_TIMEOUT:
result = taskTmeout(stateEvent);
break;
case WAIT_TASK_GROUP:
result = checkForceStartAndWakeUp(stateEvent);
break;
default:
break;
}
f (result) {
ths.stateEvents.remove(stateEvent);
}
return result;
}
prvate boolean checkForceStartAndWakeUp(StateEvent stateEvent) {
TaskGroupQueue taskGroupQueue = ths.processServce.loadTaskGroupQueue(stateEvent.getTaskInstanceId());
f (taskGroupQueue.getForceStart() == Flag.YES.getCode()) {
ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(stateEvent.getTaskInstanceId());
TaskInstance taskInstance = ths.processServce.fndTaskInstanceById(stateEvent.getTaskInstanceId());
ProcessInstance processInstance = ths.processServce.fndProcessInstanceById(taskInstance.getProcessInstanceId());
taskProcessor.dspatch(taskInstance, processInstance);
ths.processServce.updateTaskGroupQueueStatus(taskGroupQueue.getId(), TaskGroupQueueStatus.ACQUIRE_SUCCESS.getCode());
return true;
}
f (taskGroupQueue.getInQueue() == Flag.YES.getCode()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | boolean acqureTaskGroup = processServce.acqureTaskGroupAgan(taskGroupQueue);
f (acqureTaskGroup) {
ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(stateEvent.getTaskInstanceId());
TaskInstance taskInstance = ths.processServce.fndTaskInstanceById(stateEvent.getTaskInstanceId());
ProcessInstance processInstance = ths.processServce.fndProcessInstanceById(taskInstance.getProcessInstanceId());
taskProcessor.dspatch(taskInstance, processInstance);
return true;
}
}
return false;
}
prvate boolean taskTmeout(StateEvent stateEvent) {
f (!checkTaskInstanceByStateEvent(stateEvent)) {
return true;
}
TaskInstance taskInstance = taskInstanceMap.get(stateEvent.getTaskInstanceId());
f (TmeoutFlag.CLOSE == taskInstance.getTaskDefne().getTmeoutFlag()) {
return true;
}
TaskTmeoutStrategy taskTmeoutStrategy = taskInstance.getTaskDefne().getTmeoutNotfyStrategy();
f (TaskTmeoutStrategy.FAILED == taskTmeoutStrategy) {
ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(stateEvent.getTaskInstanceId());
taskProcessor.acton(TaskActon.TIMEOUT);
return false;
} else {
processAlertManager.sendTaskTmeoutAlert(processInstance, taskInstance, taskInstance.getTaskDefne());
return true;
}
}
prvate boolean processTmeout() { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | ths.processAlertManager.sendProcessTmeoutAlert(ths.processInstance, ths.processDefnton);
return true;
}
prvate boolean taskStateChangeHandler(StateEvent stateEvent) {
f (!checkTaskInstanceByStateEvent(stateEvent)) {
return true;
}
TaskInstance task = getTaskInstance(stateEvent.getTaskInstanceId());
f (task.getState() == null) {
logger.error("task state s null, state handler error: {}", stateEvent);
return true;
}
f (task.getState().typeIsFnshed() && !completeTaskMap.contansKey(Long.toStrng(task.getTaskCode()))) {
taskFnshed(task);
f (task.getTaskGroupId() > 0) {
TaskInstance nextTaskInstance = ths.processServce.releaseTaskGroup(task);
f (nextTaskInstance != null) {
f (nextTaskInstance.getProcessInstanceId() == task.getProcessInstanceId()) {
StateEvent nextEvent = new StateEvent();
nextEvent.setProcessInstanceId(ths.processInstance.getId());
nextEvent.setTaskInstanceId(nextTaskInstance.getId());
nextEvent.setType(StateEventType.WAIT_TASK_GROUP);
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);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
} else f (actveTaskProcessorMaps.contansKey(stateEvent.getTaskInstanceId())) {
ITaskProcessor TaskProcessor = actveTaskProcessorMaps.get(stateEvent.getTaskInstanceId());
TaskProcessor.run();
f (TaskProcessor.taskState().typeIsFnshed()) {
task = processServce.fndTaskInstanceById(stateEvent.getTaskInstanceId());
taskFnshed(task);
}
} else {
logger.error("state handler error: {}", stateEvent);
}
return true;
}
prvate vod taskFnshed(TaskInstance task) {
logger.nfo("work flow {} task {} state:{} ",
processInstance.getId(),
task.getId(),
task.getState());
f (task.taskCanRetry()) {
addTaskToStandByLst(task);
f (!task.retryTaskIntervalOverTme()) {
logger.nfo("falure task wll be submtted: process d: {}, task nstance d: {} state:{} retry tmes:{} / {}, nterval:{}",
processInstance.getId(),
task.getId(),
task.getState(),
task.getRetryTmes(),
task.getMaxRetryTmes(),
task.getRetryInterval());
ths.addTmeoutCheck(task);
} else { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | submtStandByTask();
}
return;
}
completeTaskMap.put(Long.toStrng(task.getTaskCode()), task.getId());
actveTaskProcessorMaps.remove(task.getId());
taskTmeoutCheckLst.remove(task.getId());
f (task.getState().typeIsSuccess()) {
processInstance.setVarPool(task.getVarPool());
processServce.saveProcessInstance(processInstance);
submtPostNode(Long.toStrng(task.getTaskCode()));
} else f (task.getState().typeIsFalure()) {
f (task.sCondtonsTask()
|| DagHelper.haveCondtonsAfterNode(Long.toStrng(task.getTaskCode()), dag)) {
submtPostNode(Long.toStrng(task.getTaskCode()));
} else {
errorTaskMap.put(Long.toStrng(task.getTaskCode()), task.getId());
f (processInstance.getFalureStrategy() == FalureStrategy.END) {
kllAllTasks();
}
}
}
ths.updateProcessInstanceState();
}
/**
* update process nstance
*/
publc vod refreshProcessInstance(nt processInstanceId) {
logger.nfo("process nstance update: {}", processInstanceId);
processInstance = processServce.fndProcessInstanceById(processInstanceId); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | 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);
valdTaskMap.remove(Long.toStrng(taskInstance.getTaskCode()));
f (Flag.YES == taskInstance.getFlag()) {
valdTaskMap.put(Long.toStrng(taskInstance.getTaskCode()), taskInstance.getId());
}
}
/**
* check process nstance by state event
*/
publc boolean checkProcessInstance(StateEvent stateEvent) {
f (ths.processInstance.getId() != stateEvent.getProcessInstanceId()) {
logger.error("msmatch process nstance d: {}, state event:{}",
ths.processInstance.getId(),
stateEvent);
return false; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
return true;
}
/**
* check f task nstance exst by state event
*/
publc boolean checkTaskInstanceByStateEvent(StateEvent stateEvent) {
f (stateEvent.getTaskInstanceId() == 0) {
logger.error("task nstance d null, state event:{}", stateEvent);
return false;
}
f (!taskInstanceMap.contansKey(stateEvent.getTaskInstanceId())) {
logger.error("msmatch task nstance d, event:{}", stateEvent);
return false;
}
return true;
}
/**
* check f task nstance exst by task code
*/
publc boolean checkTaskInstanceByCode(long taskCode) {
f (taskInstanceMap == null || taskInstanceMap.sze() == 0) {
return false;
}
for (TaskInstance taskInstance : taskInstanceMap.values()) {
f (taskInstance.getTaskCode() == taskCode) {
return true;
}
}
return false; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
/**
* check f task nstance exst by d
*/
publc boolean checkTaskInstanceById(nt taskInstanceId) {
f (taskInstanceMap == null || taskInstanceMap.sze() == 0) {
return false;
}
return taskInstanceMap.contansKey(taskInstanceId);
}
/**
* get task nstance from memory
*/
publc TaskInstance getTaskInstance(nt taskInstanceId) {
f (taskInstanceMap.contansKey(taskInstanceId)) {
return taskInstanceMap.get(taskInstanceId);
}
return null;
}
prvate boolean processStateChangeHandler(StateEvent stateEvent) {
try {
logger.nfo("process:{} state {} change to {}", processInstance.getId(), processInstance.getState(), stateEvent.getExecutonStatus());
f (processComplementData()) {
return true;
}
f (stateEvent.getExecutonStatus().typeIsFnshed()) {
endProcess();
}
f (processInstance.getState() == ExecutonStatus.READY_STOP) {
kllAllTasks(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
return true;
} catch (Excepton e) {
logger.error("process state change error:", e);
}
return true;
}
prvate boolean processComplementData() throws Excepton {
f (!needComplementProcess()) {
return false;
}
Date scheduleDate = processInstance.getScheduleTme();
f (scheduleDate == null) {
scheduleDate = complementLstDate.get(0);
} else f (processInstance.getState().typeIsFnshed()) {
endProcess();
f (complementLstDate.sze() <= 0) {
logger.nfo("process complement end. process d:{}", processInstance.getId());
return true;
}
nt ndex = complementLstDate.ndexOf(scheduleDate);
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.toStrng()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | scheduleDate = complementLstDate.get(ndex + 1);
processInstance.setId(0);
}
processInstance.setScheduleTme(scheduleDate);
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);
processInstance.setCommandParam(JSONUtls.toJsonStrng(cmdParam));
}
processInstance.setState(ExecutonStatus.RUNNING_EXECUTION);
processInstance.setGlobalParams(ParameterUtls.curngGlobalParams(
processDefnton.getGlobalParamMap(),
processDefnton.getGlobalParamLst(),
CommandType.COMPLEMENT_DATA, processInstance.getScheduleTme()));
processInstance.setStartTme(new Date());
processInstance.setEndTme(null);
processServce.saveProcessInstance(processInstance);
ths.taskInstanceMap.clear();
startProcess();
return true;
}
prvate boolean needComplementProcess() {
f (processInstance.sComplementData()
&& Flag.NO == processInstance.getIsSubProcess()) {
return true;
}
return false;
}
prvate vod startProcess() throws Excepton { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | f (ths.taskInstanceMap.sze() == 0) {
sStart = false;
buldFlowDag();
ntTaskQueue();
submtPostNode(null);
sStart = true;
}
}
/**
* process end handle
*/
prvate vod endProcess() {
ths.stateEvents.clear();
f (processDefnton.getExecutonType().typeIsSeralWat()) {
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);
}
Lst<TaskInstance> taskInstances = processServce.fndValdTaskLstByProcessId(processInstance.getId());
ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId());
processAlertManager.sendAlertProcessInstance(processInstance, taskInstances, projectUser);
processServce.releaseAllTaskGroup(processInstance.getId());
}
publc vod checkSeralProcess(ProcessDefnton processDefnton) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | nt nextInstanceId = processInstance.getNextProcessInstanceId();
f (nextInstanceId == 0) {
ProcessInstance nextProcessInstance = ths.processServce.loadNextProcess4Seral(processInstance.getProcessDefnton().getCode(), ExecutonStatus.SERIAL_WAIT.getCode());
f (nextProcessInstance == null) {
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.setProcessDefntonCode(processDefnton.getCode());
command.setCommandParam(JSONUtls.toJsonStrng(cmdParam));
processServce.createCommand(command);
}
/**
* generate process dag
*
* @throws Excepton excepton
*/
prvate vod buldFlowDag() throws Excepton {
f (ths.dag != null) {
return;
}
processDefnton = processServce.fndProcessDefnton(processInstance.getProcessDefntonCode(), |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | processInstance.getProcessDefntonVerson());
processInstance.setProcessDefnton(processDefnton);
Lst<TaskInstance> recoverNodeLst = getStartTaskInstanceLst(processInstance.getCommandParam());
Lst<TaskNode> taskNodeLst =
processServce.transformTask(processServce.fndRelatonByCode(processDefnton.getProjectCode(), processDefnton.getCode()), Lsts.newArrayLst());
forbddenTaskMap.clear();
taskNodeLst.forEach(taskNode -> {
f (taskNode.sForbdden()) {
forbddenTaskMap.put(Long.toStrng(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);
}
/**
* nt task queue
*/
prvate vod ntTaskQueue() {
taskFaledSubmt = false;
actveTaskProcessorMaps.clear();
dependFaledTaskMap.clear(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | completeTaskMap.clear();
errorTaskMap.clear();
f (ExecutonStatus.SUBMITTED_SUCCESS != processInstance.getState()) {
Lst<TaskInstance> valdTaskInstanceLst = processServce.fndValdTaskLstByProcessId(processInstance.getId());
for (TaskInstance task : valdTaskInstanceLst) {
valdTaskMap.put(Long.toStrng(task.getTaskCode()), task.getId());
taskInstanceMap.put(task.getId(), task);
f (task.sTaskComplete()) {
completeTaskMap.put(Long.toStrng(task.getTaskCode()), task.getId());
}
f (task.sCondtonsTask() || DagHelper.haveCondtonsAfterNode(Long.toStrng(task.getTaskCode()), dag)) {
contnue;
}
f (task.getState().typeIsFalure() && !task.taskCanRetry()) {
errorTaskMap.put(Long.toStrng(task.getTaskCode()), task.getId());
}
}
}
f (processInstance.sComplementData() && complementLstDate.sze() == 0) {
Map<Strng, Strng> cmdParam = JSONUtls.toMap(processInstance.getCommandParam());
f (cmdParam != null && cmdParam.contansKey(CMDPARAM_COMPLEMENT_DATA_START_DATE)) {
Date start = DateUtls.strngToDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE));
Date end = DateUtls.strngToDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_END_DATE));
Lst<Schedule> schedules = processServce.queryReleaseSchedulerLstByProcessDefntonCode(processInstance.getProcessDefntonCode());
f (complementLstDate.sze() == 0 && needComplementProcess()) {
complementLstDate = CronUtls.getSelfFreDateLst(start, end, schedules);
logger.nfo(" process defnton code:{} complement data: {}",
processInstance.getProcessDefntonCode(), complementLstDate.toStrng());
f (complementLstDate.sze() > 0 && Flag.NO == processInstance.getIsSubProcess()) {
processInstance.setScheduleTme(complementLstDate.get(0)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | processInstance.setGlobalParams(ParameterUtls.curngGlobalParams(
processDefnton.getGlobalParamMap(),
processDefnton.getGlobalParamLst(),
CommandType.COMPLEMENT_DATA, processInstance.getScheduleTme()));
processServce.updateProcessInstance(processInstance);
}
}
}
}
}
/**
* submt task to execute
*
* @param taskInstance task nstance
* @return TaskInstance
*/
prvate TaskInstance submtTaskExec(TaskInstance taskInstance) {
try {
ITaskProcessor taskProcessor = TaskProcessorFactory.getTaskProcessor(taskInstance.getTaskType());
f (taskInstance.getState() == ExecutonStatus.RUNNING_EXECUTION
&& taskProcessor.getType().equalsIgnoreCase(Constants.COMMON_TASK_TYPE)) {
notfyProcessHostUpdate(taskInstance);
}
TaskDefnton taskDefnton = processServce.fndTaskDefnton(
taskInstance.getTaskCode(),
taskInstance.getTaskDefntonVerson());
taskInstance.setTaskGroupId(taskDefnton.getTaskGroupId());
processServce.packageTaskInstance(taskInstance, processInstance);
boolean submt = taskProcessor.submt(taskInstance, processInstance, masterConfg.getTaskCommtRetryTmes(), masterConfg.getTaskCommtInterval()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | f (!submt) {
logger.error("process d:{} name:{} submt standby task d:{} name:{} faled!",
processInstance.getId(), processInstance.getName(),
taskInstance.getId(), taskInstance.getName());
return null;
}
taskInstanceMap.put(taskInstance.getId(), taskInstance);
actveTaskProcessorMaps.put(taskInstance.getId(), taskProcessor);
taskProcessor.run();
addTmeoutCheck(taskInstance);
f (taskProcessor.taskState().typeIsFnshed()) {
StateEvent stateEvent = new StateEvent();
stateEvent.setProcessInstanceId(ths.processInstance.getId());
stateEvent.setTaskInstanceId(taskInstance.getId());
stateEvent.setExecutonStatus(taskProcessor.taskState());
stateEvent.setType(StateEventType.TASK_STATE_CHANGE);
ths.stateEvents.add(stateEvent);
}
return taskInstance;
} catch (Excepton e) {
logger.error("submt standby task error", e);
return null;
}
}
prvate vod notfyProcessHostUpdate(TaskInstance taskInstance) {
f (StrngUtls.sEmpty(taskInstance.getHost())) {
return;
}
try {
HostUpdateCommand hostUpdateCommand = new HostUpdateCommand(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | hostUpdateCommand.setProcessHost(NetUtls.getAddr(masterConfg.getLstenPort()));
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);
}
}
prvate vod addTmeoutCheck(TaskInstance taskInstance) {
f (taskTmeoutCheckLst.contansKey(taskInstance.getId())) {
return;
}
TaskDefnton taskDefnton = taskInstance.getTaskDefne();
f (taskDefnton == null) {
logger.error("taskDefnton s null, taskId:{}", taskInstance.getId());
return;
}
f (TmeoutFlag.OPEN == taskDefnton.getTmeoutFlag() || taskInstance.taskCanRetry()) {
ths.taskTmeoutCheckLst.put(taskInstance.getId(), taskInstance);
} else {
f (taskInstance.sDependTask() || taskInstance.sSubProcess()) {
ths.taskTmeoutCheckLst.put(taskInstance.getId(), taskInstance);
}
}
}
/**
* fnd task nstance n db.
* n case submt more than one same name task n the same tme.
*
* @param taskCode task code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | * @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
*
* @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) {
taskInstance = new TaskInstance();
taskInstance.setTaskCode(taskNode.getCode());
taskInstance.setTaskDefntonVerson(taskNode.getVerson());
taskInstance.setName(taskNode.getName());
taskInstance.setState(ExecutonStatus.SUBMITTED_SUCCESS); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | taskInstance.setProcessInstanceId(processInstance.getId());
taskInstance.setTaskType(taskNode.getType().toUpperCase());
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());
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;
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(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | 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(preTaskCode);
f (taskId == null) {
contnue;
}
TaskInstance preTaskInstance = taskInstanceMap.get(taskId);
f (preTaskInstance == null) {
contnue; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
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()));
}
}
}
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)) {
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()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | 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 (Integer taskInstanceId : completeTaskMap.values()) {
TaskInstance taskInstance = taskInstanceMap.get(taskInstanceId);
completeTaskInstanceMap.put(Long.toStrng(taskInstance.getTaskCode()), taskInstance);
}
return completeTaskInstanceMap;
}
/**
* get vald task lst
*/
prvate Lst<TaskInstance> getValdTaskLst() {
Lst<TaskInstance> valdTaskInstanceLst = new ArrayLst<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | for (Integer taskInstanceId : valdTaskMap.values()) {
valdTaskInstanceLst.add(taskInstanceMap.get(taskInstanceId));
}
return valdTaskInstanceLst;
}
prvate vod submtPostNode(Strng parentNodeCode) {
Set<Strng> submtTaskNodeLst = DagHelper.parsePostNodes(parentNodeCode, skpTaskNodeMap, dag, getCompleteTaskInstanceMap());
Lst<TaskInstance> taskInstances = new ArrayLst<>();
for (Strng taskNode : submtTaskNodeLst) {
TaskNode taskNodeObject = dag.getNode(taskNode);
f (checkTaskInstanceByCode(taskNodeObject.getCode())) {
contnue;
}
TaskInstance task = createTaskInstance(processInstance, taskNodeObject);
taskInstances.add(task);
}
for (TaskInstance task : taskInstances) {
f (readyToSubmtTaskQueue.contans(task)) {
contnue;
}
f (completeTaskMap.contansKey(Long.toStrng(task.getTaskCode()))) {
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); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
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> depCodeLst = taskNode.getDepLst();
for (Strng depsNode : depCodeLst) {
f (!dag.contansNode(depsNode)
|| forbddenTaskMap.contansKey(depsNode)
|| skpTaskNodeMap.contansKey(depsNode)) {
contnue;
}
f (!completeTaskMap.contansKey(depsNode)) {
return DependResult.WAITING;
}
Integer depsTaskId = completeTaskMap.get(depsNode);
ExecutonStatus depTaskState = taskInstanceMap.get(depsTaskId).getState();
f (depTaskState.typeIsPause() || depTaskState.typeIsCancel()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | return DependResult.NON_EXEC;
}
f (taskNode.sCondtonsTask()) {
contnue;
}
f (!dependTaskSuccess(depsNode, taskCode)) {
return DependResult.FAILED;
}
}
logger.nfo("taskCode: {} completeDependTaskLst: {}", taskCode, Arrays.toStrng(completeTaskMap.keySet().toArray()));
return DependResult.SUCCESS;
}
/**
* depend node s completed, but here need check the condton task branch s the next node
*/
prvate boolean dependTaskSuccess(Strng dependNodeName, Strng nextNodeName) {
f (dag.getNode(dependNodeName).sCondtonsTask()) {
Lst<Strng> nextTaskLst = DagHelper.parseCondtonTask(dependNodeName, skpTaskNodeMap, dag, getCompleteTaskInstanceMap());
f (!nextTaskLst.contans(nextNodeName)) {
return false;
}
} else {
Integer taskInstanceId = completeTaskMap.get(dependNodeName);
ExecutonStatus depTaskState = taskInstanceMap.get(taskInstanceId).getState();
f (depTaskState.typeIsFalure()) {
return false;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | return true;
}
/**
* query task nstance by complete state
*
* @param state state
* @return task nstance lst
*/
prvate Lst<TaskInstance> getCompleteTaskByState(ExecutonStatus state) {
Lst<TaskInstance> resultLst = new ArrayLst<>();
for (Integer taskInstanceId : completeTaskMap.values()) {
TaskInstance taskInstance = taskInstanceMap.get(taskInstanceId);
f (taskInstance != null && taskInstance.getState() == state) {
resultLst.add(taskInstance);
}
}
return resultLst;
}
/**
* where there are ongong tasks
*
* @param state state
* @return ExecutonStatus
*/
prvate ExecutonStatus runnngState(ExecutonStatus state) {
f (state == ExecutonStatus.READY_STOP
|| state == ExecutonStatus.READY_PAUSE
|| state == ExecutonStatus.WAITING_THREAD
|| state == ExecutonStatus.DELAY_EXECUTION) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | return state;
} else {
return ExecutonStatus.RUNNING_EXECUTION;
}
}
/**
* exsts falure task,contans submt falure、dependency falure,execute falure(retry after)
*
* @return Boolean whether has faled task
*/
prvate boolean hasFaledTask() {
f (ths.taskFaledSubmt) {
return true;
}
f (ths.errorTaskMap.sze() > 0) {
return true;
}
return ths.dependFaledTaskMap.sze() > 0;
}
/**
* process nstance falure
*
* @return Boolean whether process nstance faled
*/
prvate boolean processFaled() {
f (hasFaledTask()) {
f (processInstance.getFalureStrategy() == FalureStrategy.END) {
return true;
}
f (processInstance.getFalureStrategy() == FalureStrategy.CONTINUE) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | return readyToSubmtTaskQueue.sze() == 0 && actveTaskProcessorMaps.sze() == 0;
}
}
return false;
}
/**
* whether task for watng thread
*
* @return Boolean whether has watng thread task
*/
prvate boolean hasWatngThreadTask() {
Lst<TaskInstance> watngLst = getCompleteTaskByState(ExecutonStatus.WAITING_THREAD);
return CollectonUtls.sNotEmpty(watngLst);
}
/**
* prepare for pause
* 1,faled retry task n the preparaton queue , returns to falure drectly
* 2,exsts pause task,complement not completed, pendng submsson of tasks, return to suspenson
* 3,success
*
* @return ExecutonStatus
*/
prvate ExecutonStatus processReadyPause() {
f (hasRetryTaskInStandBy()) {
return ExecutonStatus.FAILURE;
}
Lst<TaskInstance> pauseLst = getCompleteTaskByState(ExecutonStatus.PAUSE);
f (CollectonUtls.sNotEmpty(pauseLst)
|| !sComplementEnd()
|| readyToSubmtTaskQueue.sze() > 0) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | return ExecutonStatus.PAUSE;
} else {
return ExecutonStatus.SUCCESS;
}
}
/**
* generate the latest process nstance status by the tasks state
*
* @return process nstance executon status
*/
prvate ExecutonStatus getProcessInstanceState(ProcessInstance nstance) {
ExecutonStatus state = nstance.getState();
f (actveTaskProcessorMaps.sze() > 0 || hasRetryTaskInStandBy()) {
// actve
return runnngState(state);
}
// process falure
f (processFaled()) {
return ExecutonStatus.FAILURE;
}
// watng thread
f (hasWatngThreadTask()) {
return ExecutonStatus.WAITING_THREAD;
}
// pause
f (state == ExecutonStatus.READY_PAUSE) {
return processReadyPause();
}
// stop
f (state == ExecutonStatus.READY_STOP) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | Lst<TaskInstance> stopLst = getCompleteTaskByState(ExecutonStatus.STOP);
Lst<TaskInstance> kllLst = getCompleteTaskByState(ExecutonStatus.KILL);
f (CollectonUtls.sNotEmpty(stopLst)
|| CollectonUtls.sNotEmpty(kllLst)
|| !sComplementEnd()) {
return ExecutonStatus.STOP;
} else {
return ExecutonStatus.SUCCESS;
}
}
// success
f (state == ExecutonStatus.RUNNING_EXECUTION) {
Lst<TaskInstance> kllTasks = getCompleteTaskByState(ExecutonStatus.KILL);
f (readyToSubmtTaskQueue.sze() > 0) {
//tasks cu
return ExecutonStatus.RUNNING_EXECUTION;
} else f (CollectonUtls.sNotEmpty(kllTasks)) {
// tasks m
return ExecutonStatus.FAILURE;
} else {
// f the
return ExecutonStatus.SUCCESS;
}
}
return state;
}
/**
* whether complement end
*
* @return Boolean whether s complement end |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | */
prvate boolean sComplementEnd() {
f (!processInstance.sComplementData()) {
return true;
}
try {
Map<Strng, Strng> cmdParam = JSONUtls.toMap(processInstance.getCommandParam());
Date endTme = DateUtls.getScheduleDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_END_DATE));
return processInstance.getScheduleTme().equals(endTme);
} catch (Excepton e) {
logger.error("complement end faled ", e);
return false;
}
}
/**
* updateProcessInstance process nstance state
* after each batch of tasks s executed, the status of the process nstance s updated
*/
prvate vod updateProcessInstanceState() {
ExecutonStatus state = getProcessInstanceState(processInstance);
f (processInstance.getState() != state) {
logger.nfo(
"work flow process nstance [d: {}, name:{}], state change from {} to {}, cmd type: {}",
processInstance.getId(), processInstance.getName(),
processInstance.getState(), state,
processInstance.getCommandType());
processInstance.setState(state);
f (state.typeIsFnshed()) {
processInstance.setEndTme(new Date());
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | processServce.updateProcessInstance(processInstance);
StateEvent stateEvent = new StateEvent();
stateEvent.setExecutonStatus(processInstance.getState());
stateEvent.setProcessInstanceId(ths.processInstance.getId());
stateEvent.setType(StateEventType.PROCESS_STATE_CHANGE);
ths.processStateChangeHandler(stateEvent);
}
}
/**
* get task dependency result
*
* @param taskInstance task nstance
* @return DependResult
*/
prvate DependResult getDependResultForTask(TaskInstance taskInstance) {
return sTaskDepsComplete(Long.toStrng(taskInstance.getTaskCode()));
}
/**
* add task to standby lst
*
* @param taskInstance task nstance
*/
prvate vod addTaskToStandByLst(TaskInstance taskInstance) {
logger.nfo("add task to stand by lst: {}", taskInstance.getName());
try {
f (!readyToSubmtTaskQueue.contans(taskInstance)) {
readyToSubmtTaskQueue.put(taskInstance);
}
} catch (Excepton e) {
logger.error("add task nstance to readyToSubmtTaskQueue error, taskName: {}", taskInstance.getName(), e); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
}
/**
* remove task from stand by lst
*
* @param taskInstance task nstance
*/
prvate vod removeTaskFromStandbyLst(TaskInstance taskInstance) {
logger.nfo("remove task from stand by lst, d: {} name:{}",
taskInstance.getId(),
taskInstance.getName());
try {
readyToSubmtTaskQueue.remove(taskInstance);
} catch (Excepton e) {
logger.error("remove task nstance from readyToSubmtTaskQueue error, task d:{}, Name: {}",
taskInstance.getId(),
taskInstance.getName(), e);
}
}
/**
* has retry task n standby
*
* @return Boolean whether has retry task n standby
*/
prvate boolean hasRetryTaskInStandBy() {
for (Iterator<TaskInstance> ter = readyToSubmtTaskQueue.terator(); ter.hasNext(); ) {
f (ter.next().getState().typeIsFalure()) {
return true;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | return false;
}
/**
* close the on gong tasks
*/
prvate vod kllAllTasks() {
logger.nfo("kll called on process nstance d: {}, num: {}", processInstance.getId(),
actveTaskProcessorMaps.sze());
for (nt taskId : actveTaskProcessorMaps.keySet()) {
TaskInstance taskInstance = processServce.fndTaskInstanceById(taskId);
f (taskInstance == null || taskInstance.getState().typeIsFnshed()) {
contnue;
}
ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(taskId);
taskProcessor.acton(TaskActon.STOP);
f (taskProcessor.taskState().typeIsFnshed()) {
StateEvent stateEvent = new StateEvent();
stateEvent.setType(StateEventType.TASK_STATE_CHANGE);
stateEvent.setProcessInstanceId(ths.processInstance.getId());
stateEvent.setTaskInstanceId(taskInstance.getId());
stateEvent.setExecutonStatus(taskProcessor.taskState());
ths.addStateEvent(stateEvent);
}
}
}
publc boolean workFlowFnsh() {
return ths.processInstance.getState().typeIsFnshed();
}
/**
* handlng the lst of tasks to be submtted |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | */
prvate vod submtStandByTask() {
try {
nt length = readyToSubmtTaskQueue.sze();
for (nt = 0; < length; ++) {
TaskInstance task = readyToSubmtTaskQueue.peek();
f (task == null) {
contnue;
}
// stop ta
f (task.taskCanRetry()) {
TaskInstance retryTask = processServce.fndTaskInstanceById(task.getId());
f (retryTask != null && retryTask.getState().equals(ExecutonStatus.FORCED_SUCCESS)) {
task.setState(retryTask.getState());
logger.nfo("task: {} has been forced success, put t nto complete task lst and stop retryng", task.getName());
removeTaskFromStandbyLst(task);
completeTaskMap.put(Long.toStrng(task.getTaskCode()), task.getId());
taskInstanceMap.put(task.getId(), task);
submtPostNode(Long.toStrng(task.getTaskCode()));
contnue;
}
}
//nt var
f (task.sFrstRun()) {
//get pre
Set<Strng> preTask = dag.getPrevousNodes(Long.toStrng(task.getTaskCode()));
getPreVarPool(task, preTask);
}
DependResult dependResult = getDependResultForTask(task);
f (DependResult.SUCCESS == dependResult) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | f (task.retryTaskIntervalOverTme()) {
nt orgnalId = task.getId();
TaskInstance taskInstance = submtTaskExec(task);
f (taskInstance == null) {
ths.taskFaledSubmt = true;
} else {
removeTaskFromStandbyLst(task);
f (taskInstance.getId() != orgnalId) {
actveTaskProcessorMaps.remove(orgnalId);
}
}
}
} else f (DependResult.FAILED == dependResult) {
// f the
dependFaledTaskMap.put(Long.toStrng(task.getTaskCode()), task.getId());
removeTaskFromStandbyLst(task);
logger.nfo("task {},d:{} depend result : {}", task.getName(), task.getId(), dependResult);
} else f (DependResult.NON_EXEC == dependResult) {
// for som
removeTaskFromStandbyLst(task);
logger.nfo("remove task {},d:{} , because depend result : {}", task.getName(), task.getId(), dependResult);
}
}
} catch (Excepton e) {
logger.error("submt standby task error", e);
}
}
/**
* get recovery task nstance
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | * @param taskId task d
* @return recovery task nstance
*/
prvate TaskInstance getRecoveryTaskInstance(Strng taskId) {
f (!StrngUtls.sNotEmpty(taskId)) {
return null;
}
try {
Integer ntId = Integer.valueOf(taskId);
TaskInstance task = processServce.fndTaskInstanceById(ntId);
f (task == null) {
logger.error("start node d cannot be found: {}", taskId);
} else {
return task;
}
} catch (Excepton e) {
logger.error("get recovery task nstance faled ", e);
}
return null;
}
/**
* get start task nstance lst
*
* @param cmdParam command param
* @return task nstance lst
*/
prvate Lst<TaskInstance> getStartTaskInstanceLst(Strng cmdParam) {
Lst<TaskInstance> nstanceLst = new ArrayLst<>();
Map<Strng, Strng> paramMap = JSONUtls.toMap(cmdParam);
f (paramMap != null && paramMap.contansKey(CMD_PARAM_RECOVERY_START_NODE_STRING)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,037 | [Bug] [Data Supplement] process instance can not be killed. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
Not only did it not stop, it also restart the same task instance.
### What you expected to happen
stopping process instance successfully.
### How to reproduce
Starting a job with data supplement in proccess definition ui.
Stopping process instance with stop button in process instance list ui.
### Anything else
_No response_
### Version
2.0.0
### Are you willing to submit 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/7037 | https://github.com/apache/dolphinscheduler/pull/7140 | 3361d763c4af1b387602dfc97a5a57961b5a7c43 | d83735ab5191f37bfb90b9cb3d534386f7792fbf | "2021-11-29T07:07:51Z" | java | "2021-12-05T07:03:52Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | Strng[] dLst = paramMap.get(CMD_PARAM_RECOVERY_START_NODE_STRING).splt(Constants.COMMA);
for (Strng nodeId : dLst) {
TaskInstance task = getRecoveryTaskInstance(nodeId);
f (task != null) {
nstanceLst.add(task);
}
}
}
return nstanceLst;
}
/**
* parse "StartNodeNameLst" from cmd param
*
* @param cmdParam command param
* @return start node name lst
*/
prvate Lst<Strng> parseStartNodeName(Strng cmdParam) {
Lst<Strng> startNodeNameLst = new ArrayLst<>();
Map<Strng, Strng> paramMap = JSONUtls.toMap(cmdParam);
f (paramMap == null) {
return startNodeNameLst;
}
f (paramMap.contansKey(CMD_PARAM_START_NODES)) {
startNodeNameLst = Arrays.asLst(paramMap.get(CMD_PARAM_START_NODES).splt(Constants.COMMA));
}
return startNodeNameLst;
}
/**
* generate start node code lst from parsng command param;
* f "StartNodeIdLst" exsts n command param, return StartNodeIdLst |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.