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,409
[Bug] [Permission] No permission to modify the allocated resource data.
### 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 No permission to modify the allocated resource data. ### What you expected to happen Update success. ### How to reproduce Allocate resource data and then modify it. ### 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/10409
https://github.com/apache/dolphinscheduler/pull/10410
f4dad689d493dcd0d64026c6df3350ca0f9ba805
c843e3a31550c5a23c7e68624dfaa59bdd7957f8
2022-06-11T08:30:01Z
java
2022-06-12T10:27:49Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UdfFuncServiceTest.java
result = udfFuncService.updateUdfFunc(getLoginUser(), 1, "UdfFuncServiceTest", "org.apache.dolphinscheduler.api.service.UdfFuncServiceTest", "String", "UdfFuncServiceTest", "UdfFuncServiceTest", UdfType.HIVE, 1); logger.info(result.toString()); Assert.assertTrue(Status.HDFS_NOT_STARTUP.getCode() == result.getCode()); PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.UDF, 1, ApiFuncIdentificationConstant.UDF_FUNCTION_UPDATE, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.UDF, new Object[]{12}, 0, serviceLogger)).thenReturn(true); PowerMockito.when(udfFuncMapper.selectUdfById(11)).thenReturn(getUdfFunc()); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); result = udfFuncService.updateUdfFunc(getLoginUser(), 11, "UdfFuncServiceTest", "org.apache.dolphinscheduler.api.service.UdfFuncServiceTest", "String", "UdfFuncServiceTest", "UdfFuncServiceTest", UdfType.HIVE, 12); logger.info(result.toString()); Assert.assertTrue(Status.RESOURCE_NOT_EXIST.getCode() == result.getCode()); PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.UDF, 1, ApiFuncIdentificationConstant.UDF_FUNCTION_UPDATE, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.UDF, new Object[]{1}, 0, serviceLogger)).thenReturn(true); result = udfFuncService.updateUdfFunc(getLoginUser(), 11, "UdfFuncServiceTest", "org.apache.dolphinscheduler.api.service.UdfFuncServiceTest", "String", "UdfFuncServiceTest", "UdfFuncServiceTest", UdfType.HIVE, 1); logger.info(result.toString()); Assert.assertTrue(Status.SUCCESS.getCode() == result.getCode()); } @Test public void testQueryUdfFuncListPaging() { PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.UDF, 1, ApiFuncIdentificationConstant.UDF_FUNCTION_VIEW, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.UDF, null, 0, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.UDF, 1, udfLogger)).thenReturn(getSetIds()); IPage<UdfFunc> page = new Page<>(1,10); page.setTotal(1L); page.setRecords(getList()); Mockito.when(udfFuncMapper.queryUdfFuncPaging(Mockito.any(Page.class), Mockito.anyList(),Mockito.eq("test"))).thenReturn(page);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,409
[Bug] [Permission] No permission to modify the allocated resource data.
### 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 No permission to modify the allocated resource data. ### What you expected to happen Update success. ### How to reproduce Allocate resource data and then modify it. ### 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/10409
https://github.com/apache/dolphinscheduler/pull/10410
f4dad689d493dcd0d64026c6df3350ca0f9ba805
c843e3a31550c5a23c7e68624dfaa59bdd7957f8
2022-06-11T08:30:01Z
java
2022-06-12T10:27:49Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UdfFuncServiceTest.java
Result result = udfFuncService.queryUdfFuncListPaging(getLoginUser(),"test",1,10); logger.info(result.toString()); PageInfo pageInfo = (PageInfo) result.getData(); Assert.assertTrue(CollectionUtils.isNotEmpty(pageInfo.getTotalList())); } @Test public void testQueryUdfFuncList() { PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.UDF, 1, ApiFuncIdentificationConstant.UDF_FUNCTION_VIEW, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.UDF, null, 1, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.UDF, 1, udfLogger)).thenReturn(getSetIds()); User user = getLoginUser(); user.setUserType(UserType.GENERAL_USER); user.setId(1); Mockito.when(udfFuncMapper.getUdfFuncByType(Collections.singletonList(1), UdfType.HIVE.ordinal())).thenReturn(getList()); Result<Object> result = udfFuncService.queryUdfFuncList(user,UdfType.HIVE.ordinal()); logger.info(result.toString()); Assert.assertTrue(Status.SUCCESS.getCode() == result.getCode()); List<UdfFunc> udfFuncList = (List<UdfFunc>) result.getData(); Assert.assertTrue(CollectionUtils.isNotEmpty(udfFuncList)); } @Test public void testDelete() { PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.UDF, 1, ApiFuncIdentificationConstant.UDF_FUNCTION_DELETE, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.UDF, new Object[]{122}, 0, serviceLogger)).thenReturn(true); Mockito.when(udfFuncMapper.deleteById(Mockito.anyInt())).thenReturn(1); Mockito.when(udfUserMapper.deleteByUdfFuncId(Mockito.anyInt())).thenReturn(1); Result result = udfFuncService.delete(getLoginUser(), 122); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS.getMsg(),result.getMsg()); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,409
[Bug] [Permission] No permission to modify the allocated resource data.
### 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 No permission to modify the allocated resource data. ### What you expected to happen Update success. ### How to reproduce Allocate resource data and then modify it. ### 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/10409
https://github.com/apache/dolphinscheduler/pull/10410
f4dad689d493dcd0d64026c6df3350ca0f9ba805
c843e3a31550c5a23c7e68624dfaa59bdd7957f8
2022-06-11T08:30:01Z
java
2022-06-12T10:27:49Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UdfFuncServiceTest.java
@Test public void testVerifyUdfFuncByName() { PowerMockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.UDF, 1, ApiFuncIdentificationConstant.UDF_FUNCTION_VIEW, serviceLogger)).thenReturn(true); PowerMockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.UDF, null, 0, serviceLogger)).thenReturn(true); Mockito.when(udfFuncMapper.queryUdfByIdStr(null, "UdfFuncServiceTest")).thenReturn(getList()); Result result = udfFuncService.verifyUdfFuncByName(getLoginUser(), "test"); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS.getMsg(),result.getMsg()); result = udfFuncService.verifyUdfFuncByName(getLoginUser(), "UdfFuncServiceTest"); logger.info(result.toString()); Assert.assertEquals(Status.UDF_FUNCTION_EXISTS.getMsg(),result.getMsg()); } private Set<Integer> getSetIds(){ Set<Integer> set = new HashSet(); set.add(1); return set; } /** * create admin user * @return */ private User getLoginUser() { User loginUser = new User(); loginUser.setUserType(UserType.ADMIN_USER); loginUser.setId(1); return loginUser; } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,409
[Bug] [Permission] No permission to modify the allocated resource data.
### 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 No permission to modify the allocated resource data. ### What you expected to happen Update success. ### How to reproduce Allocate resource data and then modify it. ### 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/10409
https://github.com/apache/dolphinscheduler/pull/10410
f4dad689d493dcd0d64026c6df3350ca0f9ba805
c843e3a31550c5a23c7e68624dfaa59bdd7957f8
2022-06-11T08:30:01Z
java
2022-06-12T10:27:49Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UdfFuncServiceTest.java
* get resourceId */ private Resource getResource() { Resource resource = new Resource(); resource.setId(1); resource.setAlias("test"); return resource; } private List<UdfFunc> getList() { List<UdfFunc> udfFuncList = new ArrayList<>(); udfFuncList.add(getUdfFunc()); return udfFuncList; } /** * get UdfFuncRequest id */ private UdfFunc getUdfFunc() { UdfFunc udfFunc = new UdfFunc(); udfFunc.setFuncName("UdfFuncServiceTest"); udfFunc.setClassName("org.apache.dolphinscheduler.api.service.UdfFuncServiceTest"); udfFunc.setResourceId(0); udfFunc.setResourceName("UdfFuncServiceTest"); udfFunc.setCreateTime(new Date()); udfFunc.setDatabase("database"); udfFunc.setUpdateTime(new Date()); udfFunc.setType(UdfType.HIVE); return udfFunc; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
* limitations under the License. */ package org.apache.dolphinscheduler.api.python; import org.apache.dolphinscheduler.api.dto.resources.ResourceComponent; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.ExecutorService; import org.apache.dolphinscheduler.api.service.ProcessDefinitionService; import org.apache.dolphinscheduler.api.service.ProjectService; import org.apache.dolphinscheduler.api.service.QueueService; import org.apache.dolphinscheduler.api.service.ResourcesService; import org.apache.dolphinscheduler.api.service.SchedulerService; import org.apache.dolphinscheduler.api.service.TaskDefinitionService; import org.apache.dolphinscheduler.api.service.TenantService; import org.apache.dolphinscheduler.api.service.UsersService; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ComplementDependentMode; import org.apache.dolphinscheduler.common.enums.FailureStrategy; import org.apache.dolphinscheduler.common.enums.Priority; import org.apache.dolphinscheduler.common.enums.ProcessExecutionTypeEnum; import org.apache.dolphinscheduler.common.enums.ProgramType; import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.common.enums.RunMode; import org.apache.dolphinscheduler.common.enums.TaskDependType; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.enums.WarningType; import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils; import org.apache.dolphinscheduler.dao.entity.DataSource; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.Project;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
import org.apache.dolphinscheduler.dao.entity.ProjectUser; import org.apache.dolphinscheduler.dao.entity.Queue; import org.apache.dolphinscheduler.dao.entity.Schedule; import org.apache.dolphinscheduler.dao.entity.TaskDefinition; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectUserMapper; import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper; import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper; import org.apache.dolphinscheduler.api.configuration.PythonGatewayConfiguration; import org.apache.dolphinscheduler.spi.enums.ResourceType; import org.apache.commons.collections.CollectionUtils; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; import javax.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import py4j.GatewayServer; @Component
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
public class PythonGateway { private static final Logger logger = LoggerFactory.getLogger(PythonGateway.class); private static final FailureStrategy DEFAULT_FAILURE_STRATEGY = FailureStrategy.CONTINUE; private static final Priority DEFAULT_PRIORITY = Priority.MEDIUM; private static final Long DEFAULT_ENVIRONMENT_CODE = -1L; private static final TaskDependType DEFAULT_TASK_DEPEND_TYPE = TaskDependType.TASK_POST; private static final RunMode DEFAULT_RUN_MODE = RunMode.RUN_MODE_SERIAL; private static final int DEFAULT_DRY_RUN = 0; private static final ComplementDependentMode COMPLEMENT_DEPENDENT_MODE = ComplementDependentMode.OFF_MODE; @Autowired private ProcessDefinitionMapper processDefinitionMapper; @Autowired private ProjectService projectService; @Autowired private TenantService tenantService; @Autowired private ExecutorService executorService; @Autowired private ProcessDefinitionService processDefinitionService; @Autowired private TaskDefinitionService taskDefinitionService; @Autowired private UsersService usersService; @Autowired private QueueService queueService; @Autowired private ResourcesService resourceService; @Autowired private ProjectMapper projectMapper;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
@Autowired private TaskDefinitionMapper taskDefinitionMapper; @Autowired private SchedulerService schedulerService; @Autowired private ScheduleMapper scheduleMapper; @Autowired private DataSourceMapper dataSourceMapper; @Autowired private PythonGatewayConfiguration pythonGatewayConfiguration; @Autowired private ProjectUserMapper projectUserMapper; private final User dummyAdminUser = new User() { { setId(Integer.MAX_VALUE); setUserName("dummyUser"); setUserType(UserType.ADMIN_USER); } }; private final Queue queuePythonGateway = new Queue() { { setId(Integer.MAX_VALUE); setQueueName("queuePythonGateway"); } }; public String ping() { return "PONG"; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
public Map<String, Object> genTaskCodeList(Integer genNum) { return taskDefinitionService.genTaskCodeList(genNum); } public Map<String, Long> getCodeAndVersion(String projectName, String taskName) throws CodeGenerateUtils.CodeGenerateException { Project project = projectMapper.queryByName(projectName); Map<String, Long> result = new HashMap<>(); if (project == null) { result.put("code", CodeGenerateUtils.getInstance().genCode()); result.put("version", 0L); return result; } TaskDefinition taskDefinition = taskDefinitionMapper.queryByName(project.getCode(), taskName); if (taskDefinition == null) { result.put("code", CodeGenerateUtils.getInstance().genCode()); result.put("version", 0L); } else { result.put("code", taskDefinition.getCode()); result.put("version", (long) taskDefinition.getVersion()); } return result; } /** * create or update process definition. * If process definition do not exists in Project=`projectCode` would create a new one * If process definition already exists in Project=`projectCode` would update it * * @param userName user name who create or update process definition * @param projectName project name which process definition belongs to
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
* @param name process definition name * @param description description * @param globalParams global params * @param schedule schedule for process definition, will not set schedule if null, * and if would always fresh exists schedule if not null * @param warningType warning type * @param warningGroupId warning group id * @param locations locations json object about all tasks * @param timeout timeout for process definition working, if running time longer than timeout, * task will mark as fail * @param workerGroup run task in which worker group * @param tenantCode tenantCode * @param taskRelationJson relation json for nodes * @param taskDefinitionJson taskDefinitionJson * @return create result code */ public Long createOrUpdateProcessDefinition(String userName, String projectName, String name, String description, String globalParams, String schedule, String warningType, int warningGroupId, String locations, int timeout, String workerGroup, String tenantCode, int releaseState, String taskRelationJson,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
String taskDefinitionJson, ProcessExecutionTypeEnum executionType) { User user = usersService.queryUser(userName); Project project = projectMapper.queryByName(projectName); long projectCode = project.getCode(); ProcessDefinition processDefinition = getProcessDefinition(user, projectCode, name); long processDefinitionCode; if (processDefinition != null) { processDefinitionCode = processDefinition.getCode(); processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.OFFLINE); Map<String, Object> result = processDefinitionService.updateProcessDefinition(user, projectCode, name, processDefinitionCode, description, globalParams, locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson, executionType); } else { Map<String, Object> result = processDefinitionService.createProcessDefinition(user, projectCode, name, description, globalParams, locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson, executionType); processDefinition = (ProcessDefinition) result.get(Constants.DATA_LIST); processDefinitionCode = processDefinition.getCode(); } if (schedule != null) { createOrUpdateSchedule(user, projectCode, processDefinitionCode, schedule, workerGroup, warningType, warningGroupId); } processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.getEnum(releaseState)); return processDefinitionCode; } /** * get process definition *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
* @param user user who create or update schedule * @param projectCode project which process definition belongs to * @param processDefinitionName process definition name */ private ProcessDefinition getProcessDefinition(User user, long projectCode, String processDefinitionName) { Map<String, Object> verifyProcessDefinitionExists = processDefinitionService.verifyProcessDefinitionName(user, projectCode, processDefinitionName); Status verifyStatus = (Status) verifyProcessDefinitionExists.get(Constants.STATUS); ProcessDefinition processDefinition = null; if (verifyStatus == Status.PROCESS_DEFINITION_NAME_EXIST) { processDefinition = processDefinitionMapper.queryByDefineName(projectCode, processDefinitionName); } else if (verifyStatus != Status.SUCCESS) { String msg = "Verify process definition exists status is invalid, neither SUCCESS or PROCESS_DEFINITION_NAME_EXIST."; logger.error(msg); throw new RuntimeException(msg); } return processDefinition; } /** * create or update process definition schedule. * It would always use latest schedule define in workflow-as-code, and set schedule online when * it's not null * * @param user user who create or update schedule * @param projectCode project which process definition belongs to * @param processDefinitionCode process definition code * @param schedule schedule expression * @param workerGroup work group * @param warningType warning type * @param warningGroupId warning group id */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
private void createOrUpdateSchedule(User user, long projectCode, long processDefinitionCode, String schedule, String workerGroup, String warningType, int warningGroupId) { Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(processDefinitionCode); int scheduleId; if (scheduleObj == null) { processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.ONLINE); Map<String, Object> result = schedulerService.insertSchedule(user, projectCode, processDefinitionCode, schedule, WarningType.valueOf(warningType), warningGroupId, DEFAULT_FAILURE_STRATEGY, DEFAULT_PRIORITY, workerGroup, DEFAULT_ENVIRONMENT_CODE); scheduleId = (int) result.get("scheduleId"); } else { scheduleId = scheduleObj.getId(); processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.OFFLINE); schedulerService.updateSchedule(user, projectCode, scheduleId, schedule, WarningType.valueOf(warningType), warningGroupId, DEFAULT_FAILURE_STRATEGY, DEFAULT_PRIORITY, workerGroup, DEFAULT_ENVIRONMENT_CODE); } schedulerService.setScheduleState(user, projectCode, scheduleId, ReleaseState.ONLINE); } public void execProcessInstance(String userName, String projectName, String processDefinitionName, String cronTime, String workerGroup, String warningType, int warningGroupId,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
Integer timeout ) { User user = usersService.queryUser(userName); Project project = projectMapper.queryByName(projectName); ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(project.getCode(), processDefinitionName); processDefinitionService.releaseProcessDefinition(user, project.getCode(), processDefinition.getCode(), ReleaseState.ONLINE); executorService.execProcessInstance(user, project.getCode(), processDefinition.getCode(), cronTime, null, DEFAULT_FAILURE_STRATEGY, null, DEFAULT_TASK_DEPEND_TYPE, WarningType.valueOf(warningType), warningGroupId, DEFAULT_RUN_MODE, DEFAULT_PRIORITY, workerGroup, DEFAULT_ENVIRONMENT_CODE, timeout, null, null, DEFAULT_DRY_RUN, COMPLEMENT_DEPENDENT_MODE ); } /*
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
Grant project's permission to user. Use when project's created user not current but Python API use it to change process definition. */ private Integer grantProjectToUser(Project project, User user) { Date now = new Date(); ProjectUser projectUser = new ProjectUser(); projectUser.setUserId(user.getId()); projectUser.setProjectId(project.getId()); projectUser.setPerm(Constants.AUTHORIZE_WRITABLE_PERM); projectUser.setCreateTime(now); projectUser.setUpdateTime(now); return projectUserMapper.insert(projectUser); } /* Grant or create project. Create a new project if project do not exists, and grant the project permission to user if project exists but without permission to this user. */ public void createOrGrantProject(String userName, String name, String desc) { User user = usersService.queryUser(userName); Project project; project = projectMapper.queryByName(name); if (project == null) { projectService.createProject(user, name, desc); } else if (project.getUserId() != user.getId()) { ProjectUser projectUser = projectUserMapper.queryProjectRelation(project.getId(), user.getId()); if (projectUser == null) { grantProjectToUser(project, user); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
public Map<String, Object> createQueue(String name, String queueName) { Result<Object> verifyQueueExists = queueService.verifyQueue(name, queueName); if (verifyQueueExists.getCode() == 0) { return queueService.createQueue(dummyAdminUser, name, queueName); } else { Map<String, Object> result = new HashMap<>(); result.put(Constants.STATUS, Status.SUCCESS); result.put(Constants.MSG, Status.SUCCESS.getMsg()); return result; } } public Map<String, Object> createTenant(String tenantCode, String desc, String queueName) throws Exception { if (tenantService.checkTenantExists(tenantCode)) { Map<String, Object> result = new HashMap<>(); result.put(Constants.STATUS, Status.SUCCESS); result.put(Constants.MSG, Status.SUCCESS.getMsg()); return result; } else { Result<Object> verifyQueueExists = queueService.verifyQueue(queueName, queueName); if (verifyQueueExists.getCode() == 0) { queueService.createQueue(dummyAdminUser, queueName, queueName); } Map<String, Object> result = queueService.queryQueueName(queueName); List<Queue> queueList = (List<Queue>) result.get(Constants.DATA_LIST); Queue queue = queueList.get(0); return tenantService.createTenant(dummyAdminUser, tenantCode, queue.getId(), desc); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
} public void createUser(String userName, String userPassword, String email, String phone, String tenantCode, String queue, int state) { User user = usersService.queryUser(userName); if (Objects.isNull(user)) { Map<String, Object> tenantResult = tenantService.queryByTenantCode(tenantCode); Tenant tenant = (Tenant) tenantResult.get(Constants.DATA_LIST); usersService.createUser(userName, userPassword, email, tenant.getId(), phone, queue, state); } } /** * Get datasource by given datasource name. It return map contain datasource id, type, name. * Useful in Python API create sql task which need datasource information. * * @param datasourceName user who create or update schedule */ public Map<String, Object> getDatasourceInfo(String datasourceName) { Map<String, Object> result = new HashMap<>(); List<DataSource> dataSourceList = dataSourceMapper.queryDataSourceByName(datasourceName); if (dataSourceList == null || dataSourceList.isEmpty()) { String msg = String.format("Can not find any datasource by name %s", datasourceName); logger.error(msg); throw new IllegalArgumentException(msg); } else if (dataSourceList.size() > 1) { String msg = String.format("Get more than one datasource by name %s", datasourceName);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
logger.error(msg); throw new IllegalArgumentException(msg); } else { DataSource dataSource = dataSourceList.get(0); result.put("id", dataSource.getId()); result.put("type", dataSource.getType().name()); result.put("name", dataSource.getName()); } return result; } /** * Get processDefinition by given processDefinitionName name. It return map contain processDefinition id, name, code. * Useful in Python API create subProcess task which need processDefinition information. * * @param userName user who create or update schedule * @param projectName project name which process definition belongs to * @param processDefinitionName process definition name */ public Map<String, Object> getProcessDefinitionInfo(String userName, String projectName, String processDefinitionName) { Map<String, Object> result = new HashMap<>(); User user = usersService.queryUser(userName); Project project = (Project) projectService.queryByName(user, projectName).get(Constants.DATA_LIST); long projectCode = project.getCode(); ProcessDefinition processDefinition = getProcessDefinition(user, projectCode, processDefinitionName); if (processDefinition != null) { processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinition.getCode(), ReleaseState.ONLINE); result.put("id", processDefinition.getId()); result.put("name", processDefinition.getName());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
result.put("code", processDefinition.getCode()); } else { String msg = String.format("Can not find valid process definition by name %s", processDefinitionName); logger.error(msg); throw new IllegalArgumentException(msg); } return result; } /** * Get project, process definition, task code. * Useful in Python API create dependent task which need processDefinition information. * * @param projectName project name which process definition belongs to * @param processDefinitionName process definition name * @param taskName task name */ public Map<String, Object> getDependentInfo(String projectName, String processDefinitionName, String taskName) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); if (project == null) { String msg = String.format("Can not find valid project by name %s", projectName); logger.error(msg); throw new IllegalArgumentException(msg); } long projectCode = project.getCode(); result.put("projectCode", projectCode); ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, processDefinitionName); if (processDefinition == null) { String msg = String.format("Can not find valid process definition by name %s", processDefinitionName); logger.error(msg);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
throw new IllegalArgumentException(msg); } result.put("processDefinitionCode", processDefinition.getCode()); if (taskName != null) { TaskDefinition taskDefinition = taskDefinitionMapper.queryByName(projectCode, taskName); result.put("taskDefinitionCode", taskDefinition.getCode()); } return result; } /** * Get resource by given program type and full name. It return map contain resource id, name. * Useful in Python API create flink or spark task which need processDefinition information. * * @param programType program type one of SCALA, JAVA and PYTHON * @param fullName full name of the resource */ public Map<String, Object> getResourcesFileInfo(String programType, String fullName) { Map<String, Object> result = new HashMap<>(); Result<Object> resources = resourceService.queryResourceByProgramType(dummyAdminUser, ResourceType.FILE, ProgramType.valueOf(programType)); List<ResourceComponent> resourcesComponent = (List<ResourceComponent>) resources.getData(); List<ResourceComponent> namedResources = resourcesComponent.stream().filter(s -> fullName.equals(s.getFullName())).collect(Collectors.toList()); if (CollectionUtils.isEmpty(namedResources)) { String msg = String.format("Can not find valid resource by program type %s and name %s", programType, fullName); logger.error(msg); throw new IllegalArgumentException(msg); } result.put("id", namedResources.get(0).getId()); result.put("name", namedResources.get(0).getName()); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
@PostConstruct public void init() { if (pythonGatewayConfiguration.getEnabled()) { this.start(); } } private void start() { GatewayServer server; try { InetAddress gatewayHost = InetAddress.getByName(pythonGatewayConfiguration.getGatewayServerAddress()); InetAddress pythonHost = InetAddress.getByName(pythonGatewayConfiguration.getPythonAddress()); server = new GatewayServer( this, pythonGatewayConfiguration.getGatewayServerPort(), pythonGatewayConfiguration.getPythonPort(), gatewayHost, pythonHost, pythonGatewayConfiguration.getConnectTimeout(), pythonGatewayConfiguration.getReadTimeout(), null ); GatewayServer.turnLoggingOn(); logger.info("PythonGatewayService started on: " + gatewayHost.toString()); server.start(); } catch (UnknownHostException e) { logger.error("exception occurred while constructing PythonGatewayService().", e); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/TaskDefinitionService.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 org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.dao.entity.User; import java.util.Map; /** * task definition service */ public interface TaskDefinitionService {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/TaskDefinitionService.java
/** * create task definition * * @param loginUser login user * @param projectCode project code * @param taskDefinitionJson task definition json */ Map<String, Object> createTaskDefinition(User loginUser, long projectCode, String taskDefinitionJson); /** * create single task definition that binds the workflow * * @param loginUser login user
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/TaskDefinitionService.java
* @param projectCode project code * @param processDefinitionCode process definition code * @param taskDefinitionJsonObj task definition json object * @param upstreamCodes upstream task codes, sep comma * @return create result code */ Map<String, Object> createTaskBindsWorkFlow(User loginUser, long projectCode, long processDefinitionCode, String taskDefinitionJsonObj, String upstreamCodes); /** * query task definition * * @param loginUser login user * @param projectCode project code * @param taskName task name */ Map<String, Object> queryTaskDefinitionByName(User loginUser, long projectCode, String taskName); /** * delete task definition * * @param loginUser login user * @param projectCode project code * @param taskCode task code */ Map<String, Object> deleteTaskDefinitionByCode(User loginUser, long projectCode,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/TaskDefinitionService.java
long taskCode); /** * update task definition * * @param loginUser login user * @param projectCode project code * @param taskCode task code * @param taskDefinitionJsonObj task definition json object */ Map<String, Object> updateTaskDefinition(User loginUser, long projectCode, long taskCode, String taskDefinitionJsonObj); /** * update task definition and upstream * * @param loginUser login user * @param projectCode project code * @param taskCode task definition code * @param taskDefinitionJsonObj task definition json object * @param upstreamCodes upstream task codes, sep comma * @return update result code */ Map<String, Object> updateTaskWithUpstream(User loginUser, long projectCode, long taskCode, String taskDefinitionJsonObj, String upstreamCodes); /** * update task definition
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/TaskDefinitionService.java
* * @param loginUser login user * @param projectCode project code * @param taskCode task code * @param version the version user want to switch */ Map<String, Object> switchVersion(User loginUser, long projectCode, long taskCode, int version); /** * query the pagination versions info by one certain task definition code * * @param loginUser login user info to check auth * @param projectCode project code * @param taskCode task definition code * @param pageNo page number * @param pageSize page size * @return the pagination task definition versions info of the certain task definition */ Result queryTaskDefinitionVersions(User loginUser, long projectCode, long taskCode, int pageNo, int pageSize); /** * delete the certain task definition version by version and code * * @param loginUser login user info * @param projectCode project code
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/TaskDefinitionService.java
* @param taskCode the task definition code * @param version the task definition version user want to delete * @return delete version result code */ Map<String, Object> deleteByCodeAndVersion(User loginUser, long projectCode, long taskCode, int version); /** * query detail of task definition by code * * @param loginUser login user * @param projectCode project code * @param taskCode the task definition code * @return task definition detail */ Map<String, Object> queryTaskDefinitionDetail(User loginUser, long projectCode, long taskCode); /** * query task definition list paging * * @param loginUser login user * @param projectCode project code * @param searchWorkflowName searchWorkflowName * @param searchTaskName searchTaskName * @param taskType taskType * @param pageNo page number * @param pageSize page size * @return task definition page
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/TaskDefinitionService.java
*/ Result queryTaskDefinitionListPaging(User loginUser, long projectCode, String searchWorkflowName, String searchTaskName, String taskType, Integer pageNo, Integer pageSize); /** * gen task code list * * @param genNum gen num * @return task code list */ Map<String, Object> genTaskCodeList(Integer genNum); /** * release task definition * * @param loginUser login user * @param projectCode project code * @param code task definition code * @param releaseState releaseState * @return update result code */ Map<String, Object> releaseTaskDefinition(User loginUser, long projectCode, long code, ReleaseState releaseState); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.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,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
* 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 org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.exceptions.ServiceException; import org.apache.dolphinscheduler.api.service.ProjectService; import org.apache.dolphinscheduler.api.service.TaskDefinitionService; 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.ConditionType; import org.apache.dolphinscheduler.common.enums.Flag; import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils; import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils.CodeGenerateException; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation; import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelationLog; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.TaskDefinition; import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog; import org.apache.dolphinscheduler.dao.entity.TaskMainInfo; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionLogMapper; import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper; import org.apache.dolphinscheduler.plugin.task.api.parameters.ParametersNode; import org.apache.dolphinscheduler.api.permission.PermissionCheck; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.service.task.TaskPluginManager; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; import java.util.Arrays; 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 java.util.stream.Collectors; 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 com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.*; /** * task definition service impl */ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
public class TaskDefinitionServiceImpl extends BaseServiceImpl implements TaskDefinitionService { private static final Logger logger = LoggerFactory.getLogger(TaskDefinitionServiceImpl.class); private static final String RELEASESTATE = "releaseState"; @Autowired private ProjectMapper projectMapper; @Autowired private ProjectService projectService; @Autowired private TaskDefinitionMapper taskDefinitionMapper; @Autowired private TaskDefinitionLogMapper taskDefinitionLogMapper; @Autowired private ProcessTaskRelationMapper processTaskRelationMapper; @Autowired private ProcessDefinitionMapper processDefinitionMapper; @Autowired private ProcessService processService; @Autowired private TaskPluginManager taskPluginManager; /** * create task definition * * @param loginUser login user * @param projectCode project code * @param taskDefinitionJson task definition json */ @Transactional(rollbackFor = RuntimeException.class) @Override
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
public Map<String, Object> createTaskDefinition(User loginUser, long projectCode, String taskDefinitionJson) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, TASK_DEFINITION_CREATE); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class); if (taskDefinitionLogs.isEmpty()) { logger.error("taskDefinitionJson invalid: {}", taskDefinitionJson); putMsg(result, Status.DATA_IS_NOT_VALID, taskDefinitionJson); return result; } for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) { if (!taskPluginManager.checkTaskParameters(ParametersNode.builder() .taskType(taskDefinitionLog.getTaskType()) .taskParams(taskDefinitionLog.getTaskParams()) .dependence(taskDefinitionLog.getDependence()) .build())) { logger.error("task definition {} parameter invalid", taskDefinitionLog.getName()); putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinitionLog.getName()); return result; } } int saveTaskResult = processService.saveTaskDefine(loginUser, projectCode, taskDefinitionLogs, Boolean.TRUE); if (saveTaskResult == Constants.DEFINITION_FAILURE) { putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR); throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
} Map<String, Object> resData = new HashMap<>(); resData.put("total", taskDefinitionLogs.size()); resData.put("code", StringUtils.join(taskDefinitionLogs.stream().map(TaskDefinition::getCode).collect(Collectors.toList()), ",")); putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, resData); return result; } /** * create single task definition that binds the workflow * * @param loginUser login user * @param projectCode project code * @param processDefinitionCode process definition code * @param taskDefinitionJsonObj task definition json object * @param upstreamCodes upstream task codes, sep comma * @return create result code */ @Transactional(rollbackFor = RuntimeException.class) @Override public Map<String, Object> createTaskBindsWorkFlow(User loginUser, long projectCode, long processDefinitionCode, String taskDefinitionJsonObj, String upstreamCodes) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,TASK_DEFINITION_CREATE); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
} ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(processDefinitionCode)); return result; } if (processDefinition.getReleaseState() == ReleaseState.ONLINE) { putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE, String.valueOf(processDefinitionCode)); return result; } TaskDefinitionLog taskDefinition = JSONUtils.parseObject(taskDefinitionJsonObj, TaskDefinitionLog.class); if (taskDefinition == null) { logger.error("taskDefinitionJsonObj is not valid json"); putMsg(result, Status.DATA_IS_NOT_VALID, taskDefinitionJsonObj); return result; } if (!taskPluginManager.checkTaskParameters(ParametersNode.builder() .taskType(taskDefinition.getTaskType()) .taskParams(taskDefinition.getTaskParams()) .dependence(taskDefinition.getDependence()) .build())) { logger.error("task definition {} parameter invalid", taskDefinition.getName()); putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinition.getName()); return result; } long taskCode = taskDefinition.getCode(); if (taskCode == 0) { try { taskCode = CodeGenerateUtils.getInstance().genCode(); taskDefinition.setCode(taskCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
} catch (CodeGenerateException e) { logger.error("Task code get error, ", e); putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, taskDefinitionJsonObj); return result; } } List<ProcessTaskRelationLog> processTaskRelationLogList = Lists.newArrayList(); if (StringUtils.isNotBlank(upstreamCodes)) { Set<Long> upstreamTaskCodes = Arrays.stream(upstreamCodes.split(Constants.COMMA)).map(Long::parseLong).collect(Collectors.toSet()); List<TaskDefinition> upstreamTaskDefinitionList = taskDefinitionMapper.queryByCodeList(upstreamTaskCodes); Set<Long> queryUpStreamTaskCodes = upstreamTaskDefinitionList.stream().map(TaskDefinition::getCode).collect(Collectors.toSet()); Set<Long> diffCode = upstreamTaskCodes.stream().filter(code -> !queryUpStreamTaskCodes.contains(code)).collect(Collectors.toSet()); if (!diffCode.isEmpty()) { putMsg(result, Status.TASK_DEFINE_NOT_EXIST, StringUtils.join(diffCode, Constants.COMMA)); return result; } for (TaskDefinition upstreamTask : upstreamTaskDefinitionList) { ProcessTaskRelationLog processTaskRelationLog = new ProcessTaskRelationLog(); processTaskRelationLog.setPreTaskCode(upstreamTask.getCode()); processTaskRelationLog.setPreTaskVersion(upstreamTask.getVersion()); processTaskRelationLog.setPostTaskCode(taskCode); processTaskRelationLog.setPostTaskVersion(Constants.VERSION_FIRST); processTaskRelationLog.setConditionType(ConditionType.NONE); processTaskRelationLog.setConditionParams("{}"); processTaskRelationLogList.add(processTaskRelationLog); } List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode); if (!processTaskRelationList.isEmpty()) { processTaskRelationLogList.addAll(processTaskRelationList.stream().map(ProcessTaskRelationLog::new).collect(Collectors.toList()));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
} } else { ProcessTaskRelationLog processTaskRelationLog = new ProcessTaskRelationLog(); processTaskRelationLog.setPreTaskCode(0); processTaskRelationLog.setPreTaskVersion(0); processTaskRelationLog.setPostTaskCode(taskCode); processTaskRelationLog.setPostTaskVersion(Constants.VERSION_FIRST); processTaskRelationLog.setConditionType(ConditionType.NONE); processTaskRelationLog.setConditionParams("{}"); processTaskRelationLogList.add(processTaskRelationLog); } int insertResult = processService.saveTaskRelation(loginUser, projectCode, processDefinition.getCode(), processDefinition.getVersion(), processTaskRelationLogList, Lists.newArrayList(), Boolean.TRUE); if (insertResult != Constants.EXIT_CODE_SUCCESS) { putMsg(result, Status.CREATE_PROCESS_TASK_RELATION_ERROR); throw new ServiceException(Status.CREATE_PROCESS_TASK_RELATION_ERROR); } int saveTaskResult = processService.saveTaskDefine(loginUser, projectCode, Lists.newArrayList(taskDefinition), Boolean.TRUE); if (saveTaskResult == Constants.DEFINITION_FAILURE) { putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR); throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR); } putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, taskDefinition); return result; } /** * query task definition * * @param loginUser login user
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
* @param projectCode project code * @param taskName task name */ @Override public Map<String, Object> queryTaskDefinitionByName(User loginUser, long projectCode, String taskName) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,TASK_DEFINITION); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } TaskDefinition taskDefinition = taskDefinitionMapper.queryByName(project.getCode(), taskName); if (taskDefinition == null) { putMsg(result, Status.TASK_DEFINE_NOT_EXIST, taskName); } else { result.put(Constants.DATA_LIST, taskDefinition); putMsg(result, Status.SUCCESS); } return result; } /** * delete task definition * Only offline and no downstream dependency can be deleted * * @param loginUser login user * @param projectCode project code * @param taskCode task code */ @Transactional(rollbackFor = RuntimeException.class) @Override
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
public Map<String, Object> deleteTaskDefinitionByCode(User loginUser, long projectCode, long taskCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,TASK_DEFINITION_DELETE); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (taskCode == 0) { putMsg(result, Status.DELETE_TASK_DEFINE_BY_CODE_ERROR); return result; } TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode); if (taskDefinition == null || projectCode != taskDefinition.getProjectCode()) { putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(taskCode)); return result; } if (processService.isTaskOnline(taskCode) && taskDefinition.getFlag() == Flag.YES) { putMsg(result, Status.TASK_DEFINE_STATE_ONLINE, taskCode); return result; } List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryDownstreamByTaskCode(taskCode); if (!processTaskRelationList.isEmpty()) { Set<Long> postTaskCodes = processTaskRelationList .stream() .map(ProcessTaskRelation::getPostTaskCode) .collect(Collectors.toSet()); putMsg(result, Status.TASK_HAS_DOWNSTREAM, StringUtils.join(postTaskCodes, ",")); return result; } int delete = taskDefinitionMapper.deleteByCode(taskCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
if (delete > 0) { List<ProcessTaskRelation> taskRelationList = processTaskRelationMapper.queryUpstreamByCode(projectCode, taskCode); if (!taskRelationList.isEmpty()) { long processDefinitionCode = taskRelationList.get(0).getProcessDefinitionCode(); List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode); List<ProcessTaskRelation> relationList = processTaskRelations.stream().filter(r -> r.getPostTaskCode() != taskCode).collect(Collectors.toList()); updateDag(loginUser, result, processDefinitionCode, relationList, Lists.newArrayList()); } else { putMsg(result, Status.SUCCESS); } } else { putMsg(result, Status.DELETE_TASK_DEFINE_BY_CODE_ERROR); throw new ServiceException(Status.DELETE_TASK_DEFINE_BY_CODE_ERROR); } return result; } private void updateDag(User loginUser, Map<String, Object> result, long processDefinitionCode, List<ProcessTaskRelation> processTaskRelationList, List<TaskDefinitionLog> taskDefinitionLogs) { ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode); if (processDefinition == null) { throw new ServiceException(Status.PROCESS_DEFINE_NOT_EXIST); } int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE); if (insertVersion <= 0) { throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR); } List<ProcessTaskRelationLog> relationLogs = processTaskRelationList.stream().map(ProcessTaskRelationLog::new).collect(Collectors.toList()); int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion, relationLogs, taskDefinitionLogs, Boolean.TRUE); if (insertResult == Constants.EXIT_CODE_SUCCESS) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, processDefinition); } else { putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR); } } /** * update task definition * * @param loginUser login user * @param projectCode project code * @param taskCode task code * @param taskDefinitionJsonObj task definition json object */ @Transactional(rollbackFor = RuntimeException.class) @Override public Map<String, Object> updateTaskDefinition(User loginUser, long projectCode, long taskCode, String taskDefinitionJsonObj) { Map<String, Object> result = new HashMap<>(); TaskDefinitionLog taskDefinitionToUpdate = updateTask(loginUser, projectCode, taskCode, taskDefinitionJsonObj, result); if (taskDefinitionToUpdate == null) { return result; } List<ProcessTaskRelation> taskRelationList = processTaskRelationMapper.queryUpstreamByCode(projectCode, taskCode); if (!taskRelationList.isEmpty()) { long processDefinitionCode = taskRelationList.get(0).getProcessDefinitionCode(); List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode); updateDag(loginUser, result, processDefinitionCode, processTaskRelations, Lists.newArrayList(taskDefinitionToUpdate)); } result.put(Constants.DATA_LIST, taskCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
putMsg(result, Status.SUCCESS); return result; } private TaskDefinitionLog updateTask(User loginUser, long projectCode, long taskCode, String taskDefinitionJsonObj, Map<String, Object> result) { Project project = projectMapper.queryByCode(projectCode); result.putAll(projectService.checkProjectAndAuth(loginUser, project, projectCode,TASK_DEFINITION_UPDATE)); if (result.get(Constants.STATUS) != Status.SUCCESS) { return null; } TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode); if (taskDefinition == null) { putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(taskCode)); return null; } if (processService.isTaskOnline(taskCode) && taskDefinition.getFlag() == Flag.YES) { putMsg(result, Status.NOT_SUPPORT_UPDATE_TASK_DEFINITION); return null; } TaskDefinitionLog taskDefinitionToUpdate = JSONUtils.parseObject(taskDefinitionJsonObj, TaskDefinitionLog.class); if (taskDefinition.equals(taskDefinitionToUpdate)) { return null; } if (taskDefinitionToUpdate == null) { logger.error("taskDefinitionJson is not valid json"); putMsg(result, Status.DATA_IS_NOT_VALID, taskDefinitionJsonObj); return null; } if (!taskPluginManager.checkTaskParameters(ParametersNode.builder() .taskType(taskDefinitionToUpdate.getTaskType())
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
.taskParams(taskDefinitionToUpdate.getTaskParams()) .dependence(taskDefinitionToUpdate.getDependence()) .build())) { logger.error("task definition {} parameter invalid", taskDefinitionToUpdate.getName()); putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinitionToUpdate.getName()); return null; } Integer version = taskDefinitionLogMapper.queryMaxVersionForDefinition(taskCode); if (version == null || version == 0) { putMsg(result, Status.DATA_IS_NOT_VALID, taskCode); return null; } Date now = new Date(); taskDefinitionToUpdate.setCode(taskCode); taskDefinitionToUpdate.setId(taskDefinition.getId()); taskDefinitionToUpdate.setProjectCode(projectCode); taskDefinitionToUpdate.setUserId(taskDefinition.getUserId()); taskDefinitionToUpdate.setVersion(++version); taskDefinitionToUpdate.setTaskType(taskDefinitionToUpdate.getTaskType().toUpperCase()); taskDefinitionToUpdate.setResourceIds(processService.getResourceIds(taskDefinitionToUpdate)); taskDefinitionToUpdate.setUpdateTime(now); int update = taskDefinitionMapper.updateById(taskDefinitionToUpdate); taskDefinitionToUpdate.setOperator(loginUser.getId()); taskDefinitionToUpdate.setOperateTime(now); taskDefinitionToUpdate.setCreateTime(now); int insert = taskDefinitionLogMapper.insert(taskDefinitionToUpdate); if ((update & insert) != 1) { putMsg(result, Status.UPDATE_TASK_DEFINITION_ERROR); throw new ServiceException(Status.UPDATE_TASK_DEFINITION_ERROR); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
return taskDefinitionToUpdate; } /** * update task definition and upstream * * @param loginUser login user * @param projectCode project code * @param taskCode task definition code * @param taskDefinitionJsonObj task definition json object * @param upstreamCodes upstream task codes, sep comma * @return update result code */ @Override public Map<String, Object> updateTaskWithUpstream(User loginUser, long projectCode, long taskCode, String taskDefinitionJsonObj, String upstreamCodes) { Map<String, Object> result = new HashMap<>(); TaskDefinitionLog taskDefinitionToUpdate = updateTask(loginUser, projectCode, taskCode, taskDefinitionJsonObj, result); if (result.get(Constants.STATUS) != Status.SUCCESS && taskDefinitionToUpdate == null) { return result; } List<ProcessTaskRelation> upstreamTaskRelations = processTaskRelationMapper.queryUpstreamByCode(projectCode, taskCode); Set<Long> upstreamCodeSet = upstreamTaskRelations.stream().map(ProcessTaskRelation::getPreTaskCode).collect(Collectors.toSet()); Set<Long> upstreamTaskCodes = Collections.emptySet(); if (StringUtils.isNotEmpty(upstreamCodes)) { upstreamTaskCodes = Arrays.stream(upstreamCodes.split(Constants.COMMA)).map(Long::parseLong).collect(Collectors.toSet()); } if (CollectionUtils.isEqualCollection(upstreamCodeSet, upstreamTaskCodes) && taskDefinitionToUpdate == null) { putMsg(result, Status.SUCCESS); return result; } else { if (taskDefinitionToUpdate == null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
taskDefinitionToUpdate = JSONUtils.parseObject(taskDefinitionJsonObj, TaskDefinitionLog.class); } } Map<Long, TaskDefinition> queryUpStreamTaskCodeMap; if (!upstreamTaskCodes.isEmpty()) { List<TaskDefinition> upstreamTaskDefinitionList = taskDefinitionMapper.queryByCodeList(upstreamTaskCodes); queryUpStreamTaskCodeMap = upstreamTaskDefinitionList.stream().collect(Collectors.toMap(TaskDefinition::getCode, taskDefinition -> taskDefinition)); upstreamTaskCodes.removeAll(queryUpStreamTaskCodeMap.keySet()); if (!upstreamTaskCodes.isEmpty()) { putMsg(result, Status.TASK_DEFINE_NOT_EXIST, StringUtils.join(upstreamTaskCodes, Constants.COMMA)); return result; } } else { queryUpStreamTaskCodeMap = new HashMap<>(); } if (!upstreamTaskRelations.isEmpty()) { ProcessTaskRelation taskRelation = upstreamTaskRelations.get(0); List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, taskRelation.getProcessDefinitionCode()); List<ProcessTaskRelation> processTaskRelationList = Lists.newArrayList(processTaskRelations); List<ProcessTaskRelation> relationList = Lists.newArrayList(); for (ProcessTaskRelation processTaskRelation : processTaskRelationList) { if (processTaskRelation.getPostTaskCode() == taskCode) { if (queryUpStreamTaskCodeMap.containsKey(processTaskRelation.getPreTaskCode()) && processTaskRelation.getPreTaskCode() != 0L) { queryUpStreamTaskCodeMap.remove(processTaskRelation.getPreTaskCode()); } else { processTaskRelation.setPreTaskCode(0L); processTaskRelation.setPreTaskVersion(0); relationList.add(processTaskRelation); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
} } processTaskRelationList.removeAll(relationList); for (Map.Entry<Long, TaskDefinition> queryUpStreamTask : queryUpStreamTaskCodeMap.entrySet()) { taskRelation.setPreTaskCode(queryUpStreamTask.getKey()); taskRelation.setPreTaskVersion(queryUpStreamTask.getValue().getVersion()); processTaskRelationList.add(taskRelation); } if (queryUpStreamTaskCodeMap.isEmpty() && !processTaskRelationList.isEmpty()) { processTaskRelationList.add(processTaskRelationList.get(0)); } updateDag(loginUser, result, taskRelation.getProcessDefinitionCode(), processTaskRelations, Lists.newArrayList(taskDefinitionToUpdate)); } result.put(Constants.DATA_LIST, taskCode); putMsg(result, Status.SUCCESS); return result; } /** * switch task definition * * @param loginUser login user * @param projectCode project code * @param taskCode task code * @param version the version user want to switch */ @Transactional(rollbackFor = RuntimeException.class) @Override public Map<String, Object> switchVersion(User loginUser, long projectCode, long taskCode, int version) { Project project = projectMapper.queryByCode(projectCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project,projectCode,WORKFLOW_SWITCH_TO_THIS_VERSION); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (processService.isTaskOnline(taskCode)) { putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE); return result; } TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode); if (taskDefinition == null || projectCode != taskDefinition.getProjectCode()) { putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(taskCode)); return result; } TaskDefinitionLog taskDefinitionUpdate = taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskCode, version); taskDefinitionUpdate.setUserId(loginUser.getId()); taskDefinitionUpdate.setUpdateTime(new Date()); taskDefinitionUpdate.setId(taskDefinition.getId()); int switchVersion = taskDefinitionMapper.updateById(taskDefinitionUpdate); if (switchVersion > 0) { List<ProcessTaskRelation> taskRelationList = processTaskRelationMapper.queryUpstreamByCode(projectCode, taskCode); if (!taskRelationList.isEmpty()) { long processDefinitionCode = taskRelationList.get(0).getProcessDefinitionCode(); List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode); updateDag(loginUser, result, processDefinitionCode, processTaskRelations, Lists.newArrayList(taskDefinitionUpdate)); } else { putMsg(result, Status.SUCCESS); } } else { putMsg(result, Status.SWITCH_TASK_DEFINITION_VERSION_ERROR); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
return result; } @Override public Result queryTaskDefinitionVersions(User loginUser, long projectCode, long taskCode, int pageNo, int pageSize) { Result result = new Result(); Project project = projectMapper.queryByCode(projectCode); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectCode,TASK_VERSION_VIEW); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { putMsg(result, resultStatus); return result; } PageInfo<TaskDefinitionLog> pageInfo = new PageInfo<>(pageNo, pageSize); Page<TaskDefinitionLog> page = new Page<>(pageNo, pageSize); IPage<TaskDefinitionLog> taskDefinitionVersionsPaging = taskDefinitionLogMapper.queryTaskDefinitionVersionsPaging(page, taskCode, projectCode); List<TaskDefinitionLog> taskDefinitionLogs = taskDefinitionVersionsPaging.getRecords(); pageInfo.setTotalList(taskDefinitionLogs); pageInfo.setTotal((int) taskDefinitionVersionsPaging.getTotal()); result.setData(pageInfo); putMsg(result, Status.SUCCESS); return result; } @Override public Map<String, Object> deleteByCodeAndVersion(User loginUser, long projectCode, long taskCode, int version) { Project project = projectMapper.queryByCode(projectCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,TASK_DEFINITION_DELETE); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode); if (taskDefinition == null) { putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(taskCode)); } else { if (taskDefinition.getVersion() == version) { putMsg(result, Status.MAIN_TABLE_USING_VERSION); return result; } int delete = taskDefinitionLogMapper.deleteByCodeAndVersion(taskCode, version); if (delete > 0) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.DELETE_TASK_DEFINITION_VERSION_ERROR); } } return result; } @Override public Map<String, Object> queryTaskDefinitionDetail(User loginUser, long projectCode, long taskCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,TASK_DEFINITION); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode); if (taskDefinition == null || projectCode != taskDefinition.getProjectCode()) { putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(taskCode)); } else { result.put(Constants.DATA_LIST, taskDefinition); putMsg(result, Status.SUCCESS); } return result; } @Override public Result queryTaskDefinitionListPaging(User loginUser, long projectCode, String searchWorkflowName, String searchTaskName, String taskType, Integer pageNo, Integer pageSize) { Result result = new Result(); Project project = projectMapper.queryByCode(projectCode); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectCode,TASK_DEFINITION); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { putMsg(result, resultStatus); return result; } Page<TaskMainInfo> page = new Page<>(pageNo, pageSize); IPage<TaskMainInfo> taskMainInfoIPage = taskDefinitionMapper.queryDefineListPaging(page, projectCode, searchWorkflowName, searchTaskName, taskType == null ? StringUtils.EMPTY : taskType); List<TaskMainInfo> records = taskMainInfoIPage.getRecords();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
if (!records.isEmpty()) { Map<Long, TaskMainInfo> taskMainInfoMap = new HashMap<>(); for (TaskMainInfo info : records) { taskMainInfoMap.compute(info.getTaskCode(), (k, v) -> { if (v == null) { Map<Long, String> upstreamTaskMap = new HashMap<>(); if (info.getUpstreamTaskCode() != 0) { upstreamTaskMap.put(info.getUpstreamTaskCode(), info.getUpstreamTaskName()); info.setUpstreamTaskCode(0L); info.setUpstreamTaskName(StringUtils.EMPTY); } info.setUpstreamTaskMap(upstreamTaskMap); v = info; } if (info.getUpstreamTaskCode() != 0) { v.getUpstreamTaskMap().put(info.getUpstreamTaskCode(), info.getUpstreamTaskName()); } return v; }); } taskMainInfoIPage.setRecords(Lists.newArrayList(taskMainInfoMap.values())); } PageInfo<TaskMainInfo> pageInfo = new PageInfo<>(pageNo, pageSize); pageInfo.setTotal((int) taskMainInfoIPage.getTotal()); pageInfo.setTotalList(taskMainInfoIPage.getRecords()); result.setData(pageInfo); putMsg(result, Status.SUCCESS); return result; } @Override
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
public Map<String, Object> genTaskCodeList(Integer genNum) { Map<String, Object> result = new HashMap<>(); if (genNum == null || genNum < 1 || genNum > 100) { logger.error("the genNum must be great than 1 and less than 100"); putMsg(result, Status.DATA_IS_NOT_VALID, genNum); return result; } List<Long> taskCodes = new ArrayList<>(); try { for (int i = 0; i < genNum; i++) { taskCodes.add(CodeGenerateUtils.getInstance().genCode()); } } catch (CodeGenerateException e) { logger.error("Task code get error, ", e); putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, "Error generating task definition code"); } putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, taskCodes); return result; } /** * release task definition * * @param loginUser login user * @param projectCode project code * @param code task definition code * @param releaseState releaseState * @return update result code */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
@Transactional(rollbackFor = RuntimeException.class) @Override public Map<String, Object> releaseTaskDefinition(User loginUser, long projectCode, long code, ReleaseState releaseState) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,null); Status resultStatus = (Status) result.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return result; } if (null == releaseState) { putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE); return result; } TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(code); if (taskDefinition == null || projectCode != taskDefinition.getProjectCode()) { putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } TaskDefinitionLog taskDefinitionLog = taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(code, taskDefinition.getVersion()); if (taskDefinitionLog == null) { putMsg(result, Status.TASK_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } switch (releaseState) { case OFFLINE: taskDefinition.setFlag(Flag.NO); taskDefinitionLog.setFlag(Flag.NO); break; case ONLINE:
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
String resourceIds = taskDefinition.getResourceIds(); if (StringUtils.isNotBlank(resourceIds)) { Integer[] resourceIdArray = Arrays.stream(resourceIds.split(",")).map(Integer::parseInt).toArray(Integer[]::new); PermissionCheck<Integer> permissionCheck = new PermissionCheck(AuthorizationType.RESOURCE_FILE_ID, processService, resourceIdArray, loginUser.getId(), logger); try { permissionCheck.checkPermission(); } catch (Exception e) { logger.error(e.getMessage(), e); putMsg(result, Status.RESOURCE_NOT_EXIST_OR_NO_PERMISSION); return result; } } taskDefinition.setFlag(Flag.YES); taskDefinitionLog.setFlag(Flag.YES); break; default: putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE); return result; } int update = taskDefinitionMapper.updateById(taskDefinition); int updateLog = taskDefinitionLogMapper.updateById(taskDefinitionLog); if ((update == 0 && updateLog == 1) || (update == 1 && updateLog == 0)) { putMsg(result, Status.UPDATE_TASK_DEFINITION_ERROR); throw new ServiceException(Status.UPDATE_TASK_DEFINITION_ERROR); } putMsg(result, Status.SUCCESS); return result; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.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 org.apache.dolphinscheduler.api.enums.Status;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
import org.apache.dolphinscheduler.api.service.impl.ProjectServiceImpl; import org.apache.dolphinscheduler.api.service.impl.TaskDefinitionServiceImpl; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.TaskDefinition; import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionLogMapper; import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.service.task.TaskPluginManager; import java.text.MessageFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.*; @RunWith(MockitoJUnitRunner.class)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
public class TaskDefinitionServiceImplTest { @InjectMocks private TaskDefinitionServiceImpl taskDefinitionService; @Mock private TaskDefinitionMapper taskDefinitionMapper; @Mock private TaskDefinitionLogMapper taskDefinitionLogMapper; @Mock private ProjectMapper projectMapper; @Mock private ProjectServiceImpl projectService; @Mock private ProcessService processService; @Mock private ProcessTaskRelationMapper processTaskRelationMapper; @Mock private TaskPluginManager taskPluginManager; @Test public void createTaskDefinition() { long projectCode = 1L; Project project = getProject(projectCode); Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode, TASK_DEFINITION_CREATE)).thenReturn(result); String createTaskDefinitionJson = "[{\"name\":\"detail_up\",\"description\":\"\",\"taskType\":\"SHELL\",\"taskParams\":" + "\"{\\\"resourceList\\\":[],\\\"localParams\\\":[{\\\"prop\\\":\\\"datetime\\\",\\\"direct\\\":\\\"IN\\\"," + "\\\"type\\\":\\\"VARCHAR\\\",\\\"value\\\":\\\"${system.datetime}\\\"}],\\\"rawScript\\\":" + "\\\"echo ${datetime}\\\",\\\"conditionResult\\\":\\\"{\\\\\\\"successNode\\\\\\\":[\\\\\\\"\\\\\\\"]," + "\\\\\\\"failedNode\\\\\\\":[\\\\\\\"\\\\\\\"]}\\\",\\\"dependence\\\":{}}\",\"flag\":0,\"taskPriority\":0," + "\"workerGroup\":\"default\",\"failRetryTimes\":0,\"failRetryInterval\":0,\"timeoutFlag\":0," + "\"timeoutNotifyStrategy\":0,\"timeout\":0,\"delayTime\":0,\"resourceIds\":\"\"}]"; List<TaskDefinitionLog> taskDefinitions = JSONUtils.toList(createTaskDefinitionJson, TaskDefinitionLog.class); Mockito.when(processService.saveTaskDefine(loginUser, projectCode, taskDefinitions, Boolean.TRUE)).thenReturn(1); Mockito.when(taskPluginManager.checkTaskParameters(Mockito.any())).thenReturn(true); Map<String, Object> relation = taskDefinitionService .createTaskDefinition(loginUser, projectCode, createTaskDefinitionJson); Assert.assertEquals(Status.SUCCESS, relation.get(Constants.STATUS)); } @Test public void updateTaskDefinition() { String taskDefinitionJson = "{\"name\":\"detail_up\",\"description\":\"\",\"taskType\":\"SHELL\",\"taskParams\":" + "\"{\\\"resourceList\\\":[],\\\"localParams\\\":[{\\\"prop\\\":\\\"datetime\\\",\\\"direct\\\":\\\"IN\\\"," + "\\\"type\\\":\\\"VARCHAR\\\",\\\"value\\\":\\\"${system.datetime}\\\"}],\\\"rawScript\\\":" + "\\\"echo ${datetime}\\\",\\\"conditionResult\\\":\\\"{\\\\\\\"successNode\\\\\\\":[\\\\\\\"\\\\\\\"]," + "\\\\\\\"failedNode\\\\\\\":[\\\\\\\"\\\\\\\"]}\\\",\\\"dependence\\\":{}}\",\"flag\":0,\"taskPriority\":0," + "\"workerGroup\":\"default\",\"failRetryTimes\":0,\"failRetryInterval\":0,\"timeoutFlag\":0," + "\"timeoutNotifyStrategy\":0,\"timeout\":0,\"delayTime\":0,\"resourceIds\":\"\"}"; long projectCode = 1L; long taskCode = 1L; Project project = getProject(projectCode); Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,TASK_DEFINITION_UPDATE)).thenReturn(result); Mockito.when(processService.isTaskOnline(taskCode)).thenReturn(Boolean.FALSE); Mockito.when(taskDefinitionMapper.queryByCode(taskCode)).thenReturn(new TaskDefinition()); Mockito.when(taskDefinitionMapper.updateById(Mockito.any(TaskDefinitionLog.class))).thenReturn(1); Mockito.when(taskDefinitionLogMapper.insert(Mockito.any(TaskDefinitionLog.class))).thenReturn(1); Mockito.when(taskDefinitionLogMapper.queryMaxVersionForDefinition(taskCode)).thenReturn(1); Mockito.when(taskPluginManager.checkTaskParameters(Mockito.any())).thenReturn(true); result = taskDefinitionService.updateTaskDefinition(loginUser, projectCode, taskCode, taskDefinitionJson); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); } @Test public void queryTaskDefinitionByName() { String taskName = "task"; long projectCode = 1L; Project project = getProject(projectCode); Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,TASK_DEFINITION )).thenReturn(result); Mockito.when(taskDefinitionMapper.queryByName(project.getCode(), taskName)) .thenReturn(new TaskDefinition()); Map<String, Object> relation = taskDefinitionService
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
.queryTaskDefinitionByName(loginUser, projectCode, taskName); Assert.assertEquals(Status.SUCCESS, relation.get(Constants.STATUS)); } @Test public void deleteTaskDefinitionByCode() { long projectCode = 1L; long taskCode = 1L; Project project = getProject(projectCode); Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,TASK_DEFINITION_DELETE )).thenReturn(result); Mockito.when(taskDefinitionMapper.queryByCode(taskCode)).thenReturn(getTaskDefinition()); Mockito.when(processTaskRelationMapper.queryDownstreamByTaskCode(taskCode)) .thenReturn(new ArrayList<>()); Mockito.when(taskDefinitionMapper.deleteByCode(taskCode)) .thenReturn(1); Map<String, Object> relation = taskDefinitionService .deleteTaskDefinitionByCode(loginUser, projectCode, taskCode); Assert.assertEquals(Status.SUCCESS, relation.get(Constants.STATUS)); } @Test public void switchVersion() { int version = 1; long taskCode = 11L; long projectCode = 1L; Project project = getProject(projectCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_SWITCH_TO_THIS_VERSION)).thenReturn(result); Mockito.when(taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskCode, version)) .thenReturn(new TaskDefinitionLog()); TaskDefinition taskDefinition = new TaskDefinition(); taskDefinition.setProjectCode(projectCode); Mockito.when(taskDefinitionMapper.queryByCode(taskCode)) .thenReturn(taskDefinition); Mockito.when(taskDefinitionMapper.updateById(new TaskDefinitionLog())).thenReturn(1); Map<String, Object> relation = taskDefinitionService .switchVersion(loginUser, projectCode, taskCode, version); Assert.assertEquals(Status.SUCCESS, relation.get(Constants.STATUS)); } private void putMsg(Map<String, Object> result, Status status, Object... statusParams) { result.put(Constants.STATUS, status); if (statusParams != null && statusParams.length > 0) { result.put(Constants.MSG, MessageFormat.format(status.getMsg(), statusParams)); } else { result.put(Constants.MSG, status.getMsg()); } } /** * get mock Project * * @param projectCode projectCode
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
* @return Project */ private Project getProject(long projectCode) { Project project = new Project(); project.setId(1); project.setCode(projectCode); project.setName("test"); project.setUserId(1); return project; } private TaskDefinition getTaskDefinition() { TaskDefinition taskDefinition = new TaskDefinition(); taskDefinition.setProjectCode(1L); taskDefinition.setCode(1L); taskDefinition.setVersion(1); taskDefinition.setTaskType("SHELL"); return taskDefinition; } @Test public void checkJson() { String taskDefinitionJson = "[{\"name\":\"detail_up\",\"description\":\"\",\"taskType\":\"SHELL\",\"taskParams\":" + "\"{\\\"resourceList\\\":[],\\\"localParams\\\":[{\\\"prop\\\":\\\"datetime\\\",\\\"direct\\\":\\\"IN\\\"," + "\\\"type\\\":\\\"VARCHAR\\\",\\\"value\\\":\\\"${system.datetime}\\\"}],\\\"rawScript\\\":" + "\\\"echo ${datetime}\\\",\\\"conditionResult\\\":\\\"{\\\\\\\"successNode\\\\\\\":[\\\\\\\"\\\\\\\"]," + "\\\\\\\"failedNode\\\\\\\":[\\\\\\\"\\\\\\\"]}\\\",\\\"dependence\\\":{}}\",\"flag\":0,\"taskPriority\":0," + "\"workerGroup\":\"default\",\"failRetryTimes\":0,\"failRetryInterval\":0,\"timeoutFlag\":0," + "\"timeoutNotifyStrategy\":0,\"timeout\":0,\"delayTime\":0,\"resourceIds\":\"\"}]"; List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class); Assert.assertFalse(taskDefinitionLogs.isEmpty()); String taskJson = "[{\"name\":\"shell1\",\"description\":\"\",\"taskType\":\"SHELL\",\"taskParams\":{\"resourceList\":[],"
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
+ "\"localParams\":[],\"rawScript\":\"echo 1\",\"conditionResult\":{\"successNode\":[\"\"],\"failedNode\":[\"\"]},\"dependence\":{}}," + "\"flag\":\"NORMAL\",\"taskPriority\":\"MEDIUM\",\"workerGroup\":\"default\",\"failRetryTimes\":\"0\",\"failRetryInterval\":\"1\"," + "\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"timeout\":null,\"delayTime\":\"0\"},{\"name\":\"shell2\",\"description\":\"\"," + "\"taskType\":\"SHELL\",\"taskParams\":{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"echo 2\",\"conditionResult\":{\"successNode\"" + ":[\"\"],\"failedNode\":[\"\"]},\"dependence\":{}},\"flag\":\"NORMAL\",\"taskPriority\":\"MEDIUM\",\"workerGroup\":\"default\"," + "\"failRetryTimes\":\"0\",\"failRetryInterval\":\"1\",\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"timeout\":null,\"delayTime\":\"0\"}]"; taskDefinitionLogs = JSONUtils.toList(taskJson, TaskDefinitionLog.class); Assert.assertFalse(taskDefinitionLogs.isEmpty()); String taskParams = "{\"resourceList\":[],\"localParams\":[{\"prop\":\"datetime\",\"direct\":\"IN\",\"type\":\"VARCHAR\"," + "\"value\":\"${system.datetime}\"}],\"rawScript\":\"echo ${datetime}\",\"conditionResult\":\"{\\\"successNode\\\":[\\\"\\\"]," + "\\\"failedNode\\\":[\\\"\\\"]}\",\"dependence\":{}}"; Map parameters = JSONUtils.parseObject(taskParams, Map.class); Assert.assertNotNull(parameters); String params = "{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"echo 1\",\"conditionResult\":{\"successNode\":[\"\"],\"failedNode\":[\"\"]},\"dependence\":{}}"; Map parameters1 = JSONUtils.parseObject(params, Map.class); Assert.assertNotNull(parameters1); } @Test public void genTaskCodeList() { Map<String, Object> genTaskCodeList = taskDefinitionService.genTaskCodeList(10); Assert.assertEquals(Status.SUCCESS, genTaskCodeList.get(Constants.STATUS)); } @Test public void testReleaseTaskDefinition() { long projectCode = 1L; long taskCode = 1L; Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); Project project = getProject(projectCode); User loginUser = new User(); loginUser.setId(1);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TaskDefinitionServiceImplTest.java
loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.TASK_DEFINE_NOT_EXIST, taskCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,null)).thenReturn(result); Map<String, Object> map = taskDefinitionService.releaseTaskDefinition(loginUser, projectCode, taskCode, ReleaseState.OFFLINE); Assert.assertEquals(Status.TASK_DEFINE_NOT_EXIST, map.get(Constants.STATUS)); putMsg(result, Status.SUCCESS); TaskDefinition taskDefinition = new TaskDefinition(); taskDefinition.setProjectCode(projectCode); taskDefinition.setVersion(1); taskDefinition.setCode(taskCode); String params = "{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"echo 1\",\"conditionResult\":{\"successNode\":[\"\"],\"failedNode\":[\"\"]},\"dependence\":{}}"; taskDefinition.setTaskParams(params); taskDefinition.setTaskType("SHELL"); Mockito.when(taskDefinitionMapper.queryByCode(taskCode)).thenReturn(taskDefinition); TaskDefinitionLog taskDefinitionLog = new TaskDefinitionLog(taskDefinition); Mockito.when(taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskCode, taskDefinition.getVersion())).thenReturn(taskDefinitionLog); Map<String, Object> offlineTaskResult = taskDefinitionService.releaseTaskDefinition(loginUser, projectCode, taskCode, ReleaseState.OFFLINE); Assert.assertEquals(Status.SUCCESS, offlineTaskResult.get(Constants.STATUS)); Map<String, Object> onlineTaskResult = taskDefinitionService.releaseTaskDefinition(loginUser, projectCode, taskCode, ReleaseState.ONLINE); Assert.assertEquals(Status.SUCCESS, onlineTaskResult.get(Constants.STATUS)); Map<String, Object> failResult = taskDefinitionService.releaseTaskDefinition(loginUser, projectCode, taskCode, ReleaseState.getEnum(2)); Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, failResult.get(Constants.STATUS)); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapper.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.dao.mapper; import org.apache.dolphinscheduler.dao.entity.DefinitionGroupByUser; import org.apache.dolphinscheduler.dao.entity.TaskDefinition; import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog; import org.apache.dolphinscheduler.dao.entity.TaskMainInfo; import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.Param; import java.util.Collection;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapper.java
import java.util.List; import java.util.Map; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; /** * task definition mapper interface */ public interface TaskDefinitionMapper extends BaseMapper<TaskDefinition> { /** * query task definition by name * * @param projectCode projectCode * @param name name * @return task definition */ TaskDefinition queryByName(@Param("projectCode") long projectCode, @Param("name") String name); /** * query task definition by code * * @param code taskDefinitionCode * @return task definition */ TaskDefinition queryByCode(@Param("code") long code); /** * query all task definition list * * @param projectCode projectCode * @return task definition list */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapper.java
List<TaskDefinition> queryAllDefinitionList(@Param("projectCode") long projectCode); /** * count task definition group by user * * @param projectCodes projectCodes * @return task definition list */ List<DefinitionGroupByUser> countDefinitionGroupByUser(@Param("projectCodes") Long[] projectCodes); /** * list all resource ids * * @return task ids list */ @MapKey("id") List<Map<String, Object>> listResources(); /** * list all resource ids by user id * * @return resource ids list */ @MapKey("id") List<Map<String, Object>> listResourcesByUser(@Param("userId") Integer userId); /** * delete task definition by code * * @param code code * @return int */ int deleteByCode(@Param("code") long code); /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapper.java
* batch insert task definitions * * @param taskDefinitions taskDefinitions * @return int */ int batchInsert(@Param("taskDefinitions") List<TaskDefinitionLog> taskDefinitions); /** * task main info page * * @param page page * @param projectCode projectCode * @param searchWorkflowName searchWorkflowName * @param searchTaskName searchTaskName * @param taskType taskType * @return task main info IPage */ IPage<TaskMainInfo> queryDefineListPaging(IPage<TaskMainInfo> page, @Param("projectCode") long projectCode, @Param("searchWorkflowName") String searchWorkflowName, @Param("searchTaskName") String searchTaskName, @Param("taskType") String taskType); /** * query task definition by code list * * @param codes taskDefinitionCode list * @return task definition list */ List<TaskDefinition> queryByCodeList(@Param("codes") Collection<Long> codes); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapperTest.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.dao.mapper; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.dao.BaseDaoTest; import org.apache.dolphinscheduler.dao.entity.DefinitionGroupByUser; import org.apache.dolphinscheduler.dao.entity.TaskDefinition; import org.apache.dolphinscheduler.dao.entity.User; import java.util.Date; import java.util.List; import java.util.Map; import org.junit.Assert; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; public class TaskDefinitionMapperTest extends BaseDaoTest {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapperTest.java
@Autowired private TaskDefinitionMapper taskDefinitionMapper; @Autowired private UserMapper userMapper; public TaskDefinition insertOne() { return insertOne(99); } public TaskDefinition insertOne(int userId) { TaskDefinition taskDefinition = new TaskDefinition(); taskDefinition.setCode(888888L);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapperTest.java
taskDefinition.setName("unit-test"); taskDefinition.setProjectCode(1L); taskDefinition.setTaskType("SHELL"); taskDefinition.setUserId(userId); taskDefinition.setResourceIds("1"); taskDefinition.setWorkerGroup("default"); taskDefinition.setEnvironmentCode(1L); taskDefinition.setVersion(1); taskDefinition.setCreateTime(new Date()); taskDefinition.setUpdateTime(new Date()); taskDefinitionMapper.insert(taskDefinition); return taskDefinition; } @Test public void testInsert() { TaskDefinition taskDefinition = insertOne(); Assert.assertNotEquals(taskDefinition.getId(), 0); } @Test public void testQueryByDefinitionName() { TaskDefinition taskDefinition = insertOne(); TaskDefinition result = taskDefinitionMapper.queryByName(taskDefinition.getProjectCode() , taskDefinition.getName()); Assert.assertNotNull(result); } @Test public void testQueryByDefinitionCode() { TaskDefinition taskDefinition = insertOne(); TaskDefinition result = taskDefinitionMapper.queryByCode(taskDefinition.getCode()); Assert.assertNotNull(result);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapperTest.java
} @Test public void testQueryAllDefinitionList() { TaskDefinition taskDefinition = insertOne(); List<TaskDefinition> taskDefinitions = taskDefinitionMapper.queryAllDefinitionList(taskDefinition.getProjectCode()); Assert.assertNotEquals(taskDefinitions.size(), 0); } @Test public void testCountDefinitionGroupByUser() { User user = new User(); user.setUserName("un"); userMapper.insert(user); User un = userMapper.queryByUserNameAccurately("un"); TaskDefinition taskDefinition = insertOne(un.getId()); List<DefinitionGroupByUser> users = taskDefinitionMapper.countDefinitionGroupByUser(new Long[]{taskDefinition.getProjectCode()}); Assert.assertNotEquals(users.size(), 0); } @Test public void testListResources() { TaskDefinition taskDefinition = insertOne(); List<Map<String, Object>> maps = taskDefinitionMapper.listResources(); Assert.assertNotEquals(maps.size(), 0); } @Test public void testListResourcesByUser() { User user = new User(); user.setUserName("un"); userMapper.insert(user); User un = userMapper.queryByUserNameAccurately("un"); TaskDefinition taskDefinition = insertOne(un.getId());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,431
[Bug] [Python] Python-gate can't support setting the same task name in the same project for different process
### 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 I set tasks with the same name in different process of the same project through python-gate. The system treats these two tasks as one. Instead of inserting a new piece of data to table t_ds_task_definition, the system adds one to the original version of the data. Although the correct task was found in the t_ds_task_definition_log table by version when the task was executed, this still has implications. So when a task is created, it should be treated as a new task. ### What you expected to happen When I set tasks with the same name in different process of the same project through python-gate,it should be treated as a new task. ### How to reproduce Set tasks with the same name in different process of the same project through python-gate ### Anything else _No response_ ### Version 2.0.3 ### 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/10431
https://github.com/apache/dolphinscheduler/pull/10428
190f253083e2b1d50f235b07c53fbbe6b66c1aa2
b86dc53ad10cb5c4d76f5e85c38e5a5659a349fd
2022-06-13T09:35:00Z
java
2022-06-14T05:53:18Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapperTest.java
List<Map<String, Object>> maps = taskDefinitionMapper.listResourcesByUser(taskDefinition.getUserId()); Assert.assertNotEquals(maps.size(), 0); } @Test public void testDeleteByCode() { TaskDefinition taskDefinition = insertOne(); int i = taskDefinitionMapper.deleteByCode(taskDefinition.getCode()); Assert.assertNotEquals(i, 0); } @Test public void testNullPropertyValueOfLocalParams() { String definitionJson = "{\"failRetryTimes\":\"0\",\"timeoutNotifyStrategy\":\"\",\"code\":\"5195043558720\",\"flag\":\"YES\",\"environmentCode\":\"-1\",\"taskDefinitionIndex\":2,\"taskPriority\":\"MEDIUM\",\"taskParams\":\"{\\\"preStatements\\\":null,\\\"postStatements\\\":null,\\\"type\\\":\\\"ADB_MYSQL\\\",\\\"database\\\":\\\"lijia\\\",\\\"sql\\\":\\\"create table nation_${random_serial_number} as select * from nation\\\",\\\"localParams\\\":[{\\\"direct\\\":2,\\\"type\\\":3,\\\"prop\\\":\\\"key\\\"}],\\\"Name\\\":\\\"create_table_as_select_nation\\\",\\\"FailRetryTimes\\\":0,\\\"dbClusterId\\\":\\\"amv-bp10o45925jpx959\\\",\\\"sendEmail\\\":false,\\\"displayRows\\\":10,\\\"limit\\\":10000,\\\"agentSource\\\":\\\"Workflow\\\",\\\"agentVersion\\\":\\\"Unkown\\\"}\",\"timeout\":\"0\",\"taskType\":\"ADB_MYSQL\",\"timeoutFlag\":\"CLOSE\",\"projectCode\":\"5191800302720\",\"name\":\"create_table_as_select_nation\",\"delayTime\":\"0\",\"workerGroup\":\"default\"}"; TaskDefinition definition = JSONUtils.parseObject(definitionJson, TaskDefinition.class); Map<String, String> taskParamsMap = definition.getTaskParamMap(); if (taskParamsMap != null) { Assert.assertNull(taskParamsMap.get("key")); } else { Assert.fail("Deserialize the task definition failed"); } String newDefinitionJson = JSONUtils.toJsonString(definition); Assert.assertNotNull("Serialize the task definition success", newDefinitionJson); } @Test public void testNullLocalParamsOfTaskParams() { String definitionJson = "{\"failRetryTimes\":\"0\",\"timeoutNotifyStrategy\":\"\",\"code\":\"5195043558720\",\"flag\":\"YES\",\"environmentCode\":\"-1\",\"taskDefinitionIndex\":2,\"taskPriority\":\"MEDIUM\",\"taskParams\":\"{\\\"preStatements\\\":null,\\\"postStatements\\\":null,\\\"type\\\":\\\"ADB_MYSQL\\\",\\\"database\\\":\\\"lijia\\\",\\\"sql\\\":\\\"create table nation_${random_serial_number} as select * from nation\\\",\\\"localParams\\\":null,\\\"Name\\\":\\\"create_table_as_select_nation\\\",\\\"FailRetryTimes\\\":0,\\\"dbClusterId\\\":\\\"amv-bp10o45925jpx959\\\",\\\"sendEmail\\\":false,\\\"displayRows\\\":10,\\\"limit\\\":10000,\\\"agentSource\\\":\\\"Workflow\\\",\\\"agentVersion\\\":\\\"Unkown\\\"}\",\"timeout\":\"0\",\"taskType\":\"ADB_MYSQL\",\"timeoutFlag\":\"CLOSE\",\"projectCode\":\"5191800302720\",\"name\":\"create_table_as_select_nation\",\"delayTime\":\"0\",\"workerGroup\":\"default\"}"; TaskDefinition definition = JSONUtils.parseObject(definitionJson, TaskDefinition.class); Assert.assertNull("Serialize the task definition success", definition.getTaskParamMap()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.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.conditions.query.QueryWrapper; 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;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
import org.apache.dolphinscheduler.api.dto.resources.ResourceComponent; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.exceptions.ServiceException; import org.apache.dolphinscheduler.api.service.UsersService; import org.apache.dolphinscheduler.api.utils.CheckUtils; 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.Flag; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.storage.StorageOperate; import org.apache.dolphinscheduler.common.utils.EncryptionUtils; import org.apache.dolphinscheduler.common.utils.PropertyUtils; import org.apache.dolphinscheduler.dao.entity.AlertGroup; import org.apache.dolphinscheduler.dao.entity.DatasourceUser; import org.apache.dolphinscheduler.dao.entity.K8sNamespaceUser; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.ProjectUser; import org.apache.dolphinscheduler.dao.entity.Resource; import org.apache.dolphinscheduler.dao.entity.ResourcesUser; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.UDFUser; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.AccessTokenMapper; import org.apache.dolphinscheduler.dao.mapper.AlertGroupMapper; import org.apache.dolphinscheduler.dao.mapper.DataSourceUserMapper; import org.apache.dolphinscheduler.dao.mapper.K8sNamespaceUserMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
import org.apache.dolphinscheduler.dao.mapper.ProjectUserMapper; import org.apache.dolphinscheduler.dao.mapper.ResourceMapper; import org.apache.dolphinscheduler.dao.mapper.ResourceUserMapper; import org.apache.dolphinscheduler.dao.mapper.TenantMapper; import org.apache.dolphinscheduler.dao.mapper.UDFUserMapper; import org.apache.dolphinscheduler.dao.mapper.UserMapper; import org.apache.dolphinscheduler.dao.utils.ResourceProcessDefinitionUtils; import org.apache.dolphinscheduler.api.permission.ResourcePermissionCheckService; 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.io.IOException; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TimeZone; import java.util.Arrays; import java.util.stream.Collectors; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.USER_MANAGER; /** * users service impl */ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
public class UsersServiceImpl extends BaseServiceImpl implements UsersService { private static final Logger logger = LoggerFactory.getLogger(UsersServiceImpl.class); @Autowired private AccessTokenMapper accessTokenMapper; @Autowired private UserMapper userMapper; @Autowired private TenantMapper tenantMapper; @Autowired private ProjectUserMapper projectUserMapper; @Autowired private ResourceUserMapper resourceUserMapper; @Autowired private ResourceMapper resourceMapper;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
@Autowired private DataSourceUserMapper datasourceUserMapper; @Autowired private UDFUserMapper udfUserMapper; @Autowired private AlertGroupMapper alertGroupMapper; @Autowired private ProcessDefinitionMapper processDefinitionMapper; @Autowired private ProjectMapper projectMapper; @Autowired(required = false) private StorageOperate storageOperate; @Autowired private K8sNamespaceUserMapper k8sNamespaceUserMapper; @Autowired private ResourcePermissionCheckService resourcePermissionCheckService; /** * create user, only system admin have permission * * @param loginUser login user * @param userName user name * @param userPassword user password * @param email email * @param tenantId tenant id * @param phone phone * @param queue queue * @return create result code * @throws Exception exception */ @Override
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
@Transactional(rollbackFor = Exception.class) public Map<String, Object> createUser(User loginUser, String userName, String userPassword, String email, int tenantId, String phone, String queue, int state) throws Exception { Map<String, Object> result = new HashMap<>(); String msg = this.checkUserParams(userName, userPassword, email, phone); if(resourcePermissionCheckService.functionDisabled()){ putMsg(result, Status.FUNCTION_DISABLED, msg); return result; } if (!isAdmin(loginUser)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } if (!StringUtils.isEmpty(msg)) { putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, msg); return result; } if (!checkTenantExists(tenantId)) { putMsg(result, Status.TENANT_NOT_EXIST); return result; } User user = createUser(userName, userPassword, email, tenantId, phone, queue, state); Tenant tenant = tenantMapper.queryById(tenantId);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
if (PropertyUtils.getResUploadStartupState()) { storageOperate.createTenantDirIfNotExists(tenant.getTenantCode()); } result.put(Constants.DATA_LIST, user); putMsg(result, Status.SUCCESS); return result; } @Override @Transactional(rollbackFor = RuntimeException.class) public User createUser(String userName, String userPassword, String email, int tenantId, String phone, String queue, int state) { User user = new User(); Date now = new Date(); user.setUserName(userName); user.setUserPassword(EncryptionUtils.getMd5(userPassword)); user.setEmail(email); user.setTenantId(tenantId); user.setPhone(phone); user.setState(state); user.setUserType(UserType.GENERAL_USER); user.setCreateTime(now); user.setUpdateTime(now); if (StringUtils.isEmpty(queue)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
queue = ""; } user.setQueue(queue); userMapper.insert(user); return user; } /*** * create User for ldap login */ @Override @Transactional(rollbackFor = Exception.class) public User createUser(UserType userType, String userId, String email) { User user = new User(); Date now = new Date(); user.setUserName(userId); user.setEmail(email); user.setUserType(userType); user.setCreateTime(now); user.setUpdateTime(now); user.setQueue(""); userMapper.insert(user); return user; } /** * get user by user name * * @param userName user name
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
* @return exist user or null */ @Override public User getUserByUserName(String userName) { return userMapper.queryByUserNameAccurately(userName); } /** * query user by id * * @param id id * @return user info */ @Override public User queryUser(int id) { return userMapper.selectById(id); } @Override public List<User> queryUser(List<Integer> ids) { if (CollectionUtils.isEmpty(ids)) { return new ArrayList<>(); } return userMapper.selectByIds(ids); } /** * query user * * @param name name * @return user info */ @Override
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
public User queryUser(String name) { return userMapper.queryByUserNameAccurately(name); } /** * query user * * @param name name * @param password password * @return user info */ @Override public User queryUser(String name, String password) { String md5 = EncryptionUtils.getMd5(password); return userMapper.queryUserByNamePassword(name, md5); } /** * get user id by user name * * @param name user name * @return if name empty 0, user not exists -1, user exist user id */ @Override public int getUserIdByName(String name) { int executorId = 0; if (StringUtils.isNotEmpty(name)) { User executor = queryUser(name); if (null != executor) { executorId = executor.getId(); } else {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
executorId = -1; } } return executorId; } /** * query user list * * @param loginUser login user * @param pageNo page number * @param searchVal search value * @param pageSize page size * @return user list page */ @Override public Result<Object> queryUserList(User loginUser, String searchVal, Integer pageNo, Integer pageSize) { Result<Object> result = new Result<>(); if(resourcePermissionCheckService.functionDisabled()){ putMsg(result, Status.FUNCTION_DISABLED); return result; } if (!isAdmin(loginUser)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } Page<User> page = new Page<>(pageNo, pageSize); IPage<User> scheduleList = userMapper.queryUserPaging(page, searchVal); PageInfo<User> pageInfo = new PageInfo<>(pageNo, pageSize); pageInfo.setTotal((int) scheduleList.getTotal()); pageInfo.setTotalList(scheduleList.getRecords());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
result.setData(pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * updateProcessInstance user * * @param userId user id * @param userName user name * @param userPassword user password * @param email email * @param tenantId tenant id * @param phone phone * @param queue queue * @param state state * @param timeZone timeZone * @return update result code * @throws Exception exception */ @Override public Map<String, Object> updateUser(User loginUser, int userId, String userName, String userPassword, String email, int tenantId, String phone, String queue, int state, String timeZone) throws IOException { Map<String, Object> result = new HashMap<>();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
result.put(Constants.STATUS, false); if(resourcePermissionCheckService.functionDisabled()){ putMsg(result, Status.FUNCTION_DISABLED); return result; } if (check(result, !canOperator(loginUser, userId), Status.USER_NO_OPERATION_PERM)) { return result; } User user = userMapper.selectById(userId); if (user == null) { putMsg(result, Status.USER_NOT_EXIST, userId); return result; } if (StringUtils.isNotEmpty(userName)) { if (!CheckUtils.checkUserName(userName)) { putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, userName); return result; } User tempUser = userMapper.queryByUserNameAccurately(userName); if (tempUser != null && tempUser.getId() != userId) { putMsg(result, Status.USER_NAME_EXIST); return result; } user.setUserName(userName); } if (StringUtils.isNotEmpty(userPassword)) { if (!CheckUtils.checkPassword(userPassword)) { putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, userPassword); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
user.setUserPassword(EncryptionUtils.getMd5(userPassword)); } if (StringUtils.isNotEmpty(email)) { if (!CheckUtils.checkEmail(email)) { putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, email); return result; } user.setEmail(email); } if (StringUtils.isNotEmpty(phone) && !CheckUtils.checkPhone(phone)) { putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, phone); return result; } if (state == 0 && user.getState() != state && loginUser.getId() == user.getId()) { putMsg(result, Status.NOT_ALLOW_TO_DISABLE_OWN_ACCOUNT); return result; } if (StringUtils.isNotEmpty(timeZone)) { if (!CheckUtils.checkTimeZone(timeZone)) { putMsg(result, Status.TIME_ZONE_ILLEGAL, timeZone); return result; } user.setTimeZone(timeZone); } user.setPhone(phone); user.setQueue(queue); user.setState(state); Date now = new Date(); user.setUpdateTime(now);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
user.setTenantId(tenantId); userMapper.updateById(user); putMsg(result, Status.SUCCESS); return result; } /** * delete user * * @param loginUser login user * @param id user id * @return delete result code * @throws Exception exception when operate hdfs */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> deleteUserById(User loginUser, int id) throws IOException { Map<String, Object> result = new HashMap<>(); if(resourcePermissionCheckService.functionDisabled()){ putMsg(result, Status.FUNCTION_DISABLED); return result; } if (!isAdmin(loginUser)) { putMsg(result, Status.USER_NO_OPERATION_PERM, id); return result; } User tempUser = userMapper.selectById(id); if (tempUser == null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
putMsg(result, Status.USER_NOT_EXIST, id); return result; } List<Project> projects = projectMapper.queryProjectCreatedByUser(id); if (CollectionUtils.isNotEmpty(projects)) { String projectNames = projects.stream().map(Project::getName).collect(Collectors.joining(",")); putMsg(result, Status.TRANSFORM_PROJECT_OWNERSHIP, projectNames); return result; } userMapper.queryTenantCodeByUserId(id); accessTokenMapper.deleteAccessTokenByUserId(id); userMapper.deleteById(id); putMsg(result, Status.SUCCESS); return result; } /** * grant project * * @param loginUser login user * @param userId user id * @param projectIds project id array * @return grant result code */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> grantProject(User loginUser, int userId, String projectIds) { Map<String, Object> result = new HashMap<>(); result.put(Constants.STATUS, false);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
if(resourcePermissionCheckService.functionDisabled()){ putMsg(result, Status.FUNCTION_DISABLED); return result; } User tempUser = userMapper.selectById(userId); if (tempUser == null) { putMsg(result, Status.USER_NOT_EXIST, userId); return result; } projectUserMapper.deleteProjectRelation(0, userId); if (check(result, StringUtils.isEmpty(projectIds), Status.SUCCESS)) { return result; } Arrays.stream(projectIds.split(",")).distinct().forEach(projectId -> { Date now = new Date(); ProjectUser projectUser = new ProjectUser(); projectUser.setUserId(userId); projectUser.setProjectId(Integer.parseInt(projectId)); projectUser.setPerm(Constants.AUTHORIZE_WRITABLE_PERM); projectUser.setCreateTime(now); projectUser.setUpdateTime(now); projectUserMapper.insert(projectUser); }); putMsg(result, Status.SUCCESS); return result; } /** * grant project by code *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
* @param loginUser login user * @param userId user id * @param projectCode project code * @return grant result code */ @Override public Map<String, Object> grantProjectByCode(final User loginUser, final int userId, final long projectCode) { Map<String, Object> result = new HashMap<>(); result.put(Constants.STATUS, false); if(resourcePermissionCheckService.functionDisabled()){ putMsg(result, Status.FUNCTION_DISABLED); return result; } User tempUser = this.userMapper.selectById(userId); if (tempUser == null) { this.putMsg(result, Status.USER_NOT_EXIST, userId); return result; } Project project = this.projectMapper.queryByCode(projectCode); if (project == null) { this.putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); return result; } if (!this.canOperator(loginUser, project.getUserId())) { this.putMsg(result, Status.USER_NO_OPERATION_PERM); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
ProjectUser projectUser = projectUserMapper.queryProjectRelation(project.getId(), userId); if (projectUser == null) { Date today = new Date(); projectUser = new ProjectUser(); projectUser.setUserId(userId); projectUser.setProjectId(project.getId()); projectUser.setPerm(7); projectUser.setCreateTime(today); projectUser.setUpdateTime(today); this.projectUserMapper.insert(projectUser); } this.putMsg(result, Status.SUCCESS); return result; } /** * revoke the project permission for specified user. * * @param loginUser Login user * @param userId User id * @param projectCode Project Code * @return */ @Override public Map<String, Object> revokeProject(User loginUser, int userId, long projectCode) { Map<String, Object> result = new HashMap<>(); result.put(Constants.STATUS, false); if(resourcePermissionCheckService.functionDisabled()){ putMsg(result, Status.FUNCTION_DISABLED); return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
} if (this.check(result, !this.isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) { return result; } User user = this.userMapper.selectById(userId); if (user == null) { this.putMsg(result, Status.USER_NOT_EXIST, userId); return result; } Project project = this.projectMapper.queryByCode(projectCode); if (project == null) { this.putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); return result; } this.projectUserMapper.deleteProjectRelation(project.getId(), user.getId()); this.putMsg(result, Status.SUCCESS); return result; } /** * grant resource * * @param loginUser login user * @param userId user id * @param resourceIds resource id array * @return grant result code */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
@Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> grantResources(User loginUser, int userId, String resourceIds) { Map<String, Object> result = new HashMap<>(); if(resourcePermissionCheckService.functionDisabled()){ putMsg(result, Status.FUNCTION_DISABLED); return result; } User user = userMapper.selectById(userId); if (user == null) { putMsg(result, Status.USER_NOT_EXIST, userId); return result; } Set<Integer> needAuthorizeResIds = new HashSet<>(); if (StringUtils.isNotBlank(resourceIds)) { String[] resourceFullIdArr = resourceIds.split(","); for (String resourceFullId : resourceFullIdArr) { String[] resourceIdArr = resourceFullId.split("-"); for (int i = 0; i <= resourceIdArr.length - 1; i++) { int resourceIdValue = Integer.parseInt(resourceIdArr[i]); needAuthorizeResIds.add(resourceIdValue); } } } List<Integer> resIds = resourceUserMapper.queryResourcesIdListByUserIdAndPerm(userId, Constants.AUTHORIZE_WRITABLE_PERM); List<Resource> oldAuthorizedRes = CollectionUtils.isEmpty(resIds) ? new ArrayList<>() : resourceMapper.queryResourceListById(resIds); Set<Integer> oldAuthorizedResIds = oldAuthorizedRes.stream().map(Resource::getId).collect(Collectors.toSet());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
oldAuthorizedResIds.removeAll(needAuthorizeResIds); if (CollectionUtils.isNotEmpty(oldAuthorizedResIds)) { List<Map<String, Object>> list = processDefinitionMapper.listResourcesByUser(userId); Map<Integer, Set<Long>> resourceProcessMap = ResourceProcessDefinitionUtils.getResourceProcessDefinitionMap(list); Set<Integer> resourceIdSet = resourceProcessMap.keySet(); resourceIdSet.retainAll(oldAuthorizedResIds); if (CollectionUtils.isNotEmpty(resourceIdSet)) { logger.error("can't be deleted,because it is used of process definition"); for (Integer resId : resourceIdSet) { logger.error("resource id:{} is used of process definition {}", resId, resourceProcessMap.get(resId)); } putMsg(result, Status.RESOURCE_IS_USED); return result; } } resourceUserMapper.deleteResourceUser(userId, 0); if (check(result, StringUtils.isEmpty(resourceIds), Status.SUCCESS)) { return result; } for (int resourceIdValue : needAuthorizeResIds) { Resource resource = resourceMapper.selectById(resourceIdValue); if (resource == null) { putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } Date now = new Date(); ResourcesUser resourcesUser = new ResourcesUser(); resourcesUser.setUserId(userId);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
resourcesUser.setResourcesId(resourceIdValue); if (resource.isDirectory()) { resourcesUser.setPerm(Constants.AUTHORIZE_READABLE_PERM); } else { resourcesUser.setPerm(Constants.AUTHORIZE_WRITABLE_PERM); } resourcesUser.setCreateTime(now); resourcesUser.setUpdateTime(now); resourceUserMapper.insert(resourcesUser); } putMsg(result, Status.SUCCESS); return result; } /** * grant udf function * * @param loginUser login user * @param userId user id * @param udfIds udf id array * @return grant result code */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> grantUDFFunction(User loginUser, int userId, String udfIds) { Map<String, Object> result = new HashMap<>(); if(resourcePermissionCheckService.functionDisabled()){ putMsg(result, Status.FUNCTION_DISABLED); return result; } User user = userMapper.selectById(userId);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
if (user == null) { putMsg(result, Status.USER_NOT_EXIST, userId); return result; } udfUserMapper.deleteByUserId(userId); if (check(result, StringUtils.isEmpty(udfIds), Status.SUCCESS)) { return result; } String[] resourcesIdArr = udfIds.split(","); for (String udfId : resourcesIdArr) { Date now = new Date(); UDFUser udfUser = new UDFUser(); udfUser.setUserId(userId); udfUser.setUdfId(Integer.parseInt(udfId)); udfUser.setPerm(Constants.AUTHORIZE_WRITABLE_PERM); udfUser.setCreateTime(now); udfUser.setUpdateTime(now); udfUserMapper.insert(udfUser); } putMsg(result, Status.SUCCESS); return result; } /** * grant namespace * * @param loginUser login user * @param userId user id * @param namespaceIds namespace id array * @return grant result code */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
@Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> grantNamespaces(User loginUser, int userId, String namespaceIds) { Map<String, Object> result = new HashMap<>(); result.put(Constants.STATUS, false); if(resourcePermissionCheckService.functionDisabled()){ putMsg(result, Status.FUNCTION_DISABLED); return result; } if (this.check(result, !this.isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) { return result; } User tempUser = userMapper.selectById(userId); if (tempUser == null) { putMsg(result, Status.USER_NOT_EXIST, userId); return result; } k8sNamespaceUserMapper.deleteNamespaceRelation(0, userId); if (StringUtils.isNotEmpty(namespaceIds)) { String[] namespaceIdArr = namespaceIds.split(","); for (String namespaceId : namespaceIdArr) { Date now = new Date(); K8sNamespaceUser namespaceUser = new K8sNamespaceUser(); namespaceUser.setUserId(userId); namespaceUser.setNamespaceId(Integer.parseInt(namespaceId)); namespaceUser.setPerm(7); namespaceUser.setCreateTime(now); namespaceUser.setUpdateTime(now);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,386
[Bug] [dolphinscheduler-api] When connecting to ldap, ldap users cannot log in
### 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 当配置 conf/application-api.properties 为ldap认证时 ``` security.authentication.type=LDAP ldap.urls=ldap://xx.xx.xx.xx:389 ldap.base.dn=cn=users,cn=accounts,dc=hadoop,dc=com ldap.username=cn=Directory Manager ldap.password=xxxx ldap.user.identity.attribute=uid ldap.user.email.attribute=mail ``` ![image](https://user-images.githubusercontent.com/28641261/172813992-8dda359b-798c-40ad-8da5-909b98a692f4.png) ### What you expected to happen 报错是用户停用,查询数据库发现 ``` id: 2 user_name: user1 user_password: NULL user_type: 1 email: [email protected] phone: NULL tenant_id: 0 create_time: 2022-06-08 11:01:43 update_time: 2022-06-08 11:01:43 queue: state: 0 ``` state状态为0 代码中创建从ladp读取的用户state默认都是0,这样对接ladp后,ladp中的用户仍然不能登录 ### How to reproduce 操作如上,配置任何ladp均会出现上述现象。 ### Anything else _No response_ ### Version 2.0.5 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10386
https://github.com/apache/dolphinscheduler/pull/10426
0efcd5c6317c9e12c172103a4ed6df0cdcda027d
50846760e5ab5f68cb708edc72725b235e933a34
2022-06-09T09:32:41Z
java
2022-06-15T02:19:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
k8sNamespaceUserMapper.insert(namespaceUser); } } putMsg(result, Status.SUCCESS); return result; } /** * grant datasource * * @param loginUser login user * @param userId user id * @param datasourceIds data source id array * @return grant result code */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> grantDataSource(User loginUser, int userId, String datasourceIds) { Map<String, Object> result = new HashMap<>(); result.put(Constants.STATUS, false); if(resourcePermissionCheckService.functionDisabled()){ putMsg(result, Status.FUNCTION_DISABLED); return result; } User user = userMapper.selectById(userId); if (user == null) { putMsg(result, Status.USER_NOT_EXIST, userId); return result; } datasourceUserMapper.deleteByUserId(userId); if (check(result, StringUtils.isEmpty(datasourceIds), Status.SUCCESS)) {