status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
233
body
stringlengths
0
186k
issue_url
stringlengths
38
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
timestamp[us, tz=UTC]
language
stringclasses
5 values
commit_datetime
timestamp[us, tz=UTC]
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
childList.add(resource.getId()); } if (resource.isDirectory()) { listAllChildren(resource.getId(), childList); } return childList; } /** * list all children id * * @param resourceId resource id * @param childList child list */ void listAllChildren(int resourceId, List<Integer> childList) { List<Integer> children = resourcesMapper.listChildren(resourceId); for (int childId : children) { childList.add(childId); listAllChildren(childId, childList); } } /** * query authored resource list (own and authorized) * * @param loginUser login user * @param type ResourceType * @return all authored resource list */ private List<Resource> queryAuthoredResourceList(User loginUser, ResourceType type) { List<Resource> relationResources; int userId = loginUser.getId();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
if (isAdmin(loginUser)) { userId = 0; relationResources = new ArrayList<>(); } else { relationResources = queryResourceList(userId, 0); } List<Resource> relationTypeResources = relationResources.stream().filter(rs -> rs.getType() == type).collect(Collectors.toList()); List<Resource> ownResourceList = resourcesMapper.queryResourceListAuthored(userId, type.ordinal()); ownResourceList.addAll(relationTypeResources); return ownResourceList; } /** * query resource list by userId and perm * * @param userId userId * @param perm perm * @return resource list */ private List<Resource> queryResourceList(Integer userId, int perm) { List<Integer> resIds = resourceUserMapper.queryResourcesIdListByUserIdAndPerm(userId, perm); return CollectionUtils.isEmpty(resIds) ? new ArrayList<>() : resourcesMapper.queryResourceListById(resIds); } private AuthorizationType checkResourceType(ResourceType type) { return type.equals(ResourceType.FILE) ? AuthorizationType.RESOURCE_FILE_ID : AuthorizationType.UDF_FILE; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.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.impl; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.TenantService; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.RegexUtils; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java
import org.apache.dolphinscheduler.common.enums.AuthorizationType; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.storage.StorageOperate; import org.apache.dolphinscheduler.common.utils.PropertyUtils; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper; import org.apache.dolphinscheduler.dao.mapper.TenantMapper; import org.apache.dolphinscheduler.dao.mapper.UserMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.*; import static org.apache.dolphinscheduler.common.Constants.TENANT_FULL_NAME_MAX_LENGTH; /** * tenant service impl */ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java
public class TenantServiceImpl extends BaseServiceImpl implements TenantService { private static final Logger logger = LoggerFactory.getLogger(TenantServiceImpl.class); @Autowired private TenantMapper tenantMapper; @Autowired private ProcessInstanceMapper processInstanceMapper; @Autowired private ProcessDefinitionMapper processDefinitionMapper; @Autowired private UserMapper userMapper; @Autowired(required = false) private StorageOperate storageOperate; /** * create tenant *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java
* @param loginUser login user * @param tenantCode tenant code * @param queueId queue id * @param desc description * @return create result code * @throws Exception exception */ @Override @Transactional(rollbackFor = Exception.class) public Map<String, Object> createTenant(User loginUser, String tenantCode, int queueId, String desc) throws Exception { Map<String, Object> result = new HashMap<>(); result.put(Constants.STATUS, false); if (!canOperatorPermissions(loginUser,null, AuthorizationType.TENANT, TENANT_CREATE)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } if(StringUtils.length(tenantCode) > TENANT_FULL_NAME_MAX_LENGTH){ putMsg(result, Status.TENANT_FULL_NAME_TOO_LONG_ERROR); return result; } if (!RegexUtils.isValidLinuxUserName(tenantCode)) { putMsg(result, Status.CHECK_OS_TENANT_CODE_ERROR); return result; } if (checkTenantExists(tenantCode)) { putMsg(result, Status.OS_TENANT_CODE_EXIST, tenantCode); return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java
} Tenant tenant = new Tenant(); Date now = new Date(); tenant.setTenantCode(tenantCode); tenant.setQueueId(queueId); tenant.setDescription(desc); tenant.setCreateTime(now); tenant.setUpdateTime(now); tenantMapper.insert(tenant); if (PropertyUtils.getResUploadStartupState()) { storageOperate.createTenantDirIfNotExists(tenantCode); } result.put(Constants.DATA_LIST, tenant); putMsg(result, Status.SUCCESS); permissionPostHandle(AuthorizationType.TENANT, loginUser.getId(), Collections.singletonList(tenant.getId()),logger); return result; } /** * query tenant list paging * * @param loginUser login user * @param searchVal search value * @param pageNo page number * @param pageSize page size * @return tenant list page */ @Override public Result<Object> queryTenantList(User loginUser, String searchVal, Integer pageNo, Integer pageSize) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java
Result<Object> result = new Result<>(); if (!canOperatorPermissions(loginUser,null,AuthorizationType.TENANT,TENANT_MANAGER)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } Page<Tenant> page = new Page<>(pageNo, pageSize); IPage<Tenant> tenantPage = tenantMapper.queryTenantPaging(page, searchVal); PageInfo<Tenant> pageInfo = new PageInfo<>(pageNo, pageSize); pageInfo.setTotal((int) tenantPage.getTotal()); pageInfo.setTotalList(tenantPage.getRecords()); result.setData(pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * updateProcessInstance tenant * * @param loginUser login user * @param id tenant id * @param tenantCode tenant code * @param queueId queue id * @param desc description * @return update result code * @throws Exception exception */ @Override public Map<String, Object> updateTenant(User loginUser, int id, String tenantCode, int queueId, String desc) throws Exception { Map<String, Object> result = new HashMap<>(); result.put(Constants.STATUS, false);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java
if (!canOperatorPermissions(loginUser,null, AuthorizationType.TENANT,TENANT_UPDATE)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } Tenant tenant = tenantMapper.queryById(id); if (tenant == null) { putMsg(result, Status.TENANT_NOT_EXIST); return result; } /** * if the tenant code is modified, the original resource needs to be copied to the new tenant. */ if (!tenant.getTenantCode().equals(tenantCode)) { if (checkTenantExists(tenantCode)) { if (PropertyUtils.getResUploadStartupState()) { storageOperate.createTenantDirIfNotExists(tenantCode); } } else { putMsg(result, Status.OS_TENANT_CODE_HAS_ALREADY_EXISTS); return result; } } Date now = new Date(); if (!StringUtils.isEmpty(tenantCode)) { tenant.setTenantCode(tenantCode); } if (queueId != 0) { tenant.setQueueId(queueId);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java
} tenant.setDescription(desc); tenant.setUpdateTime(now); tenantMapper.updateById(tenant); result.put(Constants.STATUS, Status.SUCCESS); result.put(Constants.MSG, Status.SUCCESS.getMsg()); return result; } /** * delete tenant * * @param loginUser login user * @param id tenant id * @return delete result code * @throws Exception exception */ @Override @Transactional(rollbackFor = Exception.class) public Map<String, Object> deleteTenantById(User loginUser, int id) throws Exception { Map<String, Object> result = new HashMap<>(); if (!canOperatorPermissions(loginUser,null, AuthorizationType.TENANT,TENANT_DELETE)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } Tenant tenant = tenantMapper.queryById(id); if (tenant == null) { putMsg(result, Status.TENANT_NOT_EXIST); return result; } List<ProcessInstance> processInstances = getProcessInstancesByTenant(tenant);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java
if (CollectionUtils.isNotEmpty(processInstances)) { putMsg(result, Status.DELETE_TENANT_BY_ID_FAIL, processInstances.size()); return result; } List<ProcessDefinition> processDefinitions = processDefinitionMapper.queryDefinitionListByTenant(tenant.getId()); if (CollectionUtils.isNotEmpty(processDefinitions)) { putMsg(result, Status.DELETE_TENANT_BY_ID_FAIL_DEFINES, processDefinitions.size()); return result; } List<User> userList = userMapper.queryUserListByTenant(tenant.getId()); if (CollectionUtils.isNotEmpty(userList)) { putMsg(result, Status.DELETE_TENANT_BY_ID_FAIL_USERS, userList.size()); return result; } if (PropertyUtils.getResUploadStartupState()) { storageOperate.deleteTenant(tenant.getTenantCode()); } tenantMapper.deleteById(id); processInstanceMapper.updateProcessInstanceByTenantId(id, -1); putMsg(result, Status.SUCCESS); return result; } private List<ProcessInstance> getProcessInstancesByTenant(Tenant tenant) { return processInstanceMapper.queryByTenantIdAndStatus(tenant.getId(), Constants.NOT_TERMINATED_STATES); } /** * query tenant list *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java
* @param loginUser login user * @return tenant list */ @Override public Map<String, Object> queryTenantList(User loginUser) { Map<String, Object> result = new HashMap<>(); if (!canOperatorPermissions(loginUser,null,AuthorizationType.TENANT,TENANT_MANAGER)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } List<Tenant> resourceList = tenantMapper.selectList(null); result.put(Constants.DATA_LIST, resourceList); putMsg(result, Status.SUCCESS); return result; } /** * verify tenant code * * @param tenantCode tenant code * @return true if tenant code can user, otherwise return false */ @Override public Result<Object> verifyTenantCode(String tenantCode) { Result<Object> result = new Result<>(); if (checkTenantExists(tenantCode)) { putMsg(result, Status.OS_TENANT_CODE_EXIST, tenantCode); } else { putMsg(result, Status.SUCCESS); } return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java
} /** * check tenant exists * * @param tenantCode tenant code * @return ture if the tenant code exists, otherwise return false */ @Override public boolean checkTenantExists(String tenantCode) { Boolean existTenant = tenantMapper.existTenant(tenantCode); return Boolean.TRUE.equals(existTenant); } /** * query tenant by tenant code * * @param tenantCode tenant code * @return tenant detail information */ @Override public Map<String, Object> queryByTenantCode(String tenantCode) { Map<String, Object> result = new HashMap<>(); Tenant tenant = tenantMapper.queryByTenantCode(tenantCode); if (tenant != null) { result.put(Constants.DATA_LIST, tenant); putMsg(result, Status.SUCCESS); } return result; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.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.eq; import org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.impl.BaseServiceImpl; import org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl; 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.AuthorizationType; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.storage.StorageOperate; import org.apache.dolphinscheduler.common.utils.FileUtils;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
import org.apache.dolphinscheduler.common.utils.PropertyUtils; import org.apache.dolphinscheduler.dao.entity.Resource; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.UdfFunc; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; 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.UdfFuncMapper; import org.apache.dolphinscheduler.dao.mapper.UserMapper; import org.apache.dolphinscheduler.service.permission.ResourcePermissionCheckService; import org.apache.dolphinscheduler.spi.enums.ResourceType; import org.apache.commons.collections.CollectionUtils; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Random; import java.util.Set; 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;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.mock.web.MockMultipartFile; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.io.Files; /** * resources service test */ @RunWith(PowerMockRunner.class) @PowerMockIgnore({"sun.security.*", "javax.net.*"}) @PrepareForTest({PropertyUtils.class, FileUtils.class, org.apache.dolphinscheduler.api.utils.FileUtils.class, Files.class}) public class ResourcesServiceTest { private static final Logger logger = LoggerFactory.getLogger(ResourcesServiceTest.class); @InjectMocks private ResourcesServiceImpl resourcesService; @Mock private ResourceMapper resourcesMapper; @Mock private TenantMapper tenantMapper; @Mock private StorageOperate storageOperate; @Mock
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
private UserMapper userMapper; @Mock private UdfFuncMapper udfFunctionMapper; @Mock private ProcessDefinitionMapper processDefinitionMapper; @Mock private ResourceUserMapper resourceUserMapper; @Mock private ResourcePermissionCheckService resourcePermissionCheckService; private static final Logger serviceLogger = LoggerFactory.getLogger(BaseServiceImpl.class); private static final Logger resourceLogger = LoggerFactory.getLogger(ResourcesServiceImpl.class); @Before public void setUp() { PowerMockito.mockStatic(FileUtils.class); PowerMockito.mockStatic(Files.class); PowerMockito.mockStatic(org.apache.dolphinscheduler.api.utils.FileUtils.class); try { } catch (Exception e) { e.printStackTrace(); } PowerMockito.mockStatic(PropertyUtils.class); } @Test public void testCreateResource() { PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 1, ApiFuncIdentificationConstant.FILE_ONLINE_CREATE, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, null, 1, serviceLogger)).thenReturn(true); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(false);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
User user = new User(); user.setId(1); user.setUserType(UserType.GENERAL_USER); MockMultipartFile mockMultipartFile = new MockMultipartFile("test.pdf", "test.pdf", "pdf", "test".getBytes()); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); Mockito.when(userMapper.selectById(1)).thenReturn(getUser()); Mockito.when(tenantMapper.queryById(1)).thenReturn(null); Result result = resourcesService.createResource(user, "ResourcesServiceTest", "ResourcesServiceTest", ResourceType.FILE, mockMultipartFile, -1, "/"); logger.info(result.toString()); Assert.assertEquals(Status.CURRENT_LOGIN_USER_TENANT_NOT_EXIST.getMsg(), result.getMsg()); user.setTenantId(1); Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant()); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(false); result = resourcesService.createResource(user, "ResourcesServiceTest", "ResourcesServiceTest", ResourceType.FILE, null, -1, "/"); logger.info(result.toString()); Assert.assertEquals(Status.STORAGE_NOT_STARTUP.getMsg(), result.getMsg()); mockMultipartFile = new MockMultipartFile("test.pdf", "".getBytes()); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); result = resourcesService.createResource(user, "ResourcesServiceTest", "ResourcesServiceTest", ResourceType.FILE, mockMultipartFile, -1, "/"); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_FILE_IS_EMPTY.getMsg(), result.getMsg()); mockMultipartFile = new MockMultipartFile("test.pdf", "test.pdf", "pdf", "test".getBytes()); PowerMockito.when(Files.getFileExtension("test.pdf")).thenReturn("pdf"); PowerMockito.when(Files.getFileExtension("ResourcesServiceTest.jar")).thenReturn("jar"); result = resourcesService.createResource(user, "ResourcesServiceTest.jar", "ResourcesServiceTest", ResourceType.FILE, mockMultipartFile, -1, "/");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_SUFFIX_FORBID_CHANGE.getMsg(), result.getMsg()); PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 1, ApiFuncIdentificationConstant.UDF_FOLDER_ONLINE_CREATE, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, null, 1, serviceLogger)).thenReturn(true); mockMultipartFile = new MockMultipartFile("ResourcesServiceTest.pdf", "ResourcesServiceTest.pdf", "pdf", "test".getBytes()); PowerMockito.when(Files.getFileExtension("ResourcesServiceTest.pdf")).thenReturn("pdf"); result = resourcesService.createResource(user, "ResourcesServiceTest.pdf", "ResourcesServiceTest", ResourceType.UDF, mockMultipartFile, -1, "/"); logger.info(result.toString()); Assert.assertEquals(Status.UDF_RESOURCE_SUFFIX_NOT_JAR.getMsg(), result.getMsg()); PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 1, ApiFuncIdentificationConstant.FILE_ONLINE_CREATE, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, null, 1, serviceLogger)).thenReturn(true); String tooLongFileName = getRandomStringWithLength(Constants.RESOURCE_FULL_NAME_MAX_LENGTH) + ".pdf"; mockMultipartFile = new MockMultipartFile(tooLongFileName, tooLongFileName, "pdf", "test".getBytes()); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); PowerMockito.when(Files.getFileExtension(tooLongFileName)).thenReturn("pdf"); result = resourcesService.createResource(user, tooLongFileName, tooLongFileName, ResourceType.FILE, mockMultipartFile, -1, "/"); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_FULL_NAME_TOO_LONG_ERROR.getMsg(), result.getMsg()); } @Test public void testCreateDirecotry() { PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 1, ApiFuncIdentificationConstant.FOLDER_ONLINE_CREATE, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, null, 1, serviceLogger)).thenReturn(true); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(false); User user = new User(); user.setId(1); user.setUserType(UserType.GENERAL_USER);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
Result result = resourcesService.createDirectory(user, "directoryTest", "directory test", ResourceType.FILE, -1, "/"); logger.info(result.toString()); Assert.assertEquals(Status.STORAGE_NOT_STARTUP.getMsg(), result.getMsg()); user.setId(1); user.setTenantId(1); Mockito.when(userMapper.selectById(1)).thenReturn(getUser()); Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant()); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); Mockito.when(resourcesMapper.selectById(Mockito.anyInt())).thenReturn(null); PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 1, ApiFuncIdentificationConstant.FOLDER_ONLINE_CREATE, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, null, 1, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 1, ApiFuncIdentificationConstant.FILE_RENAME, serviceLogger)).thenReturn(true); result = resourcesService.createDirectory(user, "directoryTest", "directory test", ResourceType.FILE, 1, "/"); logger.info(result.toString()); Assert.assertEquals(Status.PARENT_RESOURCE_NOT_EXIST.getMsg(), result.getMsg()); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); Mockito.when(resourcesMapper.existResource("/directoryTest", 0)).thenReturn(true); result = resourcesService.createDirectory(user, "directoryTest", "directory test", ResourceType.FILE, -1, "/"); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_EXIST.getMsg(), result.getMsg()); } @Test public void testUpdateResource() { PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 1, ApiFuncIdentificationConstant.FILE_UPDATE, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, new Object[]{1}, 1, serviceLogger)).thenReturn(true); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(false); User user = new User(); user.setId(1);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
user.setUserType(UserType.GENERAL_USER); Result result = resourcesService.updateResource(user, 1, "ResourcesServiceTest", "ResourcesServiceTest", ResourceType.FILE, null); logger.info(result.toString()); Assert.assertEquals(Status.STORAGE_NOT_STARTUP.getMsg(), result.getMsg()); PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 1, ApiFuncIdentificationConstant.FILE_UPDATE, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, new Object[]{0}, 1, serviceLogger)).thenReturn(true); Mockito.when(resourcesMapper.selectById(1)).thenReturn(getResource()); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); result = resourcesService.updateResource(user, 0, "ResourcesServiceTest", "ResourcesServiceTest", ResourceType.FILE, null); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_NOT_EXIST.getMsg(), result.getMsg()); user.setId(2); user.setUserType(UserType.GENERAL_USER); PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 2, ApiFuncIdentificationConstant.FILE_UPDATE, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, new Object[]{1}, 2, serviceLogger)).thenReturn(true); result = resourcesService.updateResource(user, 1, "ResourcesServiceTest", "ResourcesServiceTest", ResourceType.FILE, null); logger.info(result.toString()); Assert.assertEquals(Status.USER_NO_OPERATION_PERM.getMsg(), result.getMsg()); user.setId(1); Mockito.when(userMapper.selectById(1)).thenReturn(getUser()); Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant()); PowerMockito.when(storageOperate.getFileName(Mockito.any(), Mockito.any(), Mockito.anyString())).thenReturn("test1"); PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.UDF_FILE, 1, ApiFuncIdentificationConstant.UDF_UPDATE, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.UDF_FILE, new Object[]{1}, 1, serviceLogger)).thenReturn(true); try { Mockito.when(storageOperate.exists(Mockito.any(), Mockito.any())).thenReturn(false);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
} catch (IOException e) { logger.error(e.getMessage(), e); } result = resourcesService.updateResource(user, 1, "ResourcesServiceTest1.jar", "ResourcesServiceTest", ResourceType.UDF, null); Assert.assertEquals(Status.RESOURCE_NOT_EXIST.getMsg(), result.getMsg()); user.setId(1); Mockito.when(userMapper.queryDetailsById(1)).thenReturn(getUser()); Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant()); try { Mockito.when(storageOperate.exists(Mockito.any(), Mockito.any())).thenReturn(true); } catch (IOException e) { logger.error(e.getMessage(), e); } PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 1, ApiFuncIdentificationConstant.FILE_UPDATE, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, new Object[]{1}, 1, serviceLogger)).thenReturn(true); result = resourcesService.updateResource(user, 1, "ResourcesServiceTest.jar", "ResourcesServiceTest", ResourceType.FILE, null); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS.getMsg(), result.getMsg()); Mockito.when(resourcesMapper.existResource("/ResourcesServiceTest1.jar", 0)).thenReturn(true); result = resourcesService.updateResource(user, 1, "ResourcesServiceTest1.jar", "ResourcesServiceTest", ResourceType.FILE, null); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_EXIST.getMsg(), result.getMsg()); PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 1, ApiFuncIdentificationConstant.UDF_UPDATE, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, new Object[]{1}, 1, serviceLogger)).thenReturn(true); Mockito.when(userMapper.selectById(Mockito.anyInt())).thenReturn(null); result = resourcesService.updateResource(user, 1, "ResourcesServiceTest1.jar", "ResourcesServiceTest", ResourceType.UDF, null); logger.info(result.toString());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
Assert.assertTrue(Status.USER_NOT_EXIST.getCode() == result.getCode()); Mockito.when(userMapper.selectById(1)).thenReturn(getUser()); Mockito.when(tenantMapper.queryById(Mockito.anyInt())).thenReturn(null); result = resourcesService.updateResource(user, 1, "ResourcesServiceTest1.jar", "ResourcesServiceTest", ResourceType.UDF, null); logger.info(result.toString()); Assert.assertEquals(Status.CURRENT_LOGIN_USER_TENANT_NOT_EXIST.getMsg(), result.getMsg()); Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant()); PowerMockito.when(storageOperate.getResourceFileName(Mockito.any(), Mockito.any())).thenReturn("test"); try { } catch (Exception e) { logger.error(e.getMessage(), e); } result = resourcesService.updateResource(user, 1, "ResourcesServiceTest1.jar", "ResourcesServiceTest1.jar", ResourceType.UDF, null); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS.getMsg(), result.getMsg()); } @Test public void testQueryResourceListPaging() { User loginUser = new User(); loginUser.setId(1); loginUser.setUserType(UserType.ADMIN_USER); IPage<Resource> resourcePage = new Page<>(1, 10); resourcePage.setTotal(1); resourcePage.setRecords(getResourceList()); PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 1, ApiFuncIdentificationConstant.FILE_VIEW, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, null, 0, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.RESOURCE_FILE_ID, 1, resourceLogger)).thenReturn(getSetIds());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
Mockito.when(resourcesMapper.queryResourcePaging(Mockito.any(Page.class), eq(-1), eq(0), eq(1), eq("test"), Mockito.any())).thenReturn(resourcePage); Result result = resourcesService.queryResourceListPaging(loginUser, -1, ResourceType.FILE, "test", 1, 10); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS.getCode(), (int) result.getCode()); PageInfo pageInfo = (PageInfo) result.getData(); Assert.assertTrue(CollectionUtils.isNotEmpty(pageInfo.getTotalList())); } @Test public void testQueryResourceList() { User loginUser = new User(); loginUser.setId(0); loginUser.setUserType(UserType.ADMIN_USER); PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 0, ApiFuncIdentificationConstant.FILE_VIEW, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, null, 0, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.RESOURCE_FILE_ID, 0, serviceLogger)).thenReturn(getSetIds()); Mockito.when(resourcesMapper.queryResourceListAuthored(0, 0)).thenReturn(getResourceList()); Map<String, Object> result = resourcesService.queryResourceList(loginUser, ResourceType.FILE); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); List<Resource> resourceList = (List<Resource>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(resourceList)); PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 0, ApiFuncIdentificationConstant.UDF_FILE_VIEW, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, null, 0, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.RESOURCE_FILE_ID, 0, serviceLogger)).thenReturn(getSetIds()); loginUser.setUserType(UserType.GENERAL_USER); Mockito.when(resourceUserMapper.queryResourcesIdListByUserIdAndPerm(0, 0)) .thenReturn(Arrays.asList(Integer.valueOf(10), Integer.valueOf(11))); Mockito.when(resourcesMapper.queryResourceListById(Arrays.asList(Integer.valueOf(10), Integer.valueOf(11)))) .thenReturn(Arrays.asList(getResource(10, ResourceType.FILE), getResource(11, ResourceType.UDF)));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
Mockito.when(resourcesMapper.queryResourceListAuthored(0, 1)).thenReturn(getResourceList()); result = resourcesService.queryResourceList(loginUser, ResourceType.UDF); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); resourceList = (List<Resource>) result.get(Constants.DATA_LIST); Assert.assertTrue(resourceList.size() == 4); } @Test public void testDelete() { User loginUser = new User(); loginUser.setId(0); loginUser.setUserType(UserType.GENERAL_USER); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(false); Mockito.when(resourcesMapper.selectById(1)).thenReturn(getResource()); Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant()); PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 0, ApiFuncIdentificationConstant.FILE_DELETE, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, new Object[]{1}, 0, serviceLogger)).thenReturn(true); try { Result result = resourcesService.delete(loginUser, 1); logger.info(result.toString()); Assert.assertEquals(Status.STORAGE_NOT_STARTUP.getMsg(), result.getMsg()); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); Mockito.when(resourcesMapper.selectById(1)).thenReturn(getResource()); PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 0, ApiFuncIdentificationConstant.FILE_DELETE, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, new Object[]{2}, 0, serviceLogger)).thenReturn(true); result = resourcesService.delete(loginUser, 2); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_NOT_EXIST.getMsg(), result.getMsg());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
result = resourcesService.delete(loginUser, 2); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_NOT_EXIST.getMsg(), result.getMsg()); loginUser.setUserType(UserType.ADMIN_USER); loginUser.setTenantId(2); Mockito.when(userMapper.selectById(Mockito.anyInt())).thenReturn(loginUser); PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 0, ApiFuncIdentificationConstant.FILE_DELETE, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, new Object[]{1}, 0, serviceLogger)).thenReturn(true); result = resourcesService.delete(loginUser, 1); logger.info(result.toString()); Assert.assertEquals(Status.CURRENT_LOGIN_USER_TENANT_NOT_EXIST.getMsg(), result.getMsg()); loginUser.setTenantId(1); Mockito.when(storageOperate.delete(Mockito.any(), Mockito.anyString(), Mockito.anyBoolean())).thenReturn(true); Mockito.when(processDefinitionMapper.listResources()).thenReturn(getResources()); Mockito.when(resourcesMapper.deleteIds(Mockito.any())).thenReturn(1); Mockito.when(resourceUserMapper.deleteResourceUserArray(Mockito.anyInt(), Mockito.any())).thenReturn(1); result = resourcesService.delete(loginUser, 1); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS.getMsg(), result.getMsg()); } catch (Exception e) { logger.error("delete error", e); Assert.assertTrue(false); } } @Test public void testVerifyResourceName() { PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 1, ApiFuncIdentificationConstant.FILE_RENAME, serviceLogger)).thenReturn(true);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, null, 1, serviceLogger)).thenReturn(true); User user = new User(); user.setId(1); user.setUserType(UserType.GENERAL_USER); Mockito.when(resourcesMapper.existResource("/ResourcesServiceTest.jar", 0)).thenReturn(true); Result result = resourcesService.verifyResourceName("/ResourcesServiceTest.jar", ResourceType.FILE, user); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_EXIST.getMsg(), result.getMsg()); Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant()); String unExistFullName = "/test.jar"; try { Mockito.when(storageOperate.exists(Mockito.anyString(), eq(unExistFullName))).thenReturn(false); } catch (IOException e) { logger.error("hadoop error", e); } result = resourcesService.verifyResourceName("/test.jar", ResourceType.FILE, user); logger.info(result.toString()); Assert.assertEquals(Status.CURRENT_LOGIN_USER_TENANT_NOT_EXIST.getMsg(), result.getMsg()); user.setTenantId(1); try { Mockito.when(storageOperate.exists(Mockito.any(), eq("test"))).thenReturn(true); } catch (IOException e) { logger.error("hadoop error", e); } PowerMockito.when(storageOperate.getResourceFileName("123", "test1")).thenReturn("test"); result = resourcesService.verifyResourceName("/ResourcesServiceTest.jar", ResourceType.FILE, user); logger.info(result.toString()); Assert.assertTrue(Status.RESOURCE_EXIST.getCode() == result.getCode());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
result = resourcesService.verifyResourceName("test2", ResourceType.FILE, user); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS.getMsg(), result.getMsg()); } @Test public void testReadResource() { PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 1, ApiFuncIdentificationConstant.FILE_VIEW, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, new Object[]{1}, 1, serviceLogger)).thenReturn(true); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(false); Result result = resourcesService.readResource(getUser(), 1, 1, 10); logger.info(result.toString()); Assert.assertEquals(Status.STORAGE_NOT_STARTUP.getMsg(), result.getMsg()); Mockito.when(resourcesMapper.selectById(1)).thenReturn(getResource()); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 1, ApiFuncIdentificationConstant.FILE_VIEW, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, new Object[]{2}, 1, serviceLogger)).thenReturn(true); result = resourcesService.readResource(getUser(), 2, 1, 10); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_NOT_EXIST.getMsg(), result.getMsg()); PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 1, ApiFuncIdentificationConstant.FILE_VIEW, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, new Object[]{1}, 1, serviceLogger)).thenReturn(true); PowerMockito.when(FileUtils.getResourceViewSuffixes()).thenReturn("class"); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); result = resourcesService.readResource(getUser(), 1, 1, 10); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_SUFFIX_NOT_SUPPORT_VIEW.getMsg(), result.getMsg());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
PowerMockito.when(FileUtils.getResourceViewSuffixes()).thenReturn("jar"); PowerMockito.when(Files.getFileExtension("ResourcesServiceTest.jar")).thenReturn("jar"); result = resourcesService.readResource(getUser(), 1, 1, 10); logger.info(result.toString()); Assert.assertEquals(Status.USER_NOT_EXIST.getCode(), (int) result.getCode()); Mockito.when(userMapper.selectById(1)).thenReturn(getUser()); result = resourcesService.readResource(getUser(), 1, 1, 10); logger.info(result.toString()); Assert.assertEquals(Status.CURRENT_LOGIN_USER_TENANT_NOT_EXIST.getMsg(), result.getMsg()); Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant()); try { Mockito.when(storageOperate.exists(Mockito.any(), Mockito.anyString())).thenReturn(false); } catch (IOException e) { logger.error("hadoop error", e); } result = resourcesService.readResource(getUser(), 1, 1, 10); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_FILE_NOT_EXIST.getCode(), (int) result.getCode()); try { Mockito.when(storageOperate.exists(Mockito.any(), Mockito.any())).thenReturn(true); Mockito.when(storageOperate.vimFile(Mockito.any(), Mockito.any(), eq(1), eq(10))).thenReturn(getContent()); } catch (IOException e) { logger.error("storage error", e); } result = resourcesService.readResource(getUser(), 1, 1, 10); logger.info(result.toString());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
Assert.assertEquals(Status.SUCCESS.getMsg(), result.getMsg()); } @Test public void testOnlineCreateResource() { PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 1, ApiFuncIdentificationConstant.FILE_ONLINE_CREATE, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, null, 1, serviceLogger)).thenReturn(true); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(false); PowerMockito.when(storageOperate.getResourceFileName(Mockito.anyString(), eq("hdfsdDir"))).thenReturn("hdfsDir"); PowerMockito.when(storageOperate.getUdfDir("udfDir")).thenReturn("udfDir"); User user = getUser(); user.setId(1); Result result = resourcesService.onlineCreateResource(user, ResourceType.FILE, "test", "jar", "desc", "content", -1, "/"); logger.info(result.toString()); Assert.assertEquals(Status.STORAGE_NOT_STARTUP.getMsg(), result.getMsg()); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); PowerMockito.when(FileUtils.getResourceViewSuffixes()).thenReturn("class"); result = resourcesService.onlineCreateResource(user, ResourceType.FILE, "test", "jar", "desc", "content", -1, "/"); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_SUFFIX_NOT_SUPPORT_VIEW.getMsg(), result.getMsg()); try { PowerMockito.when(FileUtils.getResourceViewSuffixes()).thenReturn("jar"); Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant()); result = resourcesService.onlineCreateResource(user, ResourceType.FILE, "test", "jar", "desc", "content", -1, "/"); } catch (RuntimeException ex) { logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_NOT_EXIST.getMsg(), ex.getMessage()); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 1, ApiFuncIdentificationConstant.FILE_RENAME, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, null, 1, serviceLogger)).thenReturn(true); Mockito.when(FileUtils.getUploadFilename(Mockito.anyString(), Mockito.anyString())).thenReturn("test"); PowerMockito.when(FileUtils.writeContent2File(Mockito.anyString(), Mockito.anyString())).thenReturn(true); result = resourcesService.onlineCreateResource(user, ResourceType.FILE, "test", "jar", "desc", "content", -1, "/"); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS.getMsg(), result.getMsg()); } @Test public void testUpdateResourceContent() { PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(false); PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 1, ApiFuncIdentificationConstant.FILE_UPDATE, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, new Object[]{1}, 1, serviceLogger)).thenReturn(true); Result result = resourcesService.updateResourceContent(getUser(), 1, "content"); logger.info(result.toString()); Assert.assertEquals(Status.STORAGE_NOT_STARTUP.getMsg(), result.getMsg()); PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 1, ApiFuncIdentificationConstant.FILE_UPDATE, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, new Object[]{2}, 1, serviceLogger)).thenReturn(true); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); Mockito.when(resourcesMapper.selectById(1)).thenReturn(getResource()); result = resourcesService.updateResourceContent(getUser(), 2, "content"); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_NOT_EXIST.getMsg(), result.getMsg()); PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 1, ApiFuncIdentificationConstant.FILE_UPDATE, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, new Object[]{1}, 1, serviceLogger)).thenReturn(true); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
PowerMockito.when(FileUtils.getResourceViewSuffixes()).thenReturn("class"); result = resourcesService.updateResourceContent(getUser(), 1, "content"); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_SUFFIX_NOT_SUPPORT_VIEW.getMsg(), result.getMsg()); PowerMockito.when(FileUtils.getResourceViewSuffixes()).thenReturn("jar"); PowerMockito.when(Files.getFileExtension("ResourcesServiceTest.jar")).thenReturn("jar"); result = resourcesService.updateResourceContent(getUser(), 1, "content"); logger.info(result.toString()); Assert.assertTrue(Status.USER_NOT_EXIST.getCode() == result.getCode()); Mockito.when(userMapper.selectById(1)).thenReturn(getUser()); result = resourcesService.updateResourceContent(getUser(), 1, "content"); logger.info(result.toString()); Assert.assertTrue(Status.CURRENT_LOGIN_USER_TENANT_NOT_EXIST.getCode() == result.getCode()); Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant()); Mockito.when(FileUtils.getUploadFilename(Mockito.anyString(), Mockito.anyString())).thenReturn("test"); PowerMockito.when(FileUtils.writeContent2File(Mockito.anyString(), Mockito.anyString())).thenReturn(true); result = resourcesService.updateResourceContent(getUser(), 1, "content"); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS.getMsg(), result.getMsg()); } @Test public void testDownloadResource() { PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.RESOURCE_FILE_ID, 1, ApiFuncIdentificationConstant.FILE_DOWNLOAD, serviceLogger)).thenReturn(true); Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.RESOURCE_FILE_ID, new Object[]{1}, 1, serviceLogger)).thenReturn(true); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant()); Mockito.when(userMapper.selectById(1)).thenReturn(getUser());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
org.springframework.core.io.Resource resourceMock = Mockito.mock(org.springframework.core.io.Resource.class); try { org.springframework.core.io.Resource resource = resourcesService.downloadResource(getUser(), 1); Assert.assertNull(resource); Mockito.when(resourcesMapper.selectById(1)).thenReturn(getResource()); PowerMockito.when(org.apache.dolphinscheduler.api.utils.FileUtils.file2Resource(Mockito.any())).thenReturn(resourceMock); resource = resourcesService.downloadResource(getUser(), 1); Assert.assertNotNull(resource); } catch (Exception e) { logger.error("DownloadResource error", e); Assert.assertTrue(false); } } @Test public void testAuthorizeResourceTree() { User user = getUser(); user.setId(1); user.setUserType(UserType.ADMIN_USER); int userId = 3; List<Integer> resIds = new ArrayList<>(); resIds.add(1); Mockito.when(resourcePermissionCheckService.functionDisabled()).thenReturn(true); Mockito.when(resourcesMapper.queryResourceExceptUserId(userId)).thenReturn(getResourceList()); Map<String, Object> result = resourcesService.authorizeResourceTree(user, userId); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); List<Resource> resources = (List<Resource>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(resources));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
user.setId(2); user.setUserType(UserType.GENERAL_USER); Mockito.when(resourcesMapper.queryResourceListAuthored(user.getId(), -1)).thenReturn(getResourceList()); result = resourcesService.authorizeResourceTree(user, userId); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); resources = (List<Resource>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(resources)); } @Test public void testUnauthorizedFile() { User user = getUser(); user.setId(1); user.setUserType(UserType.ADMIN_USER); int userId = 3; List<Integer> resIds = new ArrayList<>(); resIds.add(1); Mockito.when(resourcePermissionCheckService.functionDisabled()).thenReturn(true); Mockito.when(resourcesMapper.queryResourceExceptUserId(userId)).thenReturn(getResourceList()); Mockito.when(resourceUserMapper.queryResourcesIdListByUserIdAndPerm(Mockito.anyInt(), Mockito.anyInt())).thenReturn(resIds); Mockito.when(resourcesMapper.queryResourceListById(Mockito.any())).thenReturn(getSingleResourceList()); Map<String, Object> result = resourcesService.unauthorizedFile(user, userId); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); List<Resource> resources = (List<Resource>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(resources)); user.setId(2);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
user.setUserType(UserType.GENERAL_USER); Mockito.when(resourcesMapper.queryResourceListAuthored(user.getId(), -1)).thenReturn(getResourceList()); result = resourcesService.unauthorizedFile(user, userId); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); resources = (List<Resource>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(resources)); } @Test public void testUnauthorizedUDFFunction() { User user = getUser(); user.setId(1); user.setUserType(UserType.ADMIN_USER); int userId = 3; Mockito.when(resourcePermissionCheckService.functionDisabled()).thenReturn(true); Mockito.when(udfFunctionMapper.queryUdfFuncExceptUserId(userId)).thenReturn(getUdfFuncList()); Mockito.when(udfFunctionMapper.queryAuthedUdfFunc(userId)).thenReturn(getSingleUdfFuncList()); Map<String, Object> result = resourcesService.unauthorizedUDFFunction(user, userId); logger.info(result.toString()); List<UdfFunc> udfFuncs = (List<UdfFunc>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(udfFuncs)); user.setId(2); user.setUserType(UserType.GENERAL_USER); Mockito.when(udfFunctionMapper.selectByMap(Collections.singletonMap("user_id", user.getId()))).thenReturn(getUdfFuncList()); result = resourcesService.unauthorizedUDFFunction(user, userId); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); udfFuncs = (List<UdfFunc>) result.get(Constants.DATA_LIST);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
Assert.assertTrue(CollectionUtils.isNotEmpty(udfFuncs)); } @Test public void testAuthorizedUDFFunction() { User user = getUser(); user.setId(1); user.setUserType(UserType.ADMIN_USER); int userId = 3; Mockito.when(resourcePermissionCheckService.functionDisabled()).thenReturn(true); Mockito.when(udfFunctionMapper.queryAuthedUdfFunc(userId)).thenReturn(getUdfFuncList()); Map<String, Object> result = resourcesService.authorizedUDFFunction(user, userId); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); List<UdfFunc> udfFuncs = (List<UdfFunc>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(udfFuncs)); user.setUserType(UserType.GENERAL_USER); user.setId(2); Mockito.when(udfFunctionMapper.queryAuthedUdfFunc(userId)).thenReturn(getUdfFuncList()); result = resourcesService.authorizedUDFFunction(user, userId); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); udfFuncs = (List<UdfFunc>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(udfFuncs)); } @Test public void testAuthorizedFile() { User user = getUser(); user.setId(1);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
user.setUserType(UserType.ADMIN_USER); int userId = 3; List<Integer> resIds = new ArrayList<>(); resIds.add(1); Mockito.when(resourcePermissionCheckService.functionDisabled()).thenReturn(true); Mockito.when(resourceUserMapper.queryResourcesIdListByUserIdAndPerm(Mockito.anyInt(), Mockito.anyInt())).thenReturn(resIds); Mockito.when(resourcesMapper.queryResourceListById(Mockito.any())).thenReturn(getResourceList()); Map<String, Object> result = resourcesService.authorizedFile(user, userId); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); List<Resource> resources = (List<Resource>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(resources)); user.setId(2); user.setUserType(UserType.GENERAL_USER); Mockito.when(resourceUserMapper.queryResourcesIdListByUserIdAndPerm(Mockito.anyInt(), Mockito.anyInt())).thenReturn(resIds); Mockito.when(resourcesMapper.queryResourceListById(Mockito.any())).thenReturn(getResourceList()); result = resourcesService.authorizedFile(user, userId); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); resources = (List<Resource>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(resources)); } @Test public void testCatFile() { PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(false); try { Mockito.when(storageOperate.exists(Mockito.anyString(), Mockito.anyString())).thenReturn(true);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
Mockito.when(storageOperate.vimFile(Mockito.anyString(), Mockito.anyString(), eq(1), eq(10))).thenReturn(getContent()); List<String> list = storageOperate.vimFile(Mockito.any(), Mockito.anyString(), eq(1), eq(10)); Assert.assertNotNull(list); } catch (IOException e) { logger.error("hadoop error", e); } } private List<Resource> getResourceList() { List<Resource> resources = new ArrayList<>(); resources.add(getResource(1)); resources.add(getResource(2)); resources.add(getResource(3)); return resources; } private Set<Integer> getSetIds() { Set<Integer> resources = new HashSet<>(); resources.add(1); return resources; } private List<Resource> getSingleResourceList() { return Collections.singletonList(getResource(1)); } private Tenant getTenant() { Tenant tenant = new Tenant(); tenant.setTenantCode("123"); return tenant; } private Resource getResource() { Resource resource = new Resource(); resource.setPid(-1);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
resource.setUserId(1); resource.setDescription("ResourcesServiceTest.jar"); resource.setAlias("ResourcesServiceTest.jar"); resource.setFullName("/ResourcesServiceTest.jar"); resource.setType(ResourceType.FILE); return resource; } private Resource getResource(int resourceId) { Resource resource = new Resource(); resource.setId(resourceId); 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 Resource getResource(int resourceId,ResourceType type) { Resource resource = new Resource(); resource.setId(resourceId); resource.setPid(-1); resource.setUserId(1); resource.setDescription("ResourcesServiceTest.jar"); resource.setAlias("ResourcesServiceTest.jar"); resource.setFullName("/ResourcesServiceTest.jar"); resource.setType(type); return resource; } private Resource getUdfResource() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
Resource resource = new Resource(); resource.setUserId(1); resource.setDescription("udfTest"); resource.setAlias("udfTest.jar"); resource.setFullName("/udfTest.jar"); resource.setType(ResourceType.UDF); return resource; } private UdfFunc getUdfFunc() { UdfFunc udfFunc = new UdfFunc(); udfFunc.setId(1); return udfFunc; } private UdfFunc getUdfFunc(int udfId) { UdfFunc udfFunc = new UdfFunc(); udfFunc.setId(udfId); return udfFunc; } private List<UdfFunc> getUdfFuncList() { List<UdfFunc> udfFuncs = new ArrayList<>(); udfFuncs.add(getUdfFunc(1)); udfFuncs.add(getUdfFunc(2)); udfFuncs.add(getUdfFunc(3)); return udfFuncs; } private List<UdfFunc> getSingleUdfFuncList() { return Collections.singletonList(getUdfFunc(3)); } private User getUser() { User user = new User();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,338
[Bug] [Permission] Tenants and users do not need to do post-creation association operations.
### 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 Failed to create tenant, tenants and users do not need to do post-creation association operations ### What you expected to happen Normal ### How to reproduce Create a tenant. ### Anything else No Response ### Version dev ### 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/10338
https://github.com/apache/dolphinscheduler/pull/10339
0c25d4a3ceae0fec1cc800bcc171a0b77aae8ee4
ffe809b2c5600593053210c42462d68fad9d6aca
2022-06-02T06:15:10Z
java
2022-06-05T14:34:25Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
user.setId(1); user.setUserType(UserType.GENERAL_USER); user.setTenantId(1); user.setTenantCode("tenantCode"); return user; } private List<String> getContent() { List<String> contentList = new ArrayList<>(); contentList.add("test"); return contentList; } private List<Map<String, Object>> getResources() { List<Map<String, Object>> resources = new ArrayList<>(); Map<String, Object> resource = new HashMap<>(); resource.put("id", 1); resource.put("resource_ids", "1"); resources.add(resource); return resources; } private static String getRandomStringWithLength(int length) { Random r = new Random(); StringBuilder sb = new StringBuilder(); while (sb.length() < length) { char c = (char) (r.nextInt(26) + 'a'); sb.append(c); } return sb.toString(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,168
[Improvement][task sql] Improve creating function query
### 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 enhance creating temp function query ### Use case Current creating function query fail to handle all cases. For example, Kyuubi was taken as a datasource in DS, it's more likely to get a problem when setting the share level of Kyuubi engine to user. ### 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/10168
https://github.com/apache/dolphinscheduler/pull/10170
ffe809b2c5600593053210c42462d68fad9d6aca
da3c25dc6792264d003b6f0a10341f04ef970997
2022-05-20T08:57:08Z
java
2022-06-06T02:33:24Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.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.plugin.task.sql; import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils; import org.apache.dolphinscheduler.plugin.datasource.api.utils.DataSourceUtils; import org.apache.dolphinscheduler.plugin.task.api.AbstractTaskExecutor; import org.apache.dolphinscheduler.plugin.task.api.SQLTaskExecutionContext; import org.apache.dolphinscheduler.plugin.task.api.TaskConstants; import org.apache.dolphinscheduler.plugin.task.api.TaskException; import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext; import org.apache.dolphinscheduler.plugin.task.api.enums.Direct; import org.apache.dolphinscheduler.plugin.task.api.enums.SqlType; import org.apache.dolphinscheduler.plugin.task.api.enums.TaskTimeoutStrategy; import org.apache.dolphinscheduler.plugin.task.api.model.Property;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,168
[Improvement][task sql] Improve creating function query
### 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 enhance creating temp function query ### Use case Current creating function query fail to handle all cases. For example, Kyuubi was taken as a datasource in DS, it's more likely to get a problem when setting the share level of Kyuubi engine to user. ### 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/10168
https://github.com/apache/dolphinscheduler/pull/10170
ffe809b2c5600593053210c42462d68fad9d6aca
da3c25dc6792264d003b6f0a10341f04ef970997
2022-05-20T08:57:08Z
java
2022-06-06T02:33:24Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
import org.apache.dolphinscheduler.plugin.task.api.model.TaskAlertInfo; import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters; import org.apache.dolphinscheduler.plugin.task.api.parameters.SqlParameters; import org.apache.dolphinscheduler.plugin.task.api.parameters.resource.UdfFuncParameters; import org.apache.dolphinscheduler.plugin.task.api.parser.ParamUtils; import org.apache.dolphinscheduler.plugin.task.api.parser.ParameterUtils; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.dolphinscheduler.spi.utils.StringUtils; import org.apache.commons.collections4.CollectionUtils; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import java.text.MessageFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; import org.slf4j.Logger; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; public class SqlTask extends AbstractTaskExecutor {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,168
[Improvement][task sql] Improve creating function query
### 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 enhance creating temp function query ### Use case Current creating function query fail to handle all cases. For example, Kyuubi was taken as a datasource in DS, it's more likely to get a problem when setting the share level of Kyuubi engine to user. ### 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/10168
https://github.com/apache/dolphinscheduler/pull/10170
ffe809b2c5600593053210c42462d68fad9d6aca
da3c25dc6792264d003b6f0a10341f04ef970997
2022-05-20T08:57:08Z
java
2022-06-06T02:33:24Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
/** * taskExecutionContext */ private TaskExecutionContext taskExecutionContext; /** * sql parameters */ private SqlParameters sqlParameters; /** * base datasource */ private BaseConnectionParam baseConnectionParam; /** * create function format */ private static final String CREATE_FUNCTION_FORMAT = "create temporary function {0} as ''{1}''"; /** * default query sql limit */ private static final int QUERY_LIMIT = 10000; private SQLTaskExecutionContext sqlTaskExecutionContext; /** * Abstract Yarn Task * * @param taskRequest taskRequest */ public SqlTask(TaskExecutionContext taskRequest) { super(taskRequest);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,168
[Improvement][task sql] Improve creating function query
### 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 enhance creating temp function query ### Use case Current creating function query fail to handle all cases. For example, Kyuubi was taken as a datasource in DS, it's more likely to get a problem when setting the share level of Kyuubi engine to user. ### 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/10168
https://github.com/apache/dolphinscheduler/pull/10170
ffe809b2c5600593053210c42462d68fad9d6aca
da3c25dc6792264d003b6f0a10341f04ef970997
2022-05-20T08:57:08Z
java
2022-06-06T02:33:24Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
this.taskExecutionContext = taskRequest; this.sqlParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), SqlParameters.class); assert sqlParameters != null; if (!sqlParameters.checkParameters()) { throw new RuntimeException("sql task params is not valid"); } sqlTaskExecutionContext = sqlParameters.generateExtendedContext(taskExecutionContext.getResourceParametersHelper()); } @Override public AbstractParameters getParameters() { return sqlParameters; } @Override public void handle() throws Exception { logger.info("Full sql parameters: {}", sqlParameters); logger.info("sql type : {}, datasource : {}, sql : {} , localParams : {},udfs : {},showType : {},connParams : {},varPool : {} ,query max result limit {}", sqlParameters.getType(), sqlParameters.getDatasource(), sqlParameters.getSql(), sqlParameters.getLocalParams(), sqlParameters.getUdfs(), sqlParameters.getShowType(), sqlParameters.getConnParams(), sqlParameters.getVarPool(), sqlParameters.getLimit()); try { baseConnectionParam = (BaseConnectionParam) DataSourceUtils.buildConnectionParams( DbType.valueOf(sqlParameters.getType()), sqlTaskExecutionContext.getConnectionParams());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,168
[Improvement][task sql] Improve creating function query
### 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 enhance creating temp function query ### Use case Current creating function query fail to handle all cases. For example, Kyuubi was taken as a datasource in DS, it's more likely to get a problem when setting the share level of Kyuubi engine to user. ### 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/10168
https://github.com/apache/dolphinscheduler/pull/10170
ffe809b2c5600593053210c42462d68fad9d6aca
da3c25dc6792264d003b6f0a10341f04ef970997
2022-05-20T08:57:08Z
java
2022-06-06T02:33:24Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
List<SqlBinds> mainStatementSqlBinds = SqlSplitter.split(sqlParameters.getSql(), sqlParameters.getSegmentSeparator()) .stream() .map(this::getSqlAndSqlParamsMap) .collect(Collectors.toList()); List<SqlBinds> preStatementSqlBinds = Optional.ofNullable(sqlParameters.getPreStatements()) .orElse(new ArrayList<>()) .stream() .map(this::getSqlAndSqlParamsMap) .collect(Collectors.toList()); List<SqlBinds> postStatementSqlBinds = Optional.ofNullable(sqlParameters.getPostStatements()) .orElse(new ArrayList<>()) .stream() .map(this::getSqlAndSqlParamsMap) .collect(Collectors.toList()); List<String> createFuncs = createFuncs(sqlTaskExecutionContext.getUdfFuncParametersList(), logger); executeFuncAndSql(mainStatementSqlBinds, preStatementSqlBinds, postStatementSqlBinds, createFuncs); setExitStatusCode(TaskConstants.EXIT_CODE_SUCCESS); } catch (Exception e) { setExitStatusCode(TaskConstants.EXIT_CODE_FAILURE); logger.error("sql task error: {}", e.toString()); throw e; } } /** * execute function and sql * * @param mainStatementsBinds main statements binds * @param preStatementsBinds pre statements binds
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,168
[Improvement][task sql] Improve creating function query
### 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 enhance creating temp function query ### Use case Current creating function query fail to handle all cases. For example, Kyuubi was taken as a datasource in DS, it's more likely to get a problem when setting the share level of Kyuubi engine to user. ### 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/10168
https://github.com/apache/dolphinscheduler/pull/10170
ffe809b2c5600593053210c42462d68fad9d6aca
da3c25dc6792264d003b6f0a10341f04ef970997
2022-05-20T08:57:08Z
java
2022-06-06T02:33:24Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
* @param postStatementsBinds post statements binds * @param createFuncs create functions */ public void executeFuncAndSql(List<SqlBinds> mainStatementsBinds, List<SqlBinds> preStatementsBinds, List<SqlBinds> postStatementsBinds, List<String> createFuncs) throws Exception { Connection connection = null; try { connection = DataSourceClientProvider.getInstance().getConnection(DbType.valueOf(sqlParameters.getType()), baseConnectionParam); if (CollectionUtils.isNotEmpty(createFuncs)) { createTempFunction(connection, createFuncs); } executeUpdate(connection, preStatementsBinds, "pre"); String result = null; if (sqlParameters.getSqlType() == SqlType.QUERY.ordinal()) { result = executeQuery(connection, mainStatementsBinds.get(0), "main"); } else if (sqlParameters.getSqlType() == SqlType.NON_QUERY.ordinal()) { String updateResult = executeUpdate(connection, mainStatementsBinds, "main"); result = setNonQuerySqlReturn(updateResult, sqlParameters.getLocalParams()); } sqlParameters.dealOutParam(result);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,168
[Improvement][task sql] Improve creating function query
### 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 enhance creating temp function query ### Use case Current creating function query fail to handle all cases. For example, Kyuubi was taken as a datasource in DS, it's more likely to get a problem when setting the share level of Kyuubi engine to user. ### 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/10168
https://github.com/apache/dolphinscheduler/pull/10170
ffe809b2c5600593053210c42462d68fad9d6aca
da3c25dc6792264d003b6f0a10341f04ef970997
2022-05-20T08:57:08Z
java
2022-06-06T02:33:24Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
executeUpdate(connection, postStatementsBinds, "post"); } catch (Exception e) { logger.error("execute sql error: {}", e.getMessage()); throw e; } finally { close(connection); } } private String setNonQuerySqlReturn(String updateResult, List<Property> properties) { String result = null; for (Property info : properties) { if (Direct.OUT == info.getDirect()) { List<Map<String, String>> updateRL = new ArrayList<>(); Map<String, String> updateRM = new HashMap<>(); updateRM.put(info.getProp(), updateResult); updateRL.add(updateRM); result = JSONUtils.toJsonString(updateRL); break; } } return result; } /** * result process * * @param resultSet resultSet * @throws Exception Exception */ private String resultProcess(ResultSet resultSet) throws Exception {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,168
[Improvement][task sql] Improve creating function query
### 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 enhance creating temp function query ### Use case Current creating function query fail to handle all cases. For example, Kyuubi was taken as a datasource in DS, it's more likely to get a problem when setting the share level of Kyuubi engine to user. ### 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/10168
https://github.com/apache/dolphinscheduler/pull/10170
ffe809b2c5600593053210c42462d68fad9d6aca
da3c25dc6792264d003b6f0a10341f04ef970997
2022-05-20T08:57:08Z
java
2022-06-06T02:33:24Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
ArrayNode resultJSONArray = JSONUtils.createArrayNode(); if (resultSet != null) { ResultSetMetaData md = resultSet.getMetaData(); int num = md.getColumnCount(); int rowCount = 0; int limit = sqlParameters.getLimit() == 0 ? QUERY_LIMIT : sqlParameters.getLimit(); while (resultSet.next()) { if (rowCount == limit) { logger.info("sql result limit : {} exceeding results are filtered", limit); break; } ObjectNode mapOfColValues = JSONUtils.createObjectNode(); for (int i = 1; i <= num; i++) { mapOfColValues.set(md.getColumnLabel(i), JSONUtils.toJsonNode(resultSet.getObject(i))); } resultJSONArray.add(mapOfColValues); rowCount++; } int displayRows = sqlParameters.getDisplayRows() > 0 ? sqlParameters.getDisplayRows() : TaskConstants.DEFAULT_DISPLAY_ROWS; displayRows = Math.min(displayRows, rowCount); logger.info("display sql result {} rows as follows:", displayRows); for (int i = 0; i < displayRows; i++) { String row = JSONUtils.toJsonString(resultJSONArray.get(i)); logger.info("row {} : {}", i + 1, row); } } String result = JSONUtils.toJsonString(resultJSONArray); if (sqlParameters.getSendEmail() == null || sqlParameters.getSendEmail()) { sendAttachment(sqlParameters.getGroupId(), StringUtils.isNotEmpty(sqlParameters.getTitle()) ? sqlParameters.getTitle()
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,168
[Improvement][task sql] Improve creating function query
### 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 enhance creating temp function query ### Use case Current creating function query fail to handle all cases. For example, Kyuubi was taken as a datasource in DS, it's more likely to get a problem when setting the share level of Kyuubi engine to user. ### 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/10168
https://github.com/apache/dolphinscheduler/pull/10170
ffe809b2c5600593053210c42462d68fad9d6aca
da3c25dc6792264d003b6f0a10341f04ef970997
2022-05-20T08:57:08Z
java
2022-06-06T02:33:24Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
: taskExecutionContext.getTaskName() + " query result sets", result); } logger.debug("execute sql result : {}", result); return result; } /** * send alert as an attachment * * @param title title * @param content content */ private void sendAttachment(int groupId, String title, String content) { setNeedAlert(Boolean.TRUE); TaskAlertInfo taskAlertInfo = new TaskAlertInfo(); taskAlertInfo.setAlertGroupId(groupId); taskAlertInfo.setContent(content); taskAlertInfo.setTitle(title); setTaskAlertInfo(taskAlertInfo); } private String executeQuery(Connection connection, SqlBinds sqlBinds, String handlerType) throws Exception { try (PreparedStatement statement = prepareStatementAndBind(connection, sqlBinds)) { logger.info("{} statement execute query, for sql: {}", handlerType, sqlBinds.getSql()); ResultSet resultSet = statement.executeQuery(); return resultProcess(resultSet); } } private String executeUpdate(Connection connection, List<SqlBinds> statementsBinds, String handlerType) throws Exception { int result = 0; for (SqlBinds sqlBind : statementsBinds) { try (PreparedStatement statement = prepareStatementAndBind(connection, sqlBind)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,168
[Improvement][task sql] Improve creating function query
### 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 enhance creating temp function query ### Use case Current creating function query fail to handle all cases. For example, Kyuubi was taken as a datasource in DS, it's more likely to get a problem when setting the share level of Kyuubi engine to user. ### 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/10168
https://github.com/apache/dolphinscheduler/pull/10170
ffe809b2c5600593053210c42462d68fad9d6aca
da3c25dc6792264d003b6f0a10341f04ef970997
2022-05-20T08:57:08Z
java
2022-06-06T02:33:24Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
result = statement.executeUpdate(); logger.info("{} statement execute update result: {}, for sql: {}", handlerType, result, sqlBind.getSql()); } } return String.valueOf(result); } /** * create temp function * * @param connection connection * @param createFuncs createFuncs */ private void createTempFunction(Connection connection, List<String> createFuncs) throws Exception { try (Statement funcStmt = connection.createStatement()) { for (String createFunc : createFuncs) { logger.info("hive create function sql: {}", createFunc); funcStmt.execute(createFunc); } } } /** * close jdbc resource * * @param connection connection */ private void close(Connection connection) { if (connection != null) { try { connection.close();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,168
[Improvement][task sql] Improve creating function query
### 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 enhance creating temp function query ### Use case Current creating function query fail to handle all cases. For example, Kyuubi was taken as a datasource in DS, it's more likely to get a problem when setting the share level of Kyuubi engine to user. ### 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/10168
https://github.com/apache/dolphinscheduler/pull/10170
ffe809b2c5600593053210c42462d68fad9d6aca
da3c25dc6792264d003b6f0a10341f04ef970997
2022-05-20T08:57:08Z
java
2022-06-06T02:33:24Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
} catch (SQLException e) { logger.error("close connection error : {}", e.getMessage(), e); } } } /** * preparedStatement bind * * @param connection connection * @param sqlBinds sqlBinds * @return PreparedStatement * @throws Exception Exception */ private PreparedStatement prepareStatementAndBind(Connection connection, SqlBinds sqlBinds) { boolean timeoutFlag = taskExecutionContext.getTaskTimeoutStrategy() == TaskTimeoutStrategy.FAILED || taskExecutionContext.getTaskTimeoutStrategy() == TaskTimeoutStrategy.WARNFAILED; try { PreparedStatement stmt = connection.prepareStatement(sqlBinds.getSql()); if (timeoutFlag) { stmt.setQueryTimeout(taskExecutionContext.getTaskTimeout()); } Map<Integer, Property> params = sqlBinds.getParamsMap(); if (params != null) { for (Map.Entry<Integer, Property> entry : params.entrySet()) { Property prop = entry.getValue(); ParameterUtils.setInParameter(entry.getKey(), stmt, prop.getType(), prop.getValue()); } } logger.info("prepare statement replace sql : {} ", stmt);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,168
[Improvement][task sql] Improve creating function query
### 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 enhance creating temp function query ### Use case Current creating function query fail to handle all cases. For example, Kyuubi was taken as a datasource in DS, it's more likely to get a problem when setting the share level of Kyuubi engine to user. ### 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/10168
https://github.com/apache/dolphinscheduler/pull/10170
ffe809b2c5600593053210c42462d68fad9d6aca
da3c25dc6792264d003b6f0a10341f04ef970997
2022-05-20T08:57:08Z
java
2022-06-06T02:33:24Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
return stmt; } catch (Exception exception) { throw new TaskException("SQL task prepareStatementAndBind error", exception); } } /** * print replace sql * * @param content content * @param formatSql format sql * @param rgex rgex * @param sqlParamsMap sql params map */ private void printReplacedSql(String content, String formatSql, String rgex, Map<Integer, Property> sqlParamsMap) { logger.info("after replace sql , preparing : {}", formatSql); StringBuilder logPrint = new StringBuilder("replaced sql , parameters:"); if (sqlParamsMap == null) { logger.info("printReplacedSql: sqlParamsMap is null."); } else { for (int i = 1; i <= sqlParamsMap.size(); i++) { logPrint.append(sqlParamsMap.get(i).getValue()).append("(").append(sqlParamsMap.get(i).getType()).append(")"); } } logger.info("Sql Params are {}", logPrint); } /** * ready to execute SQL and parameter entity Map * * @return SqlBinds
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,168
[Improvement][task sql] Improve creating function query
### 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 enhance creating temp function query ### Use case Current creating function query fail to handle all cases. For example, Kyuubi was taken as a datasource in DS, it's more likely to get a problem when setting the share level of Kyuubi engine to user. ### 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/10168
https://github.com/apache/dolphinscheduler/pull/10170
ffe809b2c5600593053210c42462d68fad9d6aca
da3c25dc6792264d003b6f0a10341f04ef970997
2022-05-20T08:57:08Z
java
2022-06-06T02:33:24Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
*/ private SqlBinds getSqlAndSqlParamsMap(String sql) { Map<Integer, Property> sqlParamsMap = new HashMap<>(); StringBuilder sqlBuilder = new StringBuilder(); Map<String, Property> paramsMap = ParamUtils.convert(taskExecutionContext, getParameters()); if (paramsMap == null) { sqlBuilder.append(sql); return new SqlBinds(sqlBuilder.toString(), sqlParamsMap); } if (StringUtils.isNotEmpty(sqlParameters.getTitle())) { String title = ParameterUtils.convertParameterPlaceholders(sqlParameters.getTitle(), ParamUtils.convert(paramsMap)); logger.info("SQL title : {}", title); sqlParameters.setTitle(title); } sql = ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime()); setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap,taskExecutionContext.getTaskInstanceId()); String rgexo = "['\"]*\\!\\{(.*?)\\}['\"]*"; sql = replaceOriginalValue(sql, rgexo, paramsMap); // r String formatSql = sql.replaceAll(rgex, "?"); sqlBuilder.append(formatSql); // p printReplacedSql(sql, formatSql, rgex, sqlParamsMap);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,168
[Improvement][task sql] Improve creating function query
### 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 enhance creating temp function query ### Use case Current creating function query fail to handle all cases. For example, Kyuubi was taken as a datasource in DS, it's more likely to get a problem when setting the share level of Kyuubi engine to user. ### 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/10168
https://github.com/apache/dolphinscheduler/pull/10170
ffe809b2c5600593053210c42462d68fad9d6aca
da3c25dc6792264d003b6f0a10341f04ef970997
2022-05-20T08:57:08Z
java
2022-06-06T02:33:24Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
return new SqlBinds(sqlBuilder.toString(), sqlParamsMap); } private String replaceOriginalValue(String content, String rgex, Map<String, Property> sqlParamsMap) { Pattern pattern = Pattern.compile(rgex); while (true) { Matcher m = pattern.matcher(content); if (!m.find()) { break; } String paramName = m.group(1); String paramValue = sqlParamsMap.get(paramName).getValue(); content = m.replaceFirst(paramValue); } return content; } /** * create function list * * @param udfFuncParameters udfFuncParameters * @param logger logger * @return */ private List<String> createFuncs(List<UdfFuncParameters> udfFuncParameters, Logger logger) { if (CollectionUtils.isEmpty(udfFuncParameters)) { logger.info("can't find udf function resource"); return null; } // b List<String> funcList = buildJarSql(udfFuncParameters); // b
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,168
[Improvement][task sql] Improve creating function query
### 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 enhance creating temp function query ### Use case Current creating function query fail to handle all cases. For example, Kyuubi was taken as a datasource in DS, it's more likely to get a problem when setting the share level of Kyuubi engine to user. ### 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/10168
https://github.com/apache/dolphinscheduler/pull/10170
ffe809b2c5600593053210c42462d68fad9d6aca
da3c25dc6792264d003b6f0a10341f04ef970997
2022-05-20T08:57:08Z
java
2022-06-06T02:33:24Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
List<String> tempFuncList = buildTempFuncSql(udfFuncParameters); funcList.addAll(tempFuncList); return funcList; } /** * b * @param udfFuncParameters udfFuncParameters * @return */ private List<String> buildTempFuncSql(List<UdfFuncParameters> udfFuncParameters) { return udfFuncParameters.stream().map(value -> MessageFormat .format(CREATE_FUNCTION_FORMAT, value.getFuncName(), value.getClassName())).collect(Collectors.toList()); } /** * b * @param udfFuncParameters udfFuncParameters * @return */ private List<String> buildJarSql(List<UdfFuncParameters> udfFuncParameters) { return udfFuncParameters.stream().map(value -> { String defaultFS = value.getDefaultFS(); String prefixPath = defaultFS.startsWith("file://") ? "file://" : defaultFS; String uploadPath = CommonUtils.getHdfsUdfDir(value.getTenantCode()); String resourceFullName = value.getResourceName(); resourceFullName = resourceFullName.startsWith("/") ? resourceFullName : String.format("/%s", resourceFullName); return String.format("add jar %s%s%s", prefixPath, uploadPath, resourceFullName); }).collect(Collectors.toList()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,341
[Bug] [Worker] Worker will not exit when fail to start
### 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 When the worker start failure due to database connect error or some other initializes error. The worker will hang, since there are some no-damon thread is still running. ### What you expected to happen When worker start failuer, the worker process exit. ### How to reproduce Set an error db connect info, then start worker. ### Anything else Find the worker process will not exit, use jstack find there are some thread is running. ### Version dev ### 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/10341
https://github.com/apache/dolphinscheduler/pull/10342
da3c25dc6792264d003b6f0a10341f04ef970997
516757cc7400b576ca0933dd5826005db06fa508
2022-06-02T07:41:23Z
java
2022-06-06T02:49:23Z
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.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.plugin.datasource.hive; import com.zaxxer.hikari.HikariDataSource; import org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient; import org.apache.dolphinscheduler.plugin.datasource.api.provider.JDBCDataSourceProvider; import org.apache.dolphinscheduler.plugin.datasource.hive.utils.CommonUtil; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.utils.Constants; import org.apache.dolphinscheduler.spi.utils.PropertyUtils; import org.apache.dolphinscheduler.spi.utils.StringUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.security.UserGroupInformation;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,341
[Bug] [Worker] Worker will not exit when fail to start
### 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 When the worker start failure due to database connect error or some other initializes error. The worker will hang, since there are some no-damon thread is still running. ### What you expected to happen When worker start failuer, the worker process exit. ### How to reproduce Set an error db connect info, then start worker. ### Anything else Find the worker process will not exit, use jstack find there are some thread is running. ### Version dev ### 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/10341
https://github.com/apache/dolphinscheduler/pull/10342
da3c25dc6792264d003b6f0a10341f04ef970997
516757cc7400b576ca0933dd5826005db06fa508
2022-06-02T07:41:23Z
java
2022-06-06T02:49:23Z
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.java
import org.slf4j.Logger; import org.slf4j.LoggerFactory; import sun.security.krb5.Config; import java.io.IOException; import java.lang.reflect.Field; import java.sql.Connection; import java.sql.SQLException; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.*; public class HiveDataSourceClient extends CommonDataSourceClient { private static final Logger logger = LoggerFactory.getLogger(HiveDataSourceClient.class); private ScheduledExecutorService kerberosRenewalService; private Configuration hadoopConf; protected HikariDataSource oneSessionDataSource; private UserGroupInformation ugi; private boolean retryGetConnection = true; public HiveDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) { super(baseConnectionParam, dbType); } @Override protected void preInit() { logger.info("PreInit in {}", getClass().getName()); this.kerberosRenewalService = Executors.newSingleThreadScheduledExecutor(); } @Override protected void initClient(BaseConnectionParam baseConnectionParam, DbType dbType) { logger.info("Create Configuration for hive configuration."); this.hadoopConf = createHadoopConf();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,341
[Bug] [Worker] Worker will not exit when fail to start
### 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 When the worker start failure due to database connect error or some other initializes error. The worker will hang, since there are some no-damon thread is still running. ### What you expected to happen When worker start failuer, the worker process exit. ### How to reproduce Set an error db connect info, then start worker. ### Anything else Find the worker process will not exit, use jstack find there are some thread is running. ### Version dev ### 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/10341
https://github.com/apache/dolphinscheduler/pull/10342
da3c25dc6792264d003b6f0a10341f04ef970997
516757cc7400b576ca0933dd5826005db06fa508
2022-06-02T07:41:23Z
java
2022-06-06T02:49:23Z
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.java
logger.info("Create Configuration success."); logger.info("Create UserGroupInformation."); this.ugi = createUserGroupInformation(baseConnectionParam.getUser()); logger.info("Create ugi success."); super.initClient(baseConnectionParam, dbType); this.oneSessionDataSource = JDBCDataSourceProvider.createOneSessionJdbcDataSource(baseConnectionParam, dbType); logger.info("Init {} success.", getClass().getName()); } @Override protected void checkEnv(BaseConnectionParam baseConnectionParam) { super.checkEnv(baseConnectionParam); checkKerberosEnv(); } private void checkKerberosEnv() { String krb5File = PropertyUtils.getString(JAVA_SECURITY_KRB5_CONF_PATH); Boolean kerberosStartupState = PropertyUtils.getBoolean(HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false); if (kerberosStartupState && StringUtils.isNotBlank(krb5File)) { System.setProperty(JAVA_SECURITY_KRB5_CONF, krb5File); try { Config.refresh(); Class<?> kerberosName = Class.forName("org.apache.hadoop.security.authentication.util.KerberosName"); Field field = kerberosName.getDeclaredField("defaultRealm"); field.setAccessible(true); field.set(null, Config.getInstance().getDefaultRealm()); } catch (Exception e) { throw new RuntimeException("Update Kerberos environment failed.", e); } } } private UserGroupInformation createUserGroupInformation(String username) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,341
[Bug] [Worker] Worker will not exit when fail to start
### 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 When the worker start failure due to database connect error or some other initializes error. The worker will hang, since there are some no-damon thread is still running. ### What you expected to happen When worker start failuer, the worker process exit. ### How to reproduce Set an error db connect info, then start worker. ### Anything else Find the worker process will not exit, use jstack find there are some thread is running. ### Version dev ### 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/10341
https://github.com/apache/dolphinscheduler/pull/10342
da3c25dc6792264d003b6f0a10341f04ef970997
516757cc7400b576ca0933dd5826005db06fa508
2022-06-02T07:41:23Z
java
2022-06-06T02:49:23Z
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.java
String krb5File = PropertyUtils.getString(Constants.JAVA_SECURITY_KRB5_CONF_PATH); String keytab = PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_PATH); String principal = PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_USERNAME); try { UserGroupInformation ugi = CommonUtil.createUGI(getHadoopConf(), principal, keytab, krb5File, username); try { Field isKeytabField = ugi.getClass().getDeclaredField("isKeytab"); isKeytabField.setAccessible(true); isKeytabField.set(ugi, true); } catch (NoSuchFieldException | IllegalAccessException e) { logger.warn(e.getMessage()); } kerberosRenewalService.scheduleWithFixedDelay(() -> { try { ugi.checkTGTAndReloginFromKeytab(); } catch (IOException e) { logger.error("Check TGT and Renewal from Keytab error", e); } }, 5, 5, TimeUnit.MINUTES); return ugi; } catch (IOException e) { throw new RuntimeException("createUserGroupInformation fail. ", e); } } protected Configuration createHadoopConf() { Configuration hadoopConf = new Configuration(); hadoopConf.setBoolean("ipc.client.fallback-to-simple-auth-allowed", true); return hadoopConf; } protected Configuration getHadoopConf() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,341
[Bug] [Worker] Worker will not exit when fail to start
### 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 When the worker start failure due to database connect error or some other initializes error. The worker will hang, since there are some no-damon thread is still running. ### What you expected to happen When worker start failuer, the worker process exit. ### How to reproduce Set an error db connect info, then start worker. ### Anything else Find the worker process will not exit, use jstack find there are some thread is running. ### Version dev ### 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/10341
https://github.com/apache/dolphinscheduler/pull/10342
da3c25dc6792264d003b6f0a10341f04ef970997
516757cc7400b576ca0933dd5826005db06fa508
2022-06-02T07:41:23Z
java
2022-06-06T02:49:23Z
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.java
return this.hadoopConf; } @Override public Connection getConnection() { try { return oneSessionDataSource.getConnection(); } catch (SQLException e) { boolean kerberosStartupState = PropertyUtils.getBoolean(HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false); if (retryGetConnection && kerberosStartupState) { retryGetConnection = false; createUserGroupInformation(baseConnectionParam.getUser()); Connection connection = getConnection(); retryGetConnection = true; return connection; } logger.error("get oneSessionDataSource Connection fail SQLException: {}", e.getMessage(), e); return null; } } @Override public void close() { super.close(); logger.info("close {}.", this.getClass().getSimpleName()); kerberosRenewalService.shutdown(); this.ugi = null; this.oneSessionDataSource.close(); this.oneSessionDataSource = null; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,341
[Bug] [Worker] Worker will not exit when fail to start
### 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 When the worker start failure due to database connect error or some other initializes error. The worker will hang, since there are some no-damon thread is still running. ### What you expected to happen When worker start failuer, the worker process exit. ### How to reproduce Set an error db connect info, then start worker. ### Anything else Find the worker process will not exit, use jstack find there are some thread is running. ### Version dev ### 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/10341
https://github.com/apache/dolphinscheduler/pull/10342
da3c25dc6792264d003b6f0a10341f04ef970997
516757cc7400b576ca0933dd5826005db06fa508
2022-06-02T07:41:23Z
java
2022-06-06T02:49:23Z
dolphinscheduler-log-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.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.server.log; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.LoggerUtils; import org.apache.dolphinscheduler.remote.command.Command; import org.apache.dolphinscheduler.remote.command.CommandType; import org.apache.dolphinscheduler.remote.command.log.GetLogBytesRequestCommand; import org.apache.dolphinscheduler.remote.command.log.GetLogBytesResponseCommand;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,341
[Bug] [Worker] Worker will not exit when fail to start
### 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 When the worker start failure due to database connect error or some other initializes error. The worker will hang, since there are some no-damon thread is still running. ### What you expected to happen When worker start failuer, the worker process exit. ### How to reproduce Set an error db connect info, then start worker. ### Anything else Find the worker process will not exit, use jstack find there are some thread is running. ### Version dev ### 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/10341
https://github.com/apache/dolphinscheduler/pull/10342
da3c25dc6792264d003b6f0a10341f04ef970997
516757cc7400b576ca0933dd5826005db06fa508
2022-06-02T07:41:23Z
java
2022-06-06T02:49:23Z
dolphinscheduler-log-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java
import org.apache.dolphinscheduler.remote.command.log.RemoveTaskLogRequestCommand; import org.apache.dolphinscheduler.remote.command.log.RemoveTaskLogResponseCommand; import org.apache.dolphinscheduler.remote.command.log.RollViewLogRequestCommand; import org.apache.dolphinscheduler.remote.command.log.RollViewLogResponseCommand; import org.apache.dolphinscheduler.remote.command.log.ViewLogRequestCommand; import org.apache.dolphinscheduler.remote.command.log.ViewLogResponseCommand; import org.apache.dolphinscheduler.remote.processor.NettyRequestProcessor; import org.apache.dolphinscheduler.remote.utils.Constants; import org.apache.commons.lang3.StringUtils; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Collections; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.stream.Collectors; import java.util.stream.Stream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import io.netty.channel.Channel; /** * logger request process logic */ @Component
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,341
[Bug] [Worker] Worker will not exit when fail to start
### 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 When the worker start failure due to database connect error or some other initializes error. The worker will hang, since there are some no-damon thread is still running. ### What you expected to happen When worker start failuer, the worker process exit. ### How to reproduce Set an error db connect info, then start worker. ### Anything else Find the worker process will not exit, use jstack find there are some thread is running. ### Version dev ### 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/10341
https://github.com/apache/dolphinscheduler/pull/10342
da3c25dc6792264d003b6f0a10341f04ef970997
516757cc7400b576ca0933dd5826005db06fa508
2022-06-02T07:41:23Z
java
2022-06-06T02:49:23Z
dolphinscheduler-log-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java
public class LoggerRequestProcessor implements NettyRequestProcessor { private final Logger logger = LoggerFactory.getLogger(LoggerRequestProcessor.class); private final ExecutorService executor; public LoggerRequestProcessor() { this.executor = Executors.newFixedThreadPool(Constants.CPUS * 2 + 1); } @Override public void process(Channel channel, Command command) { logger.info("received command : {}", command); final CommandType commandType = command.getType(); switch (commandType) { case GET_LOG_BYTES_REQUEST: GetLogBytesRequestCommand getLogRequest = JSONUtils.parseObject( command.getBody(), GetLogBytesRequestCommand.class); String path = getLogRequest.getPath(); if (!checkPathSecurity(path)) { throw new IllegalArgumentException("Illegal path");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,341
[Bug] [Worker] Worker will not exit when fail to start
### 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 When the worker start failure due to database connect error or some other initializes error. The worker will hang, since there are some no-damon thread is still running. ### What you expected to happen When worker start failuer, the worker process exit. ### How to reproduce Set an error db connect info, then start worker. ### Anything else Find the worker process will not exit, use jstack find there are some thread is running. ### Version dev ### 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/10341
https://github.com/apache/dolphinscheduler/pull/10342
da3c25dc6792264d003b6f0a10341f04ef970997
516757cc7400b576ca0933dd5826005db06fa508
2022-06-02T07:41:23Z
java
2022-06-06T02:49:23Z
dolphinscheduler-log-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java
} byte[] bytes = getFileContentBytes(path); GetLogBytesResponseCommand getLogResponse = new GetLogBytesResponseCommand(bytes); channel.writeAndFlush(getLogResponse.convert2Command(command.getOpaque())); break; case VIEW_WHOLE_LOG_REQUEST: ViewLogRequestCommand viewLogRequest = JSONUtils.parseObject( command.getBody(), ViewLogRequestCommand.class); String viewLogPath = viewLogRequest.getPath(); if (!checkPathSecurity(viewLogPath)) { throw new IllegalArgumentException("Illegal path"); } String msg = LoggerUtils.readWholeFileContent(viewLogPath); ViewLogResponseCommand viewLogResponse = new ViewLogResponseCommand(msg); channel.writeAndFlush(viewLogResponse.convert2Command(command.getOpaque())); break; case ROLL_VIEW_LOG_REQUEST: RollViewLogRequestCommand rollViewLogRequest = JSONUtils.parseObject( command.getBody(), RollViewLogRequestCommand.class); String rollViewLogPath = rollViewLogRequest.getPath(); if (!checkPathSecurity(rollViewLogPath)) { throw new IllegalArgumentException("Illegal path"); } List<String> lines = readPartFileContent(rollViewLogPath, rollViewLogRequest.getSkipLineNum(), rollViewLogRequest.getLimit()); StringBuilder builder = new StringBuilder(); for (String line : lines) { builder.append(line).append("\r\n"); } RollViewLogResponseCommand rollViewLogRequestResponse = new RollViewLogResponseCommand(builder.toString());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,341
[Bug] [Worker] Worker will not exit when fail to start
### 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 When the worker start failure due to database connect error or some other initializes error. The worker will hang, since there are some no-damon thread is still running. ### What you expected to happen When worker start failuer, the worker process exit. ### How to reproduce Set an error db connect info, then start worker. ### Anything else Find the worker process will not exit, use jstack find there are some thread is running. ### Version dev ### 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/10341
https://github.com/apache/dolphinscheduler/pull/10342
da3c25dc6792264d003b6f0a10341f04ef970997
516757cc7400b576ca0933dd5826005db06fa508
2022-06-02T07:41:23Z
java
2022-06-06T02:49:23Z
dolphinscheduler-log-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java
channel.writeAndFlush(rollViewLogRequestResponse.convert2Command(command.getOpaque())); break; case REMOVE_TAK_LOG_REQUEST: RemoveTaskLogRequestCommand removeTaskLogRequest = JSONUtils.parseObject( command.getBody(), RemoveTaskLogRequestCommand.class); String taskLogPath = removeTaskLogRequest.getPath(); if (!checkPathSecurity(taskLogPath)) { throw new IllegalArgumentException("Illegal path"); } File taskLogFile = new File(taskLogPath); boolean status = true; try { if (taskLogFile.exists()) { status = taskLogFile.delete(); } } catch (Exception e) { status = false; } RemoveTaskLogResponseCommand removeTaskLogResponse = new RemoveTaskLogResponseCommand(status); channel.writeAndFlush(removeTaskLogResponse.convert2Command(command.getOpaque())); break; default: throw new IllegalArgumentException("unknown commandType"); } } /** * LogServer only can read the logs dir. * @param path * @return */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,341
[Bug] [Worker] Worker will not exit when fail to start
### 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 When the worker start failure due to database connect error or some other initializes error. The worker will hang, since there are some no-damon thread is still running. ### What you expected to happen When worker start failuer, the worker process exit. ### How to reproduce Set an error db connect info, then start worker. ### Anything else Find the worker process will not exit, use jstack find there are some thread is running. ### Version dev ### 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/10341
https://github.com/apache/dolphinscheduler/pull/10342
da3c25dc6792264d003b6f0a10341f04ef970997
516757cc7400b576ca0933dd5826005db06fa508
2022-06-02T07:41:23Z
java
2022-06-06T02:49:23Z
dolphinscheduler-log-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java
private boolean checkPathSecurity(String path) { String dsHome = System.getProperty("DOLPHINSCHEDULER_WORKER_HOME"); if (StringUtils.isBlank(dsHome)) { dsHome = System.getProperty("user.dir"); } if (StringUtils.isBlank(path)) { logger.warn("path is null"); return false; } else { return path.startsWith(dsHome) && !path.contains("../") && path.endsWith(".log"); } } public ExecutorService getExecutor() { return this.executor; } /** * get files content bytes for download file * * @param filePath file path * @return byte array of file */ private byte[] getFileContentBytes(String filePath) { try (InputStream in = new FileInputStream(filePath); ByteArrayOutputStream bos = new ByteArrayOutputStream()) { byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) != -1) { bos.write(buf, 0, len); } return bos.toByteArray();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,341
[Bug] [Worker] Worker will not exit when fail to start
### 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 When the worker start failure due to database connect error or some other initializes error. The worker will hang, since there are some no-damon thread is still running. ### What you expected to happen When worker start failuer, the worker process exit. ### How to reproduce Set an error db connect info, then start worker. ### Anything else Find the worker process will not exit, use jstack find there are some thread is running. ### Version dev ### 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/10341
https://github.com/apache/dolphinscheduler/pull/10342
da3c25dc6792264d003b6f0a10341f04ef970997
516757cc7400b576ca0933dd5826005db06fa508
2022-06-02T07:41:23Z
java
2022-06-06T02:49:23Z
dolphinscheduler-log-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java
} catch (IOException e) { logger.error("get file bytes error", e); } return new byte[0]; } /** * read part file content,can skip any line and read some lines * * @param filePath file path * @param skipLine skip line * @param limit read lines limit * @return part file content */ private List<String> readPartFileContent(String filePath, int skipLine, int limit) { File file = new File(filePath); if (file.exists() && file.isFile()) { try (Stream<String> stream = Files.lines(Paths.get(filePath))) { return stream.skip(skipLine).limit(limit).collect(Collectors.toList()); } catch (IOException e) { logger.error("read file error", e); } } else { logger.info("file path: {} not exists", filePath); } return Collections.emptyList(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,341
[Bug] [Worker] Worker will not exit when fail to start
### 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 When the worker start failure due to database connect error or some other initializes error. The worker will hang, since there are some no-damon thread is still running. ### What you expected to happen When worker start failuer, the worker process exit. ### How to reproduce Set an error db connect info, then start worker. ### Anything else Find the worker process will not exit, use jstack find there are some thread is running. ### Version dev ### 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/10341
https://github.com/apache/dolphinscheduler/pull/10342
da3c25dc6792264d003b6f0a10341f04ef970997
516757cc7400b576ca0933dd5826005db06fa508
2022-06-02T07:41:23Z
java
2022-06-06T02:49:23Z
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/NettyRemotingServer.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.remote; import org.apache.dolphinscheduler.remote.codec.NettyDecoder;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,341
[Bug] [Worker] Worker will not exit when fail to start
### 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 When the worker start failure due to database connect error or some other initializes error. The worker will hang, since there are some no-damon thread is still running. ### What you expected to happen When worker start failuer, the worker process exit. ### How to reproduce Set an error db connect info, then start worker. ### Anything else Find the worker process will not exit, use jstack find there are some thread is running. ### Version dev ### 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/10341
https://github.com/apache/dolphinscheduler/pull/10342
da3c25dc6792264d003b6f0a10341f04ef970997
516757cc7400b576ca0933dd5826005db06fa508
2022-06-02T07:41:23Z
java
2022-06-06T02:49:23Z
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/NettyRemotingServer.java
import org.apache.dolphinscheduler.remote.codec.NettyEncoder; import org.apache.dolphinscheduler.remote.command.CommandType; import org.apache.dolphinscheduler.remote.config.NettyServerConfig; import org.apache.dolphinscheduler.remote.exceptions.RemoteException; import org.apache.dolphinscheduler.remote.handler.NettyServerHandler; import org.apache.dolphinscheduler.remote.processor.NettyRequestProcessor; import org.apache.dolphinscheduler.remote.utils.Constants; import org.apache.dolphinscheduler.remote.utils.NettyUtils; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.util.concurrent.ThreadFactoryBuilder; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; import io.netty.channel.epoll.Epoll; import io.netty.channel.epoll.EpollEventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.handler.timeout.IdleStateHandler; /** * remoting netty server */ public class NettyRemotingServer {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,341
[Bug] [Worker] Worker will not exit when fail to start
### 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 When the worker start failure due to database connect error or some other initializes error. The worker will hang, since there are some no-damon thread is still running. ### What you expected to happen When worker start failuer, the worker process exit. ### How to reproduce Set an error db connect info, then start worker. ### Anything else Find the worker process will not exit, use jstack find there are some thread is running. ### Version dev ### 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/10341
https://github.com/apache/dolphinscheduler/pull/10342
da3c25dc6792264d003b6f0a10341f04ef970997
516757cc7400b576ca0933dd5826005db06fa508
2022-06-02T07:41:23Z
java
2022-06-06T02:49:23Z
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/NettyRemotingServer.java
private final Logger logger = LoggerFactory.getLogger(NettyRemotingServer.class); /** * server bootstrap */ private final ServerBootstrap serverBootstrap = new ServerBootstrap(); /** * default executor */ private final ExecutorService defaultExecutor = Executors.newFixedThreadPool(Constants.CPUS); /** * boss group */ private final EventLoopGroup bossGroup; /** * worker group */ private final EventLoopGroup workGroup; /** * server config */ private final NettyServerConfig serverConfig; /** * server handler
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,341
[Bug] [Worker] Worker will not exit when fail to start
### 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 When the worker start failure due to database connect error or some other initializes error. The worker will hang, since there are some no-damon thread is still running. ### What you expected to happen When worker start failuer, the worker process exit. ### How to reproduce Set an error db connect info, then start worker. ### Anything else Find the worker process will not exit, use jstack find there are some thread is running. ### Version dev ### 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/10341
https://github.com/apache/dolphinscheduler/pull/10342
da3c25dc6792264d003b6f0a10341f04ef970997
516757cc7400b576ca0933dd5826005db06fa508
2022-06-02T07:41:23Z
java
2022-06-06T02:49:23Z
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/NettyRemotingServer.java
*/ private final NettyServerHandler serverHandler = new NettyServerHandler(this); /** * started flag */ private final AtomicBoolean isStarted = new AtomicBoolean(false); /** * Netty server bind fail message */ private static final String NETTY_BIND_FAILURE_MSG = "NettyRemotingServer bind %s fail"; /** * server init * * @param serverConfig server config */ public NettyRemotingServer(final NettyServerConfig serverConfig) { this.serverConfig = serverConfig; ThreadFactory bossThreadFactory = new ThreadFactoryBuilder().setNameFormat("NettyServerBossThread_%s").build(); ThreadFactory workerThreadFactory = new ThreadFactoryBuilder().setNameFormat("NettyServerWorkerThread_%s").build(); if (Epoll.isAvailable()) { this.bossGroup = new EpollEventLoopGroup(1, bossThreadFactory); this.workGroup = new EpollEventLoopGroup(serverConfig.getWorkerThread(), workerThreadFactory); } else { this.bossGroup = new NioEventLoopGroup(1, bossThreadFactory); this.workGroup = new NioEventLoopGroup(serverConfig.getWorkerThread(), workerThreadFactory); } } /** * server start */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,341
[Bug] [Worker] Worker will not exit when fail to start
### 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 When the worker start failure due to database connect error or some other initializes error. The worker will hang, since there are some no-damon thread is still running. ### What you expected to happen When worker start failuer, the worker process exit. ### How to reproduce Set an error db connect info, then start worker. ### Anything else Find the worker process will not exit, use jstack find there are some thread is running. ### Version dev ### 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/10341
https://github.com/apache/dolphinscheduler/pull/10342
da3c25dc6792264d003b6f0a10341f04ef970997
516757cc7400b576ca0933dd5826005db06fa508
2022-06-02T07:41:23Z
java
2022-06-06T02:49:23Z
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/NettyRemotingServer.java
public void start() { if (isStarted.compareAndSet(false, true)) { this.serverBootstrap .group(this.bossGroup, this.workGroup) .channel(NettyUtils.getServerSocketChannelClass()) .option(ChannelOption.SO_REUSEADDR, true) .option(ChannelOption.SO_BACKLOG, serverConfig.getSoBacklog()) .childOption(ChannelOption.SO_KEEPALIVE, serverConfig.isSoKeepalive()) .childOption(ChannelOption.TCP_NODELAY, serverConfig.isTcpNoDelay()) .childOption(ChannelOption.SO_SNDBUF, serverConfig.getSendBufferSize()) .childOption(ChannelOption.SO_RCVBUF, serverConfig.getReceiveBufferSize()) .childHandler(new ChannelInitializer<SocketChannel>() { @Override protected void initChannel(SocketChannel ch) { initNettyChannel(ch); } }); ChannelFuture future; try { future = serverBootstrap.bind(serverConfig.getListenPort()).sync(); } catch (Exception e) { logger.error("NettyRemotingServer bind fail {}, exit", e.getMessage(), e); throw new RemoteException(String.format(NETTY_BIND_FAILURE_MSG, serverConfig.getListenPort())); } if (future.isSuccess()) { logger.info("NettyRemotingServer bind success at port : {}", serverConfig.getListenPort()); } else if (future.cause() != null) { throw new RemoteException(String.format(NETTY_BIND_FAILURE_MSG, serverConfig.getListenPort()), future.cause()); } else { throw new RemoteException(String.format(NETTY_BIND_FAILURE_MSG, serverConfig.getListenPort()));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,341
[Bug] [Worker] Worker will not exit when fail to start
### 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 When the worker start failure due to database connect error or some other initializes error. The worker will hang, since there are some no-damon thread is still running. ### What you expected to happen When worker start failuer, the worker process exit. ### How to reproduce Set an error db connect info, then start worker. ### Anything else Find the worker process will not exit, use jstack find there are some thread is running. ### Version dev ### 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/10341
https://github.com/apache/dolphinscheduler/pull/10342
da3c25dc6792264d003b6f0a10341f04ef970997
516757cc7400b576ca0933dd5826005db06fa508
2022-06-02T07:41:23Z
java
2022-06-06T02:49:23Z
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/NettyRemotingServer.java
} } } /** * init netty channel * * @param ch socket channel */ private void initNettyChannel(SocketChannel ch) { ch.pipeline() .addLast("encoder", new NettyEncoder()) .addLast("decoder", new NettyDecoder()) .addLast("server-idle-handle", new IdleStateHandler(0, 0, Constants.NETTY_SERVER_HEART_BEAT_TIME, TimeUnit.MILLISECONDS)) .addLast("handler", serverHandler); } /** * register processor * * @param commandType command type * @param processor processor */ public void registerProcessor(final CommandType commandType, final NettyRequestProcessor processor) { this.registerProcessor(commandType, processor, null); } /** * register processor * * @param commandType command type * @param processor processor * @param executor thread executor
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,341
[Bug] [Worker] Worker will not exit when fail to start
### 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 When the worker start failure due to database connect error or some other initializes error. The worker will hang, since there are some no-damon thread is still running. ### What you expected to happen When worker start failuer, the worker process exit. ### How to reproduce Set an error db connect info, then start worker. ### Anything else Find the worker process will not exit, use jstack find there are some thread is running. ### Version dev ### 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/10341
https://github.com/apache/dolphinscheduler/pull/10342
da3c25dc6792264d003b6f0a10341f04ef970997
516757cc7400b576ca0933dd5826005db06fa508
2022-06-02T07:41:23Z
java
2022-06-06T02:49:23Z
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/NettyRemotingServer.java
*/ public void registerProcessor(final CommandType commandType, final NettyRequestProcessor processor, final ExecutorService executor) { this.serverHandler.registerProcessor(commandType, processor, executor); } /** * get default thread executor * * @return thread executor */ public ExecutorService getDefaultExecutor() { return defaultExecutor; } public void close() { if (isStarted.compareAndSet(true, false)) { try { if (bossGroup != null) { this.bossGroup.shutdownGracefully(); } if (workGroup != null) { this.workGroup.shutdownGracefully(); } defaultExecutor.shutdown(); } catch (Exception ex) { logger.error("netty server close exception", ex); } logger.info("netty server closed"); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.common; import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.SystemUtils; import java.util.regex.Pattern; /** * Constants */ public final class Constants { private Constants() { throw new UnsupportedOperationException("Construct Constants"); } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
* common properties path */ public static final String COMMON_PROPERTIES_PATH = "/common.properties"; /** * registry properties */ public static final String REGISTRY_DOLPHINSCHEDULER_MASTERS = "/nodes/master"; public static final String REGISTRY_DOLPHINSCHEDULER_WORKERS = "/nodes/worker"; public static final String REGISTRY_DOLPHINSCHEDULER_DEAD_SERVERS = "/dead-servers"; public static final String REGISTRY_DOLPHINSCHEDULER_NODE = "/nodes"; public static final String REGISTRY_DOLPHINSCHEDULER_LOCK_MASTERS = "/lock/masters"; public static final String REGISTRY_DOLPHINSCHEDULER_LOCK_FAILOVER_MASTERS = "/lock/failover/masters"; public static final String REGISTRY_DOLPHINSCHEDULER_LOCK_FAILOVER_WORKERS = "/lock/failover/workers"; public static final String REGISTRY_DOLPHINSCHEDULER_LOCK_FAILOVER_STARTUP_MASTERS = "/lock/failover/startup-masters"; public static final String FORMAT_SS = "%s%s"; public static final String FORMAT_S_S = "%s/%s"; public static final String FOLDER_SEPARATOR = "/"; public static final String RESOURCE_TYPE_FILE = "resources"; public static final String RESOURCE_TYPE_UDF = "udfs"; public static final String STORAGE_S3 = "S3"; public static final String STORAGE_HDFS = "HDFS"; public static final String BUCKET_NAME = "dolphinscheduler-test"; public static final String EMPTY_STRING = ""; /** * fs.defaultFS */ public static final String FS_DEFAULT_FS = "fs.defaultFS"; /** * hadoop configuration */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String HADOOP_RM_STATE_ACTIVE = "ACTIVE"; public static final String HADOOP_RESOURCE_MANAGER_HTTPADDRESS_PORT = "resource.manager.httpaddress.port"; /** * yarn.resourcemanager.ha.rm.ids */ public static final String YARN_RESOURCEMANAGER_HA_RM_IDS = "yarn.resourcemanager.ha.rm.ids"; /** * yarn.application.status.address */ public static final String YARN_APPLICATION_STATUS_ADDRESS = "yarn.application.status.address"; /** * yarn.job.history.status.address */ public static final String YARN_JOB_HISTORY_STATUS_ADDRESS = "yarn.job.history.status.address"; /** * hdfs configuration * hdfs.root.user */ public static final String HDFS_ROOT_USER = "hdfs.root.user"; /** * hdfs/s3 configuration * resource.upload.path */ public static final String RESOURCE_UPLOAD_PATH = "resource.upload.path"; /** * data basedir path */ public static final String DATA_BASEDIR_PATH = "data.basedir.path"; /** * dolphinscheduler.env.path
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
*/ public static final String DOLPHINSCHEDULER_ENV_PATH = "dolphinscheduler.env.path"; /** * environment properties default path */ public static final String ENV_PATH = "dolphinscheduler_env.sh"; /** * resource.view.suffixs */ public static final String RESOURCE_VIEW_SUFFIXES = "resource.view.suffixs"; public static final String RESOURCE_VIEW_SUFFIXES_DEFAULT_VALUE = "txt,log,sh,bat,conf,cfg,py,java,sql,xml,hql,properties,json,yml,yaml,ini,js"; /** * development.state */ public static final String DEVELOPMENT_STATE = "development.state"; /** * sudo enable */ public static final String SUDO_ENABLE = "sudo.enable"; /** * string true */ public static final String STRING_TRUE = "true"; /** * resource storage type */ public static final String RESOURCE_STORAGE_TYPE = "resource.storage.type"; public static final String AWS_END_POINT = "aws.endpoint"; /** * comma ,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
*/ public static final String COMMA = ","; /** * COLON : */ public static final String COLON = ":"; /** * QUESTION ? */ public static final String QUESTION = "?"; /** * SPACE " " */ public static final String SPACE = " "; /** * SINGLE_SLASH / */ public static final String SINGLE_SLASH = "/"; /** * DOUBLE_SLASH // */ public static final String DOUBLE_SLASH = "//"; /** * EQUAL SIGN */ public static final String EQUAL_SIGN = "="; /** * AT SIGN */ public static final String AT_SIGN = "@";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
/** * date format of yyyy-MM-dd HH:mm:ss */ public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; /** * date format of yyyyMMdd */ public static final String YYYYMMDD = "yyyyMMdd"; /** * date format of yyyyMMddHHmmss */ public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; /** * date format of yyyyMMddHHmmssSSS */ public static final String YYYYMMDDHHMMSSSSS = "yyyyMMddHHmmssSSS"; /** * http connect time out */ public static final int HTTP_CONNECT_TIMEOUT = 60 * 1000; /** * http connect request time out */ public static final int HTTP_CONNECTION_REQUEST_TIMEOUT = 60 * 1000; /** * httpclient soceket time out */ public static final int SOCKET_TIMEOUT = 60 * 1000; /** * registry session timeout
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
*/ public static final int REGISTRY_SESSION_TIMEOUT = 10 * 1000; /** * http header */ public static final String HTTP_HEADER_UNKNOWN = "unKnown"; /** * http X-Forwarded-For */ public static final String HTTP_X_FORWARDED_FOR = "X-Forwarded-For"; /** * http X-Real-IP */ public static final String HTTP_X_REAL_IP = "X-Real-IP"; /** * UTF-8 */ public static final String UTF_8 = "UTF-8"; /** * user name regex */ public static final Pattern REGEX_USER_NAME = Pattern.compile("^[a-zA-Z0-9._-]{3,39}$"); /** * read permission */ public static final int READ_PERMISSION = 2; /** * write permission */ public static final int WRITE_PERMISSION = 2 * 2;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
/** * execute permission */ public static final int EXECUTE_PERMISSION = 1; /** * default admin permission */ public static final int DEFAULT_ADMIN_PERMISSION = 7; /** * default hash map size */ public static final int DEFAULT_HASH_MAP_SIZE = 16; /** * all permissions */ public static final int ALL_PERMISSIONS = READ_PERMISSION | WRITE_PERMISSION | EXECUTE_PERMISSION; /** * max task timeout */ public static final int MAX_TASK_TIMEOUT = 24 * 3600; /** * worker host weight */ public static final int DEFAULT_WORKER_HOST_WEIGHT = 100; /** * time unit secong to minutes */ public static final int SEC_2_MINUTES_TIME_UNIT = 60; /*** *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
* rpc port */ public static final String RPC_PORT = "rpc.port"; /** * forbid running task */ public static final String FLOWNODE_RUN_FLAG_FORBIDDEN = "FORBIDDEN"; /** * normal running task */ public static final String FLOWNODE_RUN_FLAG_NORMAL = "NORMAL"; public static final String COMMON_TASK_TYPE = "common"; public static final String DEFAULT = "default"; public static final String PASSWORD = "password"; public static final String XXXXXX = "******"; public static final String NULL = "NULL"; public static final String THREAD_NAME_MASTER_SERVER = "Master-Server"; public static final String THREAD_NAME_WORKER_SERVER = "Worker-Server"; public static final String THREAD_NAME_ALERT_SERVER = "Alert-Server"; /** * command parameter keys */ public static final String CMD_PARAM_RECOVER_PROCESS_ID_STRING = "ProcessInstanceId"; public static final String CMD_PARAM_RECOVERY_START_NODE_STRING = "StartNodeIdList"; public static final String CMD_PARAM_RECOVERY_WAITING_THREAD = "WaitingThreadInstanceId"; public static final String CMD_PARAM_SUB_PROCESS = "processInstanceId"; public static final String CMD_PARAM_EMPTY_SUB_PROCESS = "0"; public static final String CMD_PARAM_SUB_PROCESS_PARENT_INSTANCE_ID = "parentProcessInstanceId"; public static final String CMD_PARAM_SUB_PROCESS_DEFINE_CODE = "processDefinitionCode"; public static final String CMD_PARAM_START_NODES = "StartNodeList";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String CMD_PARAM_START_PARAMS = "StartParams"; public static final String CMD_PARAM_FATHER_PARAMS = "fatherParams"; /** * complement data start date */ public static final String CMDPARAM_COMPLEMENT_DATA_START_DATE = "complementStartDate"; /** * complement data end date */ public static final String CMDPARAM_COMPLEMENT_DATA_END_DATE = "complementEndDate"; /** * complement date default cron string */ public static final String DEFAULT_CRON_STRING = "0 0 0 * * ? *"; /** * sleep 1000ms */ public static final int SLEEP_TIME_MILLIS = 1000; /** * short sleep 100ms */ public static final int SLEEP_TIME_MILLIS_SHORT = 100; /** * one second mils */ public static final int SECOND_TIME_MILLIS = 1000; /** * master task instance cache-database refresh interval */ public static final int CACHE_REFRESH_TIME_MILLIS = 20 * 1000;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
/** * heartbeat for zk info length */ public static final int HEARTBEAT_FOR_ZOOKEEPER_INFO_LENGTH = 13; /** * jar */ public static final String JAR = "jar"; /** * hadoop */ public static final String HADOOP = "hadoop"; /** * -D <property>=<value> */ public static final String D = "-D"; /** * exit code success */ public static final int EXIT_CODE_SUCCESS = 0; /** * exit code failure */ public static final int EXIT_CODE_FAILURE = -1; /** * process or task definition failure */ public static final int DEFINITION_FAILURE = -1; public static final int OPPOSITE_VALUE = -1; /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
* process or task definition first version */ public static final int VERSION_FIRST = 1; /** * date format of yyyyMMdd */ public static final String PARAMETER_FORMAT_DATE = "yyyyMMdd"; /** * date format of yyyyMMddHHmmss */ public static final String PARAMETER_FORMAT_TIME = "yyyyMMddHHmmss"; /** * system date(yyyyMMddHHmmss) */ public static final String PARAMETER_DATETIME = "system.datetime"; /** * system date(yyyymmdd) today */ public static final String PARAMETER_CURRENT_DATE = "system.biz.curdate"; /** * system date(yyyymmdd) yesterday */ public static final String PARAMETER_BUSINESS_DATE = "system.biz.date"; /** * ACCEPTED */ public static final String ACCEPTED = "ACCEPTED"; /** * SUCCEEDED */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String SUCCEEDED = "SUCCEEDED"; /** * ENDED */ public static final String ENDED = "ENDED"; /** * NEW */ public static final String NEW = "NEW"; /** * NEW_SAVING */ public static final String NEW_SAVING = "NEW_SAVING"; /** * SUBMITTED */ public static final String SUBMITTED = "SUBMITTED"; /** * FAILED */ public static final String FAILED = "FAILED"; /** * KILLED */ public static final String KILLED = "KILLED"; /** * RUNNING */ public static final String RUNNING = "RUNNING"; /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
* underline "_" */ public static final String UNDERLINE = "_"; /** * application regex */ public static final String APPLICATION_REGEX = "application_\\d+_\\d+"; public static final String PID = SystemUtils.IS_OS_WINDOWS ? "handle" : "pid"; /** * month_begin */ public static final String MONTH_BEGIN = "month_begin"; /** * add_months */ public static final String ADD_MONTHS = "add_months"; /** * month_end */ public static final String MONTH_END = "month_end"; /** * week_begin */ public static final String WEEK_BEGIN = "week_begin"; /** * week_end */ public static final String WEEK_END = "week_end"; /** * timestamp
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
*/ public static final String TIMESTAMP = "timestamp"; public static final char SUBTRACT_CHAR = '-'; public static final char ADD_CHAR = '+'; public static final char MULTIPLY_CHAR = '*'; public static final char DIVISION_CHAR = '/'; public static final char LEFT_BRACE_CHAR = '('; public static final char RIGHT_BRACE_CHAR = ')'; public static final String ADD_STRING = "+"; public static final String STAR = "*"; public static final String DIVISION_STRING = "/"; public static final String LEFT_BRACE_STRING = "("; public static final char P = 'P'; public static final char N = 'N'; public static final String SUBTRACT_STRING = "-"; public static final String GLOBAL_PARAMS = "globalParams"; public static final String LOCAL_PARAMS = "localParams"; public static final String SUBPROCESS_INSTANCE_ID = "subProcessInstanceId"; public static final String PROCESS_INSTANCE_STATE = "processInstanceState"; public static final String PARENT_WORKFLOW_INSTANCE = "parentWorkflowInstance"; public static final String CONDITION_RESULT = "conditionResult"; public static final String SWITCH_RESULT = "switchResult"; public static final String WAIT_START_TIMEOUT = "waitStartTimeout"; public static final String DEPENDENCE = "dependence"; public static final String TASK_LIST = "taskList"; public static final String QUEUE = "queue"; public static final String QUEUE_NAME = "queueName"; public static final int LOG_QUERY_SKIP_LINE_NUMBER = 0; public static final int LOG_QUERY_LIMIT = 4096; public static final String BLOCKING_CONDITION = "blockingCondition";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String ALERT_WHEN_BLOCKING = "alertWhenBlocking"; /** * master/worker server use for zk */ public static final String MASTER_TYPE = "master"; public static final String WORKER_TYPE = "worker"; public static final String DELETE_OP = "delete"; public static final String ADD_OP = "add"; public static final String ALIAS = "alias"; public static final String CONTENT = "content"; public static final String DEPENDENT_SPLIT = ":||"; public static final long DEPENDENT_ALL_TASK_CODE = 0; /** * preview schedule execute count */ public static final int PREVIEW_SCHEDULE_EXECUTE_COUNT = 5; /** * kerberos */ public static final String KERBEROS = "kerberos"; /** * kerberos expire time */ public static final String KERBEROS_EXPIRE_TIME = "kerberos.expire.time"; /** * java.security.krb5.conf */ public static final String JAVA_SECURITY_KRB5_CONF = "java.security.krb5.conf"; /** * java.security.krb5.conf.path
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
*/ public static final String JAVA_SECURITY_KRB5_CONF_PATH = "java.security.krb5.conf.path"; /** * hadoop.security.authentication */ public static final String HADOOP_SECURITY_AUTHENTICATION = "hadoop.security.authentication"; /** * hadoop.security.authentication */ public static final String HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE = "hadoop.security.authentication.startup.state"; /** * com.amazonaws.services.s3.enableV4 */ public static final String AWS_S3_V4 = "com.amazonaws.services.s3.enableV4"; /** * loginUserFromKeytab user */ public static final String LOGIN_USER_KEY_TAB_USERNAME = "login.user.keytab.username"; /** * loginUserFromKeytab path */ public static final String LOGIN_USER_KEY_TAB_PATH = "login.user.keytab.path"; /** * task log info format */ public static final String TASK_LOG_INFO_FORMAT = "TaskLogInfo-%s"; public static final int[] NOT_TERMINATED_STATES = new int[]{ ExecutionStatus.SUBMITTED_SUCCESS.ordinal(), ExecutionStatus.DISPATCH.ordinal(), ExecutionStatus.RUNNING_EXECUTION.ordinal(),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
ExecutionStatus.DELAY_EXECUTION.ordinal(), ExecutionStatus.READY_PAUSE.ordinal(), ExecutionStatus.READY_STOP.ordinal(), ExecutionStatus.NEED_FAULT_TOLERANCE.ordinal(), ExecutionStatus.WAITING_THREAD.ordinal(), ExecutionStatus.WAITING_DEPEND.ordinal() }; public static final int[] RUNNING_PROCESS_STATE = new int[]{ ExecutionStatus.RUNNING_EXECUTION.ordinal(), ExecutionStatus.SUBMITTED_SUCCESS.ordinal(), ExecutionStatus.DISPATCH.ordinal(), ExecutionStatus.SERIAL_WAIT.ordinal() }; /** * status */ public static final String STATUS = "status"; /** * message */ public static final String MSG = "msg"; /** * data total */ public static final String COUNT = "count"; /** * page size */ public static final String PAGE_SIZE = "pageSize"; /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
* current page no */ public static final String PAGE_NUMBER = "pageNo"; /** * */ public static final String DATA_LIST = "data"; public static final String TOTAL_LIST = "totalList"; public static final String CURRENT_PAGE = "currentPage"; public static final String TOTAL_PAGE = "totalPage"; public static final String TOTAL = "total"; /** * workflow */ public static final String WORKFLOW_LIST = "workFlowList"; public static final String WORKFLOW_RELATION_LIST = "workFlowRelationList"; /** * session user */ public static final String SESSION_USER = "session.user"; public static final String SESSION_ID = "sessionId"; /** * locale */ public static final String LOCALE_LANGUAGE = "language"; /** * database type */ public static final String MYSQL = "MYSQL"; public static final String HIVE = "HIVE";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String ADDRESS = "address"; public static final String DATABASE = "database"; public static final String OTHER = "other"; public static final String USER = "user"; public static final String JDBC_URL = "jdbcUrl"; /** * session timeout */ public static final int SESSION_TIME_OUT = 7200; public static final int MAX_FILE_SIZE = 1024 * 1024 * 1024; public static final String UDF = "UDF"; public static final String CLASS = "class"; /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; /** * default worker group */ public static final String DEFAULT_WORKER_GROUP = "default"; /** * authorize writable perm */ public static final int AUTHORIZE_WRITABLE_PERM = 7; /** * authorize readable perm */ public static final int AUTHORIZE_READABLE_PERM = 4; public static final int NORMAL_NODE_STATUS = 0; public static final int ABNORMAL_NODE_STATUS = 1;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final int BUSY_NODE_STATUE = 2; public static final String START_TIME = "start time"; public static final String END_TIME = "end time"; public static final String START_END_DATE = "startDate,endDate"; /** * system line separator */ public static final String SYSTEM_LINE_SEPARATOR = System.getProperty("line.separator"); /** * datasource encryption salt */ public static final String DATASOURCE_ENCRYPTION_SALT_DEFAULT = "!@#$%^&*"; public static final String DATASOURCE_ENCRYPTION_ENABLE = "datasource.encryption.enable"; public static final String DATASOURCE_ENCRYPTION_SALT = "datasource.encryption.salt"; /** * network interface preferred */ public static final String DOLPHIN_SCHEDULER_NETWORK_INTERFACE_PREFERRED = "dolphin.scheduler.network.interface.preferred"; /** * network IP gets priority, default inner outer */ public static final String DOLPHIN_SCHEDULER_NETWORK_PRIORITY_STRATEGY = "dolphin.scheduler.network.priority.strategy"; /** * exec shell scripts */ public static final String SH = "sh"; /** * pstree, get pud and sub pid */ public static final String PSTREE = "pstree";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final Boolean KUBERNETES_MODE = !StringUtils.isEmpty(System.getenv("KUBERNETES_SERVICE_HOST")) && !StringUtils.isEmpty(System.getenv("KUBERNETES_SERVICE_PORT")); /** * dry run flag */ public static final int DRY_RUN_FLAG_NO = 0; public static final int DRY_RUN_FLAG_YES = 1; /** * data.quality.error.output.path */ public static final String DATA_QUALITY_ERROR_OUTPUT_PATH = "data-quality.error.output.path"; public static final String CACHE_KEY_VALUE_ALL = "'all'"; /** * use for k8s */ public static final String NAMESPACE = "namespace"; public static final String K8S = "k8s"; public static final String LIMITS_CPU = "limitsCpu"; public static final String LIMITS_MEMORY = "limitsMemory"; public static final String K8S_LOCAL_TEST_CLUSTER = "ds_null_k8s"; /** * schedule timezone */ public static final String SCHEDULE_TIMEZONE = "schedule_timezone"; public static final int RESOURCE_FULL_NAME_MAX_LENGTH = 128; /** * tenant */ public static final int TENANT_FULL_NAME_MAX_LENGTH = 30; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HeartBeat.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.common.utils; import org.apache.dolphinscheduler.common.Constants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class HeartBeat { private static final Logger logger = LoggerFactory.getLogger(HeartBeat.class); private long startupTime; private long reportTime; private double cpuUsage; private double memoryUsage; private double loadAverage;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HeartBeat.java
private double availablePhysicalMemorySize; private double maxCpuloadAvg; private double reservedMemory; private int serverStatus; private int processId; private int workerHostWeight; private int workerWaitingTaskCount; private int workerExecThreadCount; public long getStartupTime() { return startupTime; } public void setStartupTime(long startupTime) { this.startupTime = startupTime; } public long getReportTime() { return reportTime; } public void setReportTime(long reportTime) { this.reportTime = reportTime; } public double getCpuUsage() { return cpuUsage; } public void setCpuUsage(double cpuUsage) { this.cpuUsage = cpuUsage; } public double getMemoryUsage() { return memoryUsage; } public void setMemoryUsage(double memoryUsage) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,190
[Bug] [E2E] The front-end page changes failed the E2E test
### 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 relevance https://github.com/apache/dolphinscheduler/pull/10186 https://github.com/apache/dolphinscheduler/runs/6548541522?check_suite_focus=true ![image](https://user-images.githubusercontent.com/29012717/169746696-a632c3ce-a8c4-40ae-b97d-8b0d1270393d.png) ### What you expected to happen pass ### How to reproduce pass ### Anything else _No response_ ### Version 3.0.0-alpha ### 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/10190
https://github.com/apache/dolphinscheduler/pull/10287
516757cc7400b576ca0933dd5826005db06fa508
67c4f2b25941392d66f282fd67a7f2b16388ef45
2022-05-23T05:03:47Z
java
2022-06-06T03:06:33Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HeartBeat.java
this.memoryUsage = memoryUsage; } public double getLoadAverage() { return loadAverage; } public void setLoadAverage(double loadAverage) { this.loadAverage = loadAverage; } public double getAvailablePhysicalMemorySize() { return availablePhysicalMemorySize; } public void setAvailablePhysicalMemorySize(double availablePhysicalMemorySize) { this.availablePhysicalMemorySize = availablePhysicalMemorySize; } public double getMaxCpuloadAvg() { return maxCpuloadAvg; } public void setMaxCpuloadAvg(double maxCpuloadAvg) { this.maxCpuloadAvg = maxCpuloadAvg; } public double getReservedMemory() { return reservedMemory; } public void setReservedMemory(double reservedMemory) { this.reservedMemory = reservedMemory; } public int getServerStatus() { return serverStatus; } public void setServerStatus(int serverStatus) {