status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
233
body
stringlengths
0
186k
issue_url
stringlengths
38
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
unknown
language
stringclasses
5 values
commit_datetime
unknown
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
/** * do batch move process definition * * @param targetProject targetProject * @param failedProcessList failedProcessList * @param processDefinitionIdList processDefinitionIdList */ private void doBatchMoveProcessDefinition(Project targetProject, List<String> failedProcessList, String[] processDefinitionIdList) { for (String processDefinitionId : processDefinitionIdList) { try { Map<String, Object> moveProcessDefinitionResult = moveProcessDefinition(Integer.valueOf(processDefinitionId), targetProject); if (!Status.SUCCESS.equals(moveProcessDefinitionResult.get(Constants.STATUS))) { setFailedProcessList(failedProcessList, processDefinitionId); logger.error((String) moveProcessDefinitionResult.get(Constants.MSG)); } } catch (Exception e) { setFailedProcessList(failedProcessList, processDefinitionId); } } } /** * batch copy process definition * * @param loginUser loginUser * @param targetProject targetProject * @param failedProcessList failedProcessList * @param processDefinitionIdList processDefinitionIdList */ private void doBatchCopyProcessDefinition(User loginUser, Project targetProject, List<String> failedProcessList, String[] processDefinitionIdList) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
for (String processDefinitionId : processDefinitionIdList) { try { Map<String, Object> copyProcessDefinitionResult = copyProcessDefinition(loginUser, Integer.valueOf(processDefinitionId), targetProject); if (!Status.SUCCESS.equals(copyProcessDefinitionResult.get(Constants.STATUS))) { setFailedProcessList(failedProcessList, processDefinitionId); logger.error((String) copyProcessDefinitionResult.get(Constants.MSG)); } } catch (Exception e) { setFailedProcessList(failedProcessList, processDefinitionId); } } } /** * set failed processList * * @param failedProcessList failedProcessList * @param processDefinitionId processDefinitionId */ private void setFailedProcessList(List<String> failedProcessList, String processDefinitionId) { ProcessDefinition processDefinition = processDefineMapper.queryByDefineId(Integer.valueOf(processDefinitionId)); if (processDefinition != null) { failedProcessList.add(processDefinitionId + "[" + processDefinition.getName() + "]"); } else { failedProcessList.add(processDefinitionId + "[null]"); } } /** * check project and auth *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* @param loginUser loginUser * @param projectName projectName */ private Map<String, Object> checkProjectAndAuth(User loginUser, String projectName) { Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return checkResult; } return null; } /** * move process definition * * @param processId processId * @param targetProject targetProject * @return move result code */ private Map<String, Object> moveProcessDefinition(Integer processId, Project targetProject) { Map<String, Object> result = new HashMap<>(); ProcessDefinition processDefinition = processDefineMapper.selectById(processId); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId); return result; } processDefinition.setProjectId(targetProject.getId()); processDefinition.setUpdateTime(new Date());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
if (processDefineMapper.updateById(processDefinition) > 0) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); } return result; } /** * check batch operate result * * @param srcProjectName srcProjectName * @param targetProjectName targetProjectName * @param result result * @param failedProcessList failedProcessList * @param isCopy isCopy */ private void checkBatchOperateResult(String srcProjectName, String targetProjectName, Map<String, Object> result, List<String> failedProcessList, boolean isCopy) { if (!failedProcessList.isEmpty()) { if (isCopy) { putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR, srcProjectName, targetProjectName, String.join(",", failedProcessList)); } else { putMsg(result, Status.MOVE_PROCESS_DEFINITION_ERROR, srcProjectName, targetProjectName, String.join(",", failedProcessList)); } } else { putMsg(result, Status.SUCCESS); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.controller; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.ProcessDefinitionVersionService; import org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
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.ReleaseState; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionVersion; import org.apache.dolphinscheduler.dao.entity.Resource; import org.apache.dolphinscheduler.dao.entity.User; import java.text.MessageFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletResponse; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.mock.web.MockHttpServletResponse; /** * process definition controller test */ @RunWith(MockitoJUnitRunner.Silent.class)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
public class ProcessDefinitionControllerTest { private static Logger logger = LoggerFactory.getLogger(ProcessDefinitionControllerTest.class); @InjectMocks private ProcessDefinitionController processDefinitionController; @Mock private ProcessDefinitionServiceImpl processDefinitionService; @Mock private ProcessDefinitionVersionService processDefinitionVersionService; protected User user; @Before public void before() { User loginUser = new User(); loginUser.setId(1); loginUser.setUserType(UserType.GENERAL_USER); loginUser.setUserName("admin"); user = loginUser;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
} @Test public void testCreateProcessDefinition() throws Exception { String json = "{\"globalParams\":[],\"tasks\":[{\"type\":\"SHELL\",\"id\":\"tasks-36196\",\"name\"" + ":\"ssh_test1\",\"params\":{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"aa=\\\"1234\\\"\\" + "necho ${aa}\"},\"desc\":\"\",\"runFlag\":\"NORMAL\",\"dependence\":{},\"maxRetryTimes\":\"0\"" + ",\"retryInterval\":\"1\",\"timeout\":{\"strategy\":\"\",\"interval\":null,\"enable\":false}," + "\"taskInstancePriority\":\"MEDIUM\",\"workerGroupId\":-1,\"preTasks\":[]}],\"tenantId\":-1,\"timeout\":0}"; String locations = "{\"tasks-36196\":{\"name\":\"ssh_test1\",\"targetarr\":\"\",\"x\":141,\"y\":70}}"; String projectName = "test"; String name = "dag_test"; String description = "desc test"; String connects = "[]"; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, 1); Mockito.when(processDefinitionService.createProcessDefinition(user, projectName, name, json, description, locations, connects)).thenReturn(result); Result response = processDefinitionController.createProcessDefinition(user, projectName, name, json, locations, connects, description); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } 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()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
@Test public void testVerifyProcessDefinitionName() throws Exception { Map<String, Object> result = new HashMap<>(); putMsg(result, Status.VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR); String projectName = "test"; String name = "dag_test"; Mockito.when(processDefinitionService.verifyProcessDefinitionName(user, projectName, name)).thenReturn(result); Result response = processDefinitionController.verifyProcessDefinitionName(user, projectName, name); Assert.assertEquals(Status.VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR.getCode(), response.getCode().intValue()); } @Test public void updateProcessDefinition() throws Exception { String json = "{\"globalParams\":[],\"tasks\":[{\"type\":\"SHELL\",\"id\":\"tasks-36196\",\"name\":\"ssh_test1\"" + ",\"params\":{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"aa=\\\"1234\\\"\\necho ${aa}\"}" + ",\"desc\":\"\",\"runFlag\":\"NORMAL\",\"dependence\":{},\"maxRetryTimes\":\"0\",\"retryInterval\"" + ":\"1\",\"timeout\":{\"strategy\":\"\",\"interval\":null,\"enable\":false},\"taskInstancePriority\"" + ":\"MEDIUM\",\"workerGroupId\":-1,\"preTasks\":[]}],\"tenantId\":-1,\"timeout\":0}"; String locations = "{\"tasks-36196\":{\"name\":\"ssh_test1\",\"targetarr\":\"\",\"x\":141,\"y\":70}}"; String projectName = "test"; String name = "dag_test"; String description = "desc test"; String connects = "[]"; int id = 1; int releaseState = 0; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); result.put("processDefinitionId", 1); Mockito.when(processDefinitionService.updateProcessDefinition(user, projectName, id, name, json, description, locations, connects)).thenReturn(result); Result response = processDefinitionController.updateProcessDefinition(user, projectName, name, id, json,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
locations, connects, description,releaseState); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } @Test public void testReleaseProcessDefinition() throws Exception { String projectName = "test"; int id = 1; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); Mockito.when(processDefinitionService.releaseProcessDefinition(user, projectName, id, ReleaseState.OFFLINE.ordinal())).thenReturn(result); Result response = processDefinitionController.releaseProcessDefinition(user, projectName, id, ReleaseState.OFFLINE.ordinal()); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } @Test public void testQueryProcessDefinitionById() throws Exception { String json = "{\"globalParams\":[],\"tasks\":[{\"type\":\"SHELL\",\"id\":\"tasks-36196\",\"name\":\"ssh_test1" + "\",\"params\":{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"aa=\\\"1234\\\"\\necho ${aa}" + "\"},\"desc\":\"\",\"runFlag\":\"NORMAL\",\"dependence\":{},\"maxRetryTimes\":\"0\",\"retryInterval\"" + ":\"1\",\"timeout\":{\"strategy\":\"\",\"interval\":null,\"enable\":false},\"taskInstancePriority\":" + "\"MEDIUM\",\"workerGroupId\":-1,\"preTasks\":[]}],\"tenantId\":-1,\"timeout\":0}"; String locations = "{\"tasks-36196\":{\"name\":\"ssh_test1\",\"targetarr\":\"\",\"x\":141,\"y\":70}}"; String projectName = "test"; String name = "dag_test"; String description = "desc test"; String connects = "[]"; int id = 1; ProcessDefinition processDefinition = new ProcessDefinition(); processDefinition.setProjectName(projectName); processDefinition.setConnects(connects); processDefinition.setDescription(description);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
processDefinition.setId(id); processDefinition.setLocations(locations); processDefinition.setName(name); processDefinition.setProcessDefinitionJson(json); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, processDefinition); Mockito.when(processDefinitionService.queryProcessDefinitionById(user, projectName, id)).thenReturn(result); Result response = processDefinitionController.queryProcessDefinitionById(user, projectName, id); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } @Test public void testBatchCopyProcessDefinition() throws Exception { String projectName = "test"; int targetProjectId = 2; String id = "1"; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); Mockito.when(processDefinitionService.batchCopyProcessDefinition(user, projectName, id, targetProjectId)).thenReturn(result); Result response = processDefinitionController.copyProcessDefinition(user, projectName, id, targetProjectId); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } @Test public void testBatchMoveProcessDefinition() throws Exception { String projectName = "test"; int targetProjectId = 2; String id = "1"; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); Mockito.when(processDefinitionService.batchMoveProcessDefinition(user, projectName, id, targetProjectId)).thenReturn(result);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
Result response = processDefinitionController.moveProcessDefinition(user, projectName, id, targetProjectId); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } @Test public void testQueryProcessDefinitionList() throws Exception { String projectName = "test"; List<ProcessDefinition> resourceList = getDefinitionList(); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, resourceList); Mockito.when(processDefinitionService.queryProcessDefinitionList(user, projectName)).thenReturn(result); Result response = processDefinitionController.queryProcessDefinitionList(user, projectName); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } public List<ProcessDefinition> getDefinitionList() { List<ProcessDefinition> resourceList = new ArrayList<>(); String json = "{\"globalParams\":[],\"tasks\":[{\"type\":\"SHELL\",\"id\":\"tasks-36196\",\"name\":\"ssh_test1" + "\",\"params\":{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"aa=\\\"1234\\\"\\necho ${aa}" + "\"},\"desc\":\"\",\"runFlag\":\"NORMAL\",\"dependence\":{},\"maxRetryTimes\":\"0\",\"retryInterval" + "\":\"1\",\"timeout\":{\"strategy\":\"\",\"interval\":null,\"enable\":false},\"taskInstancePriority\"" + ":\"MEDIUM\",\"workerGroupId\":-1,\"preTasks\":[]}],\"tenantId\":-1,\"timeout\":0}"; String locations = "{\"tasks-36196\":{\"name\":\"ssh_test1\",\"targetarr\":\"\",\"x\":141,\"y\":70}}"; String projectName = "test"; String name = "dag_test"; String description = "desc test"; String connects = "[]"; int id = 1; ProcessDefinition processDefinition = new ProcessDefinition(); processDefinition.setProjectName(projectName); processDefinition.setConnects(connects);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
processDefinition.setDescription(description); processDefinition.setId(id); processDefinition.setLocations(locations); processDefinition.setName(name); processDefinition.setProcessDefinitionJson(json); String name2 = "dag_test"; int id2 = 2; ProcessDefinition processDefinition2 = new ProcessDefinition(); processDefinition2.setProjectName(projectName); processDefinition2.setConnects(connects); processDefinition2.setDescription(description); processDefinition2.setId(id2); processDefinition2.setLocations(locations); processDefinition2.setName(name2); processDefinition2.setProcessDefinitionJson(json); resourceList.add(processDefinition); resourceList.add(processDefinition2); return resourceList; } @Test public void testDeleteProcessDefinitionById() throws Exception { String projectName = "test"; int id = 1; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); Mockito.when(processDefinitionService.deleteProcessDefinitionById(user, projectName, id)).thenReturn(result); Result response = processDefinitionController.deleteProcessDefinitionById(user, projectName, id); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } @Test
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
public void testGetNodeListByDefinitionId() throws Exception { String projectName = "test"; int id = 1; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); Mockito.when(processDefinitionService.getTaskNodeListByDefinitionId(id)).thenReturn(result); Result response = processDefinitionController.getNodeListByDefinitionId(user, projectName, id); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } @Test public void testGetNodeListByDefinitionIdList() throws Exception { String projectName = "test"; String idList = "1,2,3"; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); Mockito.when(processDefinitionService.getTaskNodeListByDefinitionIdList(idList)).thenReturn(result); Result response = processDefinitionController.getNodeListByDefinitionIdList(user, projectName, idList); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } @Test public void testQueryProcessDefinitionAllByProjectId() throws Exception { int projectId = 1; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); Mockito.when(processDefinitionService.queryProcessDefinitionAllByProjectId(projectId)).thenReturn(result); Result response = processDefinitionController.queryProcessDefinitionAllByProjectId(user, projectId); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } @Test public void testViewTree() throws Exception {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
String projectName = "test"; int processId = 1; int limit = 2; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); Mockito.when(processDefinitionService.viewTree(processId, limit)).thenReturn(result); Result response = processDefinitionController.viewTree(user, projectName, processId, limit); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } @Test public void testQueryProcessDefinitionListPaging() throws Exception { String projectName = "test"; int pageNo = 1; int pageSize = 10; String searchVal = ""; int userId = 1; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, new PageInfo<Resource>(1, 10)); Mockito.when(processDefinitionService.queryProcessDefinitionListPaging(user, projectName, searchVal, pageNo, pageSize, userId)).thenReturn(result); Result response = processDefinitionController.queryProcessDefinitionListPaging(user, projectName, pageNo, searchVal, userId, pageSize); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } @Test public void testBatchExportProcessDefinitionByIds() throws Exception { String processDefinitionIds = "1,2"; String projectName = "test"; HttpServletResponse response = new MockHttpServletResponse(); Mockito.doNothing().when(this.processDefinitionService).batchExportProcessDefinitionByIds(user, projectName, processDefinitionIds, response); processDefinitionController.batchExportProcessDefinitionByIds(user, projectName, processDefinitionIds, response);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
} @Test public void testQueryProcessDefinitionVersions() { String projectName = "test"; Map<String, Object> resultMap = new HashMap<>(); putMsg(resultMap, Status.SUCCESS); resultMap.put(Constants.DATA_LIST, new PageInfo<ProcessDefinitionVersion>(1, 10)); Mockito.when(processDefinitionVersionService.queryProcessDefinitionVersions( user , projectName , 1 , 10 , 1)) .thenReturn(resultMap); Result result = processDefinitionController.queryProcessDefinitionVersions( user , projectName , 1 , 10 , 1); Assert.assertEquals(Status.SUCCESS.getCode(), (int) result.getCode()); } @Test public void testSwitchProcessDefinitionVersion() { String projectName = "test"; Map<String, Object> resultMap = new HashMap<>(); putMsg(resultMap, Status.SUCCESS); Mockito.when(processDefinitionService.switchProcessDefinitionVersion( user , projectName
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
, 1 , 10)) .thenReturn(resultMap); Result result = processDefinitionController.switchProcessDefinitionVersion( user , projectName , 1 , 10); Assert.assertEquals(Status.SUCCESS.getCode(), (int) result.getCode()); } @Test public void testDeleteProcessDefinitionVersion() { String projectName = "test"; Map<String, Object> resultMap = new HashMap<>(); putMsg(resultMap, Status.SUCCESS); Mockito.when(processDefinitionVersionService.deleteByProcessDefinitionIdAndVersion( user , projectName , 1 , 10)) .thenReturn(resultMap); Result result = processDefinitionController.deleteProcessDefinitionVersion( user , projectName , 1 , 10); Assert.assertEquals(Status.SUCCESS.getCode(), (int) result.getCode()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.service; import static org.assertj.core.api.Assertions.assertThat; import static org.powermock.api.mockito.PowerMockito.mock;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
import static org.powermock.api.mockito.PowerMockito.when; import org.apache.dolphinscheduler.api.dto.ProcessMeta; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl; import org.apache.dolphinscheduler.api.service.impl.ProjectServiceImpl; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.FailureStrategy; import org.apache.dolphinscheduler.common.enums.Priority; import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.enums.WarningType; import org.apache.dolphinscheduler.common.model.TaskNode; import org.apache.dolphinscheduler.common.process.ResourceInfo; import org.apache.dolphinscheduler.common.task.shell.ShellParameters; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.FileUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.dao.entity.DataSource; import org.apache.dolphinscheduler.dao.entity.ProcessData; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.Schedule; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.http.entity.ContentType; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.lang.reflect.Method; import java.text.MessageFormat; 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 javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; 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 org.springframework.mock.web.MockMultipartFile; import org.springframework.util.ReflectionUtils; import org.springframework.web.multipart.MultipartFile; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @RunWith(MockitoJUnitRunner.class)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
public class ProcessDefinitionServiceTest { private static final String SHELL_JSON = "{\n" + " \"globalParams\": [\n" + " \n" + " ],\n" + " \"tasks\": [\n" + " {\n" + " \"type\": \"SHELL\",\n" + " \"id\": \"tasks-9527\",\n" + " \"name\": \"shell-1\",\n" + " \"params\": {\n" + " \"resourceList\": [\n" + " \n" + " ],\n" + " \"localParams\": [\n"
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
+ " \n" + " ],\n" + " \"rawScript\": \"#!/bin/bash\\necho \\\"shell-1\\\"\"\n" + " },\n" + " \"description\": \"\",\n" + " \"runFlag\": \"NORMAL\",\n" + " \"dependence\": {\n" + " \n" + " },\n" + " \"maxRetryTimes\": \"0\",\n" + " \"retryInterval\": \"1\",\n" + " \"timeout\": {\n" + " \"strategy\": \"\",\n" + " \"interval\": 1,\n" + " \"enable\": false\n" + " },\n" + " \"taskInstancePriority\": \"MEDIUM\",\n" + " \"workerGroupId\": -1,\n" + " \"preTasks\": [\n" + " \n" + " ]\n" + " }\n" + " ],\n" + " \"tenantId\": 1,\n" + " \"timeout\": 0\n" + "}"; private static final String CYCLE_SHELL_JSON = "{\n" + " \"globalParams\": [\n" + " \n" + " ],\n"
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
+ " \"tasks\": [\n" + " {\n" + " \"type\": \"SHELL\",\n" + " \"id\": \"tasks-9527\",\n" + " \"name\": \"shell-1\",\n" + " \"params\": {\n" + " \"resourceList\": [\n" + " \n" + " ],\n" + " \"localParams\": [\n" + " \n" + " ],\n" + " \"rawScript\": \"#!/bin/bash\\necho \\\"shell-1\\\"\"\n" + " },\n" + " \"description\": \"\",\n" + " \"runFlag\": \"NORMAL\",\n" + " \"dependence\": {\n" + " \n" + " },\n" + " \"maxRetryTimes\": \"0\",\n" + " \"retryInterval\": \"1\",\n" + " \"timeout\": {\n" + " \"strategy\": \"\",\n" + " \"interval\": 1,\n" + " \"enable\": false\n" + " },\n" + " \"taskInstancePriority\": \"MEDIUM\",\n" + " \"workerGroupId\": -1,\n" + " \"preTasks\": [\n" + " \"tasks-9529\"\n"
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
+ " ]\n" + " },\n" + " {\n" + " \"type\": \"SHELL\",\n" + " \"id\": \"tasks-9528\",\n" + " \"name\": \"shell-1\",\n" + " \"params\": {\n" + " \"resourceList\": [\n" + " \n" + " ],\n" + " \"localParams\": [\n" + " \n" + " ],\n" + " \"rawScript\": \"#!/bin/bash\\necho \\\"shell-1\\\"\"\n" + " },\n" + " \"description\": \"\",\n" + " \"runFlag\": \"NORMAL\",\n" + " \"dependence\": {\n" + " \n" + " },\n" + " \"maxRetryTimes\": \"0\",\n" + " \"retryInterval\": \"1\",\n" + " \"timeout\": {\n" + " \"strategy\": \"\",\n" + " \"interval\": 1,\n" + " \"enable\": false\n" + " },\n" + " \"taskInstancePriority\": \"MEDIUM\",\n" + " \"workerGroupId\": -1,\n" + " \"preTasks\": [\n"
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
+ " \"tasks-9527\"\n" + " ]\n" + " },\n" + " {\n" + " \"type\": \"SHELL\",\n" + " \"id\": \"tasks-9529\",\n" + " \"name\": \"shell-1\",\n" + " \"params\": {\n" + " \"resourceList\": [\n" + " \n" + " ],\n" + " \"localParams\": [\n" + " \n" + " ],\n" + " \"rawScript\": \"#!/bin/bash\\necho \\\"shell-1\\\"\"\n" + " },\n" + " \"description\": \"\",\n" + " \"runFlag\": \"NORMAL\",\n" + " \"dependence\": {\n" + " \n" + " },\n" + " \"maxRetryTimes\": \"0\",\n" + " \"retryInterval\": \"1\",\n" + " \"timeout\": {\n" + " \"strategy\": \"\",\n" + " \"interval\": 1,\n" + " \"enable\": false\n" + " },\n" + " \"taskInstancePriority\": \"MEDIUM\",\n" + " \"workerGroupId\": -1,\n"
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
+ " \"preTasks\": [\n" + " \"tasks-9528\"\n" + " ]\n" + " }\n" + " ],\n" + " \"tenantId\": 1,\n" + " \"timeout\": 0\n" + "}"; @InjectMocks private ProcessDefinitionServiceImpl processDefinitionService; @Mock private ProcessDefinitionMapper processDefineMapper; @Mock private ProjectMapper projectMapper; @Mock private ProjectServiceImpl projectService; @Mock private ScheduleMapper scheduleMapper; @Mock private ProcessService processService; @Mock private ProcessInstanceService processInstanceService; @Mock private TaskInstanceMapper taskInstanceMapper; @Mock private ProcessDefinitionVersionService processDefinitionVersionService; @Test public void testQueryProcessDefinitionList() { String projectName = "project_test1"; Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Project project = getProject(projectName); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUNT, projectName); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result); Map<String, Object> map = processDefinitionService.queryProcessDefinitionList(loginUser, "project_test1"); Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); putMsg(result, Status.SUCCESS, projectName); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result); List<ProcessDefinition> resourceList = new ArrayList<>(); resourceList.add(getProcessDefinition()); Mockito.when(processDefineMapper.queryAllDefinitionList(project.getId())).thenReturn(resourceList); Map<String, Object> checkSuccessRes = processDefinitionService.queryProcessDefinitionList(loginUser, "project_test1"); Assert.assertEquals(Status.SUCCESS, checkSuccessRes.get(Constants.STATUS)); } @Test @SuppressWarnings("unchecked") public void testQueryProcessDefinitionListPaging() { String projectName = "project_test1"; Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName)); Project project = getProject(projectName); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUNT, projectName);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result); Map<String, Object> map = processDefinitionService.queryProcessDefinitionListPaging(loginUser, "project_test1", "", 1, 5, 0); Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); putMsg(result, Status.SUCCESS, projectName); loginUser.setId(1); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result); Page<ProcessDefinition> page = new Page<>(1, 10); page.setTotal(30); Mockito.when(processDefineMapper.queryDefineListPaging( Mockito.any(IPage.class) , Mockito.eq("") , Mockito.eq(loginUser.getId()) , Mockito.eq(project.getId()) , Mockito.anyBoolean())).thenReturn(page); Map<String, Object> map1 = processDefinitionService.queryProcessDefinitionListPaging( loginUser, projectName, "", 1, 10, loginUser.getId()); Assert.assertEquals(Status.SUCCESS, map1.get(Constants.STATUS)); } @Test public void testQueryProcessDefinitionById() { String projectName = "project_test1"; Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName)); Project project = getProject(projectName); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUNT, projectName);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result); Map<String, Object> map = processDefinitionService.queryProcessDefinitionById(loginUser, "project_test1", 1); Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); putMsg(result, Status.SUCCESS, projectName); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result); Mockito.when(processDefineMapper.selectById(1)).thenReturn(null); Map<String, Object> instanceNotexitRes = processDefinitionService.queryProcessDefinitionById(loginUser, "project_test1", 1); Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, instanceNotexitRes.get(Constants.STATUS)); Mockito.when(processDefineMapper.selectById(46)).thenReturn(getProcessDefinition()); Map<String, Object> successRes = processDefinitionService.queryProcessDefinitionById(loginUser, "project_test1", 46); Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); } @Test public void testQueryProcessDefinitionByName() { String projectName = "project_test1"; Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName)); Project project = getProject(projectName); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUNT, projectName); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result); Map<String, Object> map = processDefinitionService.queryProcessDefinitionByName(loginUser,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
"project_test1", "test_def"); Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); putMsg(result, Status.SUCCESS, projectName); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result); Mockito.when(processDefineMapper.queryByDefineName(project.getId(),"test_def")).thenReturn(null); Map<String, Object> instanceNotexitRes = processDefinitionService.queryProcessDefinitionByName(loginUser, "project_test1", "test_def"); Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, instanceNotexitRes.get(Constants.STATUS)); Mockito.when(processDefineMapper.queryByDefineName(project.getId(),"test")).thenReturn(getProcessDefinition()); Map<String, Object> successRes = processDefinitionService.queryProcessDefinitionByName(loginUser, "project_test1", "test"); Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); } @Test public void testBatchCopyProcessDefinition() { String projectName = "project_test1"; Project project = getProject(projectName); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> map = processDefinitionService.batchCopyProcessDefinition(loginUser, projectName, StringUtils.EMPTY, 0); Assert.assertEquals(Status.PROCESS_DEFINITION_IDS_IS_EMPTY, map.get(Constants.STATUS)); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUNT, projectName); Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName)); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Map<String, Object> map1 = processDefinitionService.batchCopyProcessDefinition( loginUser, projectName, String.valueOf(project.getId()), 0); Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map1.get(Constants.STATUS)); putMsg(result, Status.SUCCESS, projectName); Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName)); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result); Mockito.when(projectMapper.queryDetailById(0)).thenReturn(null); Map<String, Object> map2 = processDefinitionService.batchCopyProcessDefinition( loginUser, projectName, String.valueOf(project.getId()), 0); Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map2.get(Constants.STATUS)); Project project1 = getProject(projectName); Mockito.when(projectMapper.queryByName(projectName)).thenReturn(project1); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result); putMsg(result, Status.SUCCESS, projectName); String projectName2 = "project_test2"; Project project2 = getProject(projectName2); Mockito.when(projectMapper.queryByName(projectName2)).thenReturn(project2); Mockito.when(projectService.checkProjectAndAuth(loginUser, project2, projectName2)).thenReturn(result); Mockito.when(projectMapper.queryDetailById(1)).thenReturn(project2); ProcessDefinition definition = getProcessDefinition(); definition.setLocations("{\"tasks-36196\":{\"name\":\"ssh_test1\",\"targetarr\":\"\",\"x\":141,\"y\":70}}"); definition.setProcessDefinitionJson("{\"globalParams\":[],\"tasks\":[{\"type\":\"SHELL\",\"id\":\"tasks-36196\"," + "\"name\":\"ssh_test1\",\"params\":{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"aa=\\\"1234" + "\\\"\\necho ${aa}\"},\"desc\":\"\",\"runFlag\":\"NORMAL\",\"dependence\":{},\"maxRetryTimes\":\"0\"," + "\"retryInterval\":\"1\",\"timeout\":{\"strategy\":\"\",\"interval\":null,\"enable\":false}," + "\"taskInstancePriority\":\"MEDIUM\",\"workerGroupId\":-1,\"preTasks\":[]}],\"tenantId\":-1,\"timeout\":0}"); definition.setConnects("[]");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Mockito.when(processDefineMapper.selectById(46)).thenReturn(definition); Map<String, Object> map3 = processDefinitionService.batchCopyProcessDefinition( loginUser, projectName, "46", 1); Assert.assertEquals(Status.SUCCESS, map3.get(Constants.STATUS)); } @Test public void testBatchMoveProcessDefinition() { String projectName = "project_test1"; Project project1 = getProject(projectName); Mockito.when(projectMapper.queryByName(projectName)).thenReturn(project1); String projectName2 = "project_test2"; Project project2 = getProject(projectName2); Mockito.when(projectMapper.queryByName(projectName2)).thenReturn(project2); int targetProjectId = 2; Mockito.when(projectMapper.queryDetailById(targetProjectId)).thenReturn(getProjectById(targetProjectId)); Project project = getProject(projectName); Project targetProject = getProjectById(targetProjectId); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS, projectName); Map<String, Object> result2 = new HashMap<>(); putMsg(result2, Status.SUCCESS, targetProject.getName()); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result); Mockito.when(projectService.checkProjectAndAuth(loginUser, project2, projectName2)).thenReturn(result); ProcessDefinition definition = getProcessDefinition(); definition.setLocations("{\"tasks-36196\":{\"name\":\"ssh_test1\",\"targetarr\":\"\",\"x\":141,\"y\":70}}"); definition.setProcessDefinitionJson("{\"globalParams\":[],\"tasks\":[{\"type\":\"SHELL\",\"id\":\"tasks-36196\"" + ",\"name\":\"ssh_test1\",\"params\":{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"aa=\\\"1234"
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
+ "\\\"\\necho ${aa}\"},\"desc\":\"\",\"runFlag\":\"NORMAL\",\"dependence\":{},\"maxRetryTimes\":\"0\"," + "\"retryInterval\":\"1\",\"timeout\":{\"strategy\":\"\",\"interval\":null,\"enable\":false}," + "\"taskInstancePriority\":\"MEDIUM\",\"workerGroupId\":-1,\"preTasks\":[]}],\"tenantId\":-1,\"timeout\":0}"); definition.setConnects("[]"); Mockito.when(processDefineMapper.updateById(definition)).thenReturn(46); Mockito.when(processDefineMapper.selectById(46)).thenReturn(definition); putMsg(result, Status.SUCCESS); Map<String, Object> successRes = processDefinitionService.batchMoveProcessDefinition( loginUser, "project_test1", "46", 2); Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); } @Test public void deleteProcessDefinitionByIdTest() { String projectName = "project_test1"; Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName)); Project project = getProject(projectName); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUNT, projectName); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result); Map<String, Object> map = processDefinitionService.deleteProcessDefinitionById(loginUser, "project_test1", 6); Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); putMsg(result, Status.SUCCESS, projectName); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result); Mockito.when(processDefineMapper.selectById(1)).thenReturn(null);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Map<String, Object> instanceNotexitRes = processDefinitionService.deleteProcessDefinitionById(loginUser, "project_test1", 1); Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, instanceNotexitRes.get(Constants.STATUS)); ProcessDefinition processDefinition = getProcessDefinition(); loginUser.setUserType(UserType.GENERAL_USER); Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition); Map<String, Object> userNoAuthRes = processDefinitionService.deleteProcessDefinitionById(loginUser, "project_test1", 46); Assert.assertEquals(Status.USER_NO_OPERATION_PERM, userNoAuthRes.get(Constants.STATUS)); loginUser.setUserType(UserType.ADMIN_USER); processDefinition.setReleaseState(ReleaseState.ONLINE); Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition); Map<String, Object> dfOnlineRes = processDefinitionService.deleteProcessDefinitionById(loginUser, "project_test1", 46); Assert.assertEquals(Status.PROCESS_DEFINE_STATE_ONLINE, dfOnlineRes.get(Constants.STATUS)); processDefinition.setReleaseState(ReleaseState.OFFLINE); Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition); List<Schedule> schedules = new ArrayList<>(); schedules.add(getSchedule()); schedules.add(getSchedule()); Mockito.when(scheduleMapper.queryByProcessDefinitionId(46)).thenReturn(schedules); Map<String, Object> schedulerGreaterThanOneRes = processDefinitionService.deleteProcessDefinitionById(loginUser, "project_test1", 46); Assert.assertEquals(Status.DELETE_PROCESS_DEFINE_BY_ID_ERROR, schedulerGreaterThanOneRes.get(Constants.STATUS)); schedules.clear(); Schedule schedule = getSchedule();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
schedule.setReleaseState(ReleaseState.ONLINE); schedules.add(schedule); Mockito.when(scheduleMapper.queryByProcessDefinitionId(46)).thenReturn(schedules); Map<String, Object> schedulerOnlineRes = processDefinitionService.deleteProcessDefinitionById(loginUser, "project_test1", 46); Assert.assertEquals(Status.SCHEDULE_CRON_STATE_ONLINE, schedulerOnlineRes.get(Constants.STATUS)); schedules.clear(); schedule.setReleaseState(ReleaseState.OFFLINE); schedules.add(schedule); Mockito.when(scheduleMapper.queryByProcessDefinitionId(46)).thenReturn(schedules); Mockito.when(processDefineMapper.deleteById(46)).thenReturn(0); Map<String, Object> deleteFail = processDefinitionService.deleteProcessDefinitionById(loginUser, "project_test1", 46); Assert.assertEquals(Status.DELETE_PROCESS_DEFINE_BY_ID_ERROR, deleteFail.get(Constants.STATUS)); Mockito.when(processDefineMapper.deleteById(46)).thenReturn(1); Map<String, Object> deleteSuccess = processDefinitionService.deleteProcessDefinitionById(loginUser, "project_test1", 46); Assert.assertEquals(Status.SUCCESS, deleteSuccess.get(Constants.STATUS)); } @Test public void testReleaseProcessDefinition() { String projectName = "project_test1"; Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName)); Project project = getProject(projectName); User loginUser = new User(); loginUser.setId(1); loginUser.setUserType(UserType.GENERAL_USER);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUNT, projectName); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result); Map<String, Object> map = processDefinitionService.releaseProcessDefinition(loginUser, "project_test1", 6, ReleaseState.OFFLINE.getCode()); Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); putMsg(result, Status.SUCCESS, projectName); Mockito.when(processDefineMapper.selectById(46)).thenReturn(getProcessDefinition()); Map<String, Object> onlineRes = processDefinitionService.releaseProcessDefinition( loginUser, "project_test1", 46, ReleaseState.ONLINE.getCode()); Assert.assertEquals(Status.SUCCESS, onlineRes.get(Constants.STATUS)); ProcessDefinition processDefinition1 = getProcessDefinition(); processDefinition1.setResourceIds("1,2"); Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition1); Mockito.when(processService.getUserById(1)).thenReturn(loginUser); Map<String, Object> onlineWithResourceRes = processDefinitionService.releaseProcessDefinition( loginUser, "project_test1", 46, ReleaseState.ONLINE.getCode()); Assert.assertEquals(Status.SUCCESS, onlineWithResourceRes.get(Constants.STATUS)); Map<String, Object> failRes = processDefinitionService.releaseProcessDefinition( loginUser, "project_test1", 46, 2); Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, failRes.get(Constants.STATUS));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
} @Test public void testVerifyProcessDefinitionName() { String projectName = "project_test1"; Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName)); Project project = getProject(projectName); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUNT, projectName); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result); Map<String, Object> map = processDefinitionService.verifyProcessDefinitionName(loginUser, "project_test1", "test_pdf"); Assert.assertEquals(Status.PROJECT_NOT_FOUNT, map.get(Constants.STATUS)); putMsg(result, Status.SUCCESS, projectName); Mockito.when(processDefineMapper.verifyByDefineName(project.getId(), "test_pdf")).thenReturn(null); Map<String, Object> processNotExistRes = processDefinitionService.verifyProcessDefinitionName(loginUser, "project_test1", "test_pdf"); Assert.assertEquals(Status.SUCCESS, processNotExistRes.get(Constants.STATUS)); Mockito.when(processDefineMapper.verifyByDefineName(project.getId(), "test_pdf")).thenReturn(getProcessDefinition()); Map<String, Object> processExistRes = processDefinitionService.verifyProcessDefinitionName(loginUser, "project_test1", "test_pdf");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Assert.assertEquals(Status.VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR, processExistRes.get(Constants.STATUS)); } @Test public void testCheckProcessNodeList() { Map<String, Object> dataNotValidRes = processDefinitionService.checkProcessNodeList(null, ""); Assert.assertEquals(Status.DATA_IS_NOT_VALID, dataNotValidRes.get(Constants.STATUS)); String processDefinitionJson = SHELL_JSON; ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class); Assert.assertNotNull(processData); Map<String, Object> taskEmptyRes = processDefinitionService.checkProcessNodeList(processData, processDefinitionJson); Assert.assertEquals(Status.SUCCESS, taskEmptyRes.get(Constants.STATUS)); processData.setTasks(null); Map<String, Object> taskNotEmptyRes = processDefinitionService.checkProcessNodeList(processData, processDefinitionJson); Assert.assertEquals(Status.DATA_IS_NULL, taskNotEmptyRes.get(Constants.STATUS)); String processDefinitionJsonCycle = CYCLE_SHELL_JSON; ProcessData processDataCycle = JSONUtils.parseObject(processDefinitionJsonCycle, ProcessData.class); Map<String, Object> taskCycleRes = processDefinitionService.checkProcessNodeList(processDataCycle, processDefinitionJsonCycle); Assert.assertEquals(Status.PROCESS_NODE_HAS_CYCLE, taskCycleRes.get(Constants.STATUS)); String abnormalJson = processDefinitionJson.replaceAll("SHELL", ""); processData = JSONUtils.parseObject(abnormalJson, ProcessData.class); Map<String, Object> abnormalTaskRes = processDefinitionService.checkProcessNodeList(processData, abnormalJson); Assert.assertEquals(Status.PROCESS_NODE_S_PARAMETER_INVALID, abnormalTaskRes.get(Constants.STATUS)); } @Test public void testGetTaskNodeListByDefinitionId() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Mockito.when(processDefineMapper.selectById(46)).thenReturn(null); Map<String, Object> processDefinitionNullRes = processDefinitionService.getTaskNodeListByDefinitionId(46); Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionNullRes.get(Constants.STATUS)); ProcessDefinition processDefinition = getProcessDefinition(); Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition); Map<String, Object> successRes = processDefinitionService.getTaskNodeListByDefinitionId(46); Assert.assertEquals(Status.DATA_IS_NOT_VALID, successRes.get(Constants.STATUS)); processDefinition.setProcessDefinitionJson(SHELL_JSON); Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition); Map<String, Object> dataNotValidRes = processDefinitionService.getTaskNodeListByDefinitionId(46); Assert.assertEquals(Status.SUCCESS, dataNotValidRes.get(Constants.STATUS)); } @Test public void testGetTaskNodeListByDefinitionIdList() { String defineIdList = "46"; Integer[] idArray = {46}; Mockito.when(processDefineMapper.queryDefinitionListByIdList(idArray)).thenReturn(null); Map<String, Object> processNotExistRes = processDefinitionService.getTaskNodeListByDefinitionIdList(defineIdList); Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, processNotExistRes.get(Constants.STATUS)); ProcessDefinition processDefinition = getProcessDefinition(); processDefinition.setProcessDefinitionJson(SHELL_JSON); List<ProcessDefinition> processDefinitionList = new ArrayList<>(); processDefinitionList.add(processDefinition); Mockito.when(processDefineMapper.queryDefinitionListByIdList(idArray)).thenReturn(processDefinitionList); Map<String, Object> successRes = processDefinitionService.getTaskNodeListByDefinitionIdList(defineIdList); Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
} @Test public void testQueryProcessDefinitionAllByProjectId() { int projectId = 1; ProcessDefinition processDefinition = getProcessDefinition(); processDefinition.setProcessDefinitionJson(SHELL_JSON); List<ProcessDefinition> processDefinitionList = new ArrayList<>(); processDefinitionList.add(processDefinition); Mockito.when(processDefineMapper.queryAllDefinitionList(projectId)).thenReturn(processDefinitionList); Map<String, Object> successRes = processDefinitionService.queryProcessDefinitionAllByProjectId(projectId); Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); } @Test public void testViewTree() throws Exception { ProcessDefinition processDefinition = getProcessDefinition(); processDefinition.setProcessDefinitionJson(SHELL_JSON); Mockito.when(processDefineMapper.selectById(46)).thenReturn(null); Map<String, Object> processDefinitionNullRes = processDefinitionService.viewTree(46, 10); Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionNullRes.get(Constants.STATUS)); List<ProcessInstance> processInstanceList = new ArrayList<>(); ProcessInstance processInstance = new ProcessInstance(); processInstance.setId(1); processInstance.setName("test_instance"); processInstance.setState(ExecutionStatus.RUNNING_EXECUTION); processInstance.setHost("192.168.xx.xx"); processInstance.setStartTime(new Date()); processInstance.setEndTime(new Date()); processInstanceList.add(processInstance); TaskInstance taskInstance = new TaskInstance();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
taskInstance.setStartTime(new Date()); taskInstance.setEndTime(new Date()); taskInstance.setTaskType("SHELL"); taskInstance.setId(1); taskInstance.setName("test_task_instance"); taskInstance.setState(ExecutionStatus.RUNNING_EXECUTION); taskInstance.setHost("192.168.xx.xx"); Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition); Mockito.when(processInstanceService.queryByProcessDefineId(46, 10)).thenReturn(processInstanceList); Mockito.when(taskInstanceMapper.queryByInstanceIdAndName(processInstance.getId(), "shell-1")).thenReturn(null); Map<String, Object> taskNullRes = processDefinitionService.viewTree(46, 10); Assert.assertEquals(Status.SUCCESS, taskNullRes.get(Constants.STATUS)); Mockito.when(taskInstanceMapper.queryByInstanceIdAndName(processInstance.getId(), "shell-1")).thenReturn(taskInstance); Map<String, Object> taskNotNuLLRes = processDefinitionService.viewTree(46, 10); Assert.assertEquals(Status.SUCCESS, taskNotNuLLRes.get(Constants.STATUS)); } @Test public void testSubProcessViewTree() throws Exception { ProcessDefinition processDefinition = getProcessDefinition(); processDefinition.setProcessDefinitionJson(SHELL_JSON); List<ProcessInstance> processInstanceList = new ArrayList<>(); ProcessInstance processInstance = new ProcessInstance(); processInstance.setId(1); processInstance.setName("test_instance"); processInstance.setState(ExecutionStatus.RUNNING_EXECUTION); processInstance.setHost("192.168.xx.xx"); processInstance.setStartTime(new Date()); processInstance.setEndTime(new Date());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
processInstanceList.add(processInstance); TaskInstance taskInstance = new TaskInstance(); taskInstance.setStartTime(new Date()); taskInstance.setEndTime(new Date()); taskInstance.setTaskType("SUB_PROCESS"); taskInstance.setId(1); taskInstance.setName("test_task_instance"); taskInstance.setState(ExecutionStatus.RUNNING_EXECUTION); taskInstance.setHost("192.168.xx.xx"); taskInstance.setTaskJson("{\n" + " \"conditionResult\": {\n" + " \"failedNode\": [\n" + " \"\"\n" + " ],\n" + " \"successNode\": [\n" + " \"\"\n" + " ]\n" + " },\n" + " \"delayTime\": \"0\",\n" + " \"dependence\": {},\n" + " \"description\": \"\",\n" + " \"id\": \"1\",\n" + " \"maxRetryTimes\": \"0\",\n" + " \"name\": \"test_task_instance\",\n" + " \"params\": {\n" + " \"processDefinitionId\": \"222\",\n" + " \"resourceList\": []\n" + " },\n" + " \"preTasks\": [],\n" + " \"retryInterval\": \"1\",\n"
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
+ " \"runFlag\": \"NORMAL\",\n" + " \"taskInstancePriority\": \"MEDIUM\",\n" + " \"timeout\": {\n" + " \"enable\": false,\n" + " \"interval\": null,\n" + " \"strategy\": \"\"\n" + " },\n" + " \"type\": \"SUB_PROCESS\",\n" + " \"workerGroup\": \"default\"\n" + "}"); Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition); Mockito.when(processInstanceService.queryByProcessDefineId(46, 10)).thenReturn(processInstanceList); Mockito.when(taskInstanceMapper.queryByInstanceIdAndName(processInstance.getId(), "shell-1")).thenReturn(taskInstance); Map<String, Object> taskNotNuLLRes = processDefinitionService.viewTree(46, 10); Assert.assertEquals(Status.SUCCESS, taskNotNuLLRes.get(Constants.STATUS)); } @Test public void testImportProcessDefinitionById() throws IOException { String processJson = "[\n" + " {\n" + " \"projectName\": \"testProject\",\n" + " \"processDefinitionName\": \"shell-4\",\n" + " \"processDefinitionJson\": \"{\\\"tenantId\\\":1" + ",\\\"globalParams\\\":[],\\\"tasks\\\":[{\\\"workerGroupId\\\":\\\"3\\\",\\\"description\\\"" + ":\\\"\\\",\\\"runFlag\\\":\\\"NORMAL\\\",\\\"type\\\":\\\"SHELL\\\",\\\"params\\\":{\\\"rawScript\\\"" + ":\\\"#!/bin/bash\\\\necho \\\\\\\"shell-4\\\\\\\"\\\",\\\"localParams\\\":[],\\\"resourceList\\\":[]}" + ",\\\"timeout\\\":{\\\"enable\\\":false,\\\"strategy\\\":\\\"\\\"},\\\"maxRetryTimes\\\":\\\"0\\\"" + ",\\\"taskInstancePriority\\\":\\\"MEDIUM\\\",\\\"name\\\":\\\"shell-4\\\",\\\"dependence\\\":{}" + ",\\\"retryInterval\\\":\\\"1\\\",\\\"preTasks\\\":[],\\\"id\\\":\\\"tasks-84090\\\"}"
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
+ ",{\\\"taskInstancePriority\\\":\\\"MEDIUM\\\",\\\"name\\\":\\\"shell-5\\\",\\\"workerGroupId\\\"" + ":\\\"3\\\",\\\"description\\\":\\\"\\\",\\\"dependence\\\":{},\\\"preTasks\\\":[\\\"shell-4\\\"]" + ",\\\"id\\\":\\\"tasks-87364\\\",\\\"runFlag\\\":\\\"NORMAL\\\",\\\"type\\\":\\\"SUB_PROCESS\\\"" + ",\\\"params\\\":{\\\"processDefinitionId\\\":46},\\\"timeout\\\":{\\\"enable\\\":false" + ",\\\"strategy\\\":\\\"\\\"}}],\\\"timeout\\\":0}\",\n" + " \"processDefinitionDescription\": \"\",\n" + " \"processDefinitionLocations\": \"{\\\"tasks-84090\\\":{\\\"name\\\":\\\"shell-4\\\"" + ",\\\"targetarr\\\":\\\"\\\",\\\"x\\\":128,\\\"y\\\":114},\\\"tasks-87364\\\":{\\\"name\\\"" + ":\\\"shell-5\\\",\\\"targetarr\\\":\\\"tasks-84090\\\",\\\"x\\\":266,\\\"y\\\":115}}\",\n" + " \"processDefinitionConnects\": \"[{\\\"endPointSourceId\\\":\\\"tasks-84090\\\"" + ",\\\"endPointTargetId\\\":\\\"tasks-87364\\\"}]\"\n" + " }\n" + "]"; String subProcessJson = "{\n" + " \"globalParams\": [\n" + " \n" + " ],\n" + " \"tasks\": [\n" + " {\n" + " \"type\": \"SHELL\",\n" + " \"id\": \"tasks-52423\",\n" + " \"name\": \"shell-5\",\n" + " \"params\": {\n" + " \"resourceList\": [\n" + " \n" + " ],\n" + " \"localParams\": [\n" + " \n" + " ],\n" + " \"rawScript\": \"echo \\\"shell-5\\\"\"\n"
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
+ " },\n" + " \"description\": \"\",\n" + " \"runFlag\": \"NORMAL\",\n" + " \"dependence\": {\n" + " \n" + " },\n" + " \"maxRetryTimes\": \"0\",\n" + " \"retryInterval\": \"1\",\n" + " \"timeout\": {\n" + " \"strategy\": \"\",\n" + " \"interval\": null,\n" + " \"enable\": false\n" + " },\n" + " \"taskInstancePriority\": \"MEDIUM\",\n" + " \"workerGroupId\": \"3\",\n" + " \"preTasks\": [\n" + " \n" + " ]\n" + " }\n" + " ],\n" + " \"tenantId\": 1,\n" + " \"timeout\": 0\n" + "}"; FileUtils.writeStringToFile(new File("/tmp/task.json"), processJson); File file = new File("/tmp/task.json"); FileInputStream fileInputStream = new FileInputStream("/tmp/task.json"); MultipartFile multipartFile = new MockMultipartFile(file.getName(), file.getName(), ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream); User loginUser = new User(); loginUser.setId(1);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
loginUser.setUserType(UserType.ADMIN_USER); String currentProjectName = "testProject"; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS, currentProjectName); ProcessDefinition shellDefinition2 = new ProcessDefinition(); shellDefinition2.setId(46); shellDefinition2.setName("shell-5"); shellDefinition2.setProjectId(2); shellDefinition2.setProcessDefinitionJson(subProcessJson); Mockito.when(projectMapper.queryByName(currentProjectName)).thenReturn(getProject(currentProjectName)); Mockito.when(projectService.checkProjectAndAuth(loginUser, getProject(currentProjectName), currentProjectName)).thenReturn(result); Mockito.when(processDefineMapper.queryByDefineId(46)).thenReturn(shellDefinition2); Map<String, Object> importProcessResult = processDefinitionService.importProcessDefinition(loginUser, multipartFile, currentProjectName); Assert.assertEquals(Status.SUCCESS, importProcessResult.get(Constants.STATUS)); boolean delete = file.delete(); Assert.assertTrue(delete); } @Test public void testUpdateProcessDefinition() { User loginUser = new User(); loginUser.setId(1); loginUser.setUserType(UserType.ADMIN_USER); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); String projectName = "project_test1"; Project project = getProject(projectName); ProcessDefinition processDefinition = getProcessDefinition(); Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName)); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result); Mockito.when(processService.findProcessDefineById(1)).thenReturn(processDefinition);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Mockito.when(processDefinitionVersionService.addProcessDefinitionVersion(processDefinition)).thenReturn(1L); String sqlDependentJson = "{\n" + " \"globalParams\": [\n" + " \n" + " ],\n" + " \"tasks\": [\n" + " {\n" + " \"type\": \"SQL\",\n" + " \"id\": \"tasks-27297\",\n" + " \"name\": \"sql\",\n" + " \"params\": {\n" + " \"type\": \"MYSQL\",\n" + " \"datasource\": 1,\n" + " \"sql\": \"select * from test\",\n" + " \"udfs\": \"\",\n" + " \"sqlType\": \"1\",\n" + " \"title\": \"\",\n" + " \"receivers\": \"\",\n" + " \"receiversCc\": \"\",\n" + " \"showType\": \"TABLE\",\n" + " \"localParams\": [\n" + " \n" + " ],\n" + " \"connParams\": \"\",\n" + " \"preStatements\": [\n" + " \n" + " ],\n" + " \"postStatements\": [\n" + " \n" + " ]\n"
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
+ " },\n" + " \"description\": \"\",\n" + " \"runFlag\": \"NORMAL\",\n" + " \"dependence\": {\n" + " \n" + " },\n" + " \"maxRetryTimes\": \"0\",\n" + " \"retryInterval\": \"1\",\n" + " \"timeout\": {\n" + " \"strategy\": \"\",\n" + " \"enable\": false\n" + " },\n" + " \"taskInstancePriority\": \"MEDIUM\",\n" + " \"workerGroupId\": -1,\n" + " \"preTasks\": [\n" + " \"dependent\"\n" + " ]\n" + " },\n" + " {\n" + " \"type\": \"DEPENDENT\",\n" + " \"id\": \"tasks-33787\",\n" + " \"name\": \"dependent\",\n" + " \"params\": {\n" + " \n" + " },\n" + " \"description\": \"\",\n" + " \"runFlag\": \"NORMAL\",\n" + " \"dependence\": {\n" + " \"relation\": \"AND\",\n" + " \"dependTaskList\": [\n"
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
+ " {\n" + " \"relation\": \"AND\",\n" + " \"dependItemList\": [\n" + " {\n" + " \"projectId\": 2,\n" + " \"definitionId\": 46,\n" + " \"depTasks\": \"ALL\",\n" + " \"cycle\": \"day\",\n" + " \"dateValue\": \"today\"\n" + " }\n" + " ]\n" + " }\n" + " ]\n" + " },\n" + " \"maxRetryTimes\": \"0\",\n" + " \"retryInterval\": \"1\",\n" + " \"timeout\": {\n" + " \"strategy\": \"\",\n" + " \"enable\": false\n" + " },\n" + " \"taskInstancePriority\": \"MEDIUM\",\n" + " \"workerGroupId\": -1,\n" + " \"preTasks\": [\n" + " \n" + " ]\n" + " }\n" + " ],\n" + " \"tenantId\": 1,\n" + " \"timeout\": 0\n" + "}";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Map<String, Object> updateResult = processDefinitionService.updateProcessDefinition(loginUser, projectName, 1, "test", sqlDependentJson, "", "", ""); Assert.assertEquals(Status.UPDATE_PROCESS_DEFINITION_ERROR, updateResult.get(Constants.STATUS)); } @Test public void testBatchExportProcessDefinitionByIds() throws IOException { processDefinitionService.batchExportProcessDefinitionByIds( null, null, null, null); User loginUser = new User(); loginUser.setId(1); loginUser.setUserType(UserType.ADMIN_USER); String projectName = "project_test1"; Project project = getProject(projectName); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUNT); Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject(projectName)); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result); processDefinitionService.batchExportProcessDefinitionByIds( loginUser, projectName, "1", null); ProcessDefinition processDefinition = new ProcessDefinition(); processDefinition.setId(1); processDefinition.setProcessDefinitionJson("{\"globalParams\":[],\"tasks\":[{\"conditionResult\":" + "{\"failedNode\":[\"\"],\"successNode\":[\"\"]},\"delayTime\":\"0\",\"dependence\":{}" + ",\"description\":\"\",\"id\":\"tasks-3011\",\"maxRetryTimes\":\"0\",\"name\":\"tsssss\"" + ",\"params\":{\"localParams\":[],\"rawScript\":\"echo \\\"123123\\\"\",\"resourceList\":[]}" + ",\"preTasks\":[],\"retryInterval\":\"1\",\"runFlag\":\"NORMAL\",\"taskInstancePriority\":\"MEDIUM\"" + ",\"timeout\":{\"enable\":false,\"interval\":null,\"strategy\":\"\"},\"type\":\"SHELL\"" + ",\"waitStartTimeout\":{},\"workerGroup\":\"default\"}],\"tenantId\":4,\"timeout\":0}"); Map<String, Object> checkResult = new HashMap<>(); checkResult.put(Constants.STATUS, Status.SUCCESS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Mockito.when(projectMapper.queryByName(projectName)).thenReturn(project); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(checkResult); Mockito.when(processDefineMapper.queryByDefineId(1)).thenReturn(processDefinition); HttpServletResponse response = mock(HttpServletResponse.class); ServletOutputStream outputStream = mock(ServletOutputStream.class); when(response.getOutputStream()).thenReturn(outputStream); processDefinitionService.batchExportProcessDefinitionByIds( loginUser, projectName, "1", response); } @Test public void testGetResourceIds() throws Exception { Method testMethod = ReflectionUtils.findMethod(ProcessDefinitionServiceImpl.class, "getResourceIds", ProcessData.class); assertThat(testMethod).isNotNull(); testMethod.setAccessible(true); ProcessData input1 = new ProcessData(); input1.setTasks(Collections.emptyList()); String output1 = (String) testMethod.invoke(processDefinitionService, input1); assertThat(output1).isEmpty(); ProcessData input2 = new ProcessData(); input2.setTasks(null); String output2 = (String) testMethod.invoke(processDefinitionService, input2); assertThat(output2).isEmpty(); ProcessData input3 = new ProcessData(); TaskNode taskNode3 = new TaskNode(); taskNode3.setType("notExistType"); input3.setTasks(Collections.singletonList(taskNode3));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
String output3 = (String) testMethod.invoke(processDefinitionService, input3); assertThat(output3).isEmpty(); ProcessData input4 = new ProcessData(); TaskNode taskNode4 = new TaskNode(); taskNode4.setType("SHELL"); taskNode4.setParams(null); input4.setTasks(Collections.singletonList(taskNode4)); String output4 = (String) testMethod.invoke(processDefinitionService, input4); assertThat(output4).isEmpty(); ProcessData input5 = new ProcessData(); TaskNode taskNode5 = new TaskNode(); taskNode5.setType("SHELL"); ShellParameters shellParameters5 = new ShellParameters(); ResourceInfo resourceInfo5A = new ResourceInfo(); resourceInfo5A.setId(1); ResourceInfo resourceInfo5B = new ResourceInfo(); resourceInfo5B.setId(2); shellParameters5.setResourceList(Arrays.asList(resourceInfo5A, resourceInfo5B)); taskNode5.setParams(JSONUtils.toJsonString(shellParameters5)); input5.setTasks(Collections.singletonList(taskNode5)); String output5 = (String) testMethod.invoke(processDefinitionService, input5); assertThat(output5.split(",")).hasSize(2) .containsExactlyInAnyOrder("1", "2"); ProcessData input6 = new ProcessData(); TaskNode taskNode6 = new TaskNode(); taskNode6.setType("SHELL"); ShellParameters shellParameters6 = new ShellParameters();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
ResourceInfo resourceInfo6A = new ResourceInfo(); resourceInfo6A.setId(3); ResourceInfo resourceInfo6B = new ResourceInfo(); resourceInfo6B.setId(1); ResourceInfo resourceInfo6C = new ResourceInfo(); resourceInfo6C.setId(1); ResourceInfo resourceInfo6D = new ResourceInfo(); resourceInfo6D.setId(2); shellParameters6.setResourceList(Arrays.asList(resourceInfo6A, resourceInfo6B, resourceInfo6C, resourceInfo6D)); taskNode6.setParams(JSONUtils.toJsonString(shellParameters6)); input6.setTasks(Collections.singletonList(taskNode6)); String output6 = (String) testMethod.invoke(processDefinitionService, input6); assertThat(output6.split(",")).hasSize(3) .containsExactlyInAnyOrder("3", "1", "2"); } /** * get mock datasource * * @return DataSource */ private DataSource getDataSource() { DataSource dataSource = new DataSource(); dataSource.setId(2); dataSource.setName("test"); return dataSource; } /** * get mock processDefinition * * @return ProcessDefinition
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
*/ private ProcessDefinition getProcessDefinition() { ProcessDefinition processDefinition = new ProcessDefinition(); processDefinition.setId(46); processDefinition.setName("test_pdf"); processDefinition.setProjectId(2); processDefinition.setTenantId(1); processDefinition.setDescription(""); return processDefinition; } /** * get mock Project * * @param projectName projectName * @return Project */ private Project getProject(String projectName) { Project project = new Project(); project.setId(1); project.setName(projectName); project.setUserId(1); return project; } /** * get mock Project * * @param projectId projectId * @return Project */ private Project getProjectById(int projectId) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Project project = new Project(); project.setId(projectId); project.setName("project_test2"); project.setUserId(1); return project; } /** * get mock schedule * * @return schedule */ private Schedule getSchedule() { Date date = new Date(); Schedule schedule = new Schedule(); schedule.setId(46); schedule.setProcessDefinitionId(1); schedule.setStartTime(date); schedule.setEndTime(date); schedule.setCrontab("0 0 5 * * ? *"); schedule.setFailureStrategy(FailureStrategy.END); schedule.setUserId(1); schedule.setReleaseState(ReleaseState.OFFLINE); schedule.setProcessInstancePriority(Priority.MEDIUM); schedule.setWarningType(WarningType.NONE); schedule.setWarningGroupId(1); schedule.setWorkerGroup(Constants.DEFAULT_WORKER_GROUP); return schedule; } /** * get mock processMeta
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
* * @return processMeta */ private ProcessMeta getProcessMeta() { ProcessMeta processMeta = new ProcessMeta(); Schedule schedule = getSchedule(); processMeta.setScheduleCrontab(schedule.getCrontab()); processMeta.setScheduleStartTime(DateUtils.dateToString(schedule.getStartTime())); processMeta.setScheduleEndTime(DateUtils.dateToString(schedule.getEndTime())); processMeta.setScheduleWarningType(String.valueOf(schedule.getWarningType())); processMeta.setScheduleWarningGroupId(schedule.getWarningGroupId()); processMeta.setScheduleFailureStrategy(String.valueOf(schedule.getFailureStrategy())); processMeta.setScheduleReleaseState(String.valueOf(schedule.getReleaseState())); processMeta.setScheduleProcessInstancePriority(String.valueOf(schedule.getProcessInstancePriority())); processMeta.setScheduleWorkerGroupName("workgroup1"); return processMeta; } private List<Schedule> getSchedulerList() { List<Schedule> scheduleList = new ArrayList<>(); scheduleList.add(getSchedule()); return scheduleList; } 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()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,493
[Improvement][api] The Process Definition interface parameter releaseState is changed to an enumeration type
**Describe the question** The Process Definition interface parameter releaseState is changed to an enumeration type **What are the current deficiencies and the benefits of improvement** - The current Process Definition interface parameter releaseState variable uses an int type, and the releaseState mapping relationship needs to be recorded in both the front-end and back-end code **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4493
https://github.com/apache/dolphinscheduler/pull/4494
046940b1a008c63d6cad44b3f7aff954f6f9af83
cfa88a4a804b3bc565f6571d5a6e842df18644a2
"2021-01-19T10:21:18Z"
java
"2021-01-22T14:39:58Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
@Test public void testExportProcessMetaData() { Integer processDefinitionId = 111; ProcessDefinition processDefinition = new ProcessDefinition(); processDefinition.setId(processDefinitionId); processDefinition.setProcessDefinitionJson("{\"globalParams\":[],\"tasks\":[{\"conditionResult\":" + "{\"failedNode\":[\"\"],\"successNode\":" + "[\"\"]},\"delayTime\":\"0\",\"dependence\":{}," + "\"description\":\"\",\"id\":\"tasks-3011\",\"maxRetryTimes\":\"0\",\"name\":\"tsssss\"," + "\"params\":{\"localParams\":[],\"rawScript\":\"echo \\\"123123\\\"\",\"resourceList\":[]}," + "\"preTasks\":[],\"retryInterval\":\"1\",\"runFlag\":\"NORMAL\",\"taskInstancePriority\":\"MEDIUM\"," + "\"timeout\":{\"enable\":false,\"interval\":null,\"strategy\":\"\"},\"type\":\"SHELL\"," + "\"waitStartTimeout\":{},\"workerGroup\":\"default\"}],\"tenantId\":4,\"timeout\":0}"); Assert.assertNotNull(processDefinitionService.exportProcessMetaData(processDefinitionId, processDefinition)); } @Test public void testImportProcessSchedule() { User loginUser = new User(); loginUser.setId(1); loginUser.setUserType(UserType.ADMIN_USER); Integer processDefinitionId = 111; String processDefinitionName = "testProcessDefinition"; String projectName = "project_test1"; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUNT); ProcessMeta processMeta = new ProcessMeta(); Assert.assertEquals(0, processDefinitionService.importProcessSchedule(loginUser, projectName, processMeta, processDefinitionName, processDefinitionId)); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,526
[Bug][WorkerServer] worker server doesn't work fine in K8s
i run a worker server in k8s,not change the worker server parms,sometime i run into the error in the picture,dispath do not find a suiteable worker to do the task. <img width="964" alt="截屏2021-01-20 下午8 44 42" src="https://user-images.githubusercontent.com/3957251/105436336-ff6cbc80-5c99-11eb-993c-ac13193efd96.png">
https://github.com/apache/dolphinscheduler/issues/4526
https://github.com/apache/dolphinscheduler/pull/4524
cfa88a4a804b3bc565f6571d5a6e842df18644a2
5bae9336b025afb77bb0459fc10f333a8ff35d48
"2021-01-22T02:10:46Z"
java
"2021-01-24T06:53:27Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.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.
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,526
[Bug][WorkerServer] worker server doesn't work fine in K8s
i run a worker server in k8s,not change the worker server parms,sometime i run into the error in the picture,dispath do not find a suiteable worker to do the task. <img width="964" alt="截屏2021-01-20 下午8 44 42" src="https://user-images.githubusercontent.com/3957251/105436336-ff6cbc80-5c99-11eb-993c-ac13193efd96.png">
https://github.com/apache/dolphinscheduler/issues/4526
https://github.com/apache/dolphinscheduler/pull/4524
cfa88a4a804b3bc565f6571d5a6e842df18644a2
5bae9336b025afb77bb0459fc10f333a8ff35d48
"2021-01-22T02:10:46Z"
java
"2021-01-24T06:53:27Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
*/ package org.apache.dolphinscheduler.common.utils; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.shell.ShellExecutor; import org.apache.commons.configuration.Configuration; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; import java.math.RoundingMode; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.StringTokenizer; import java.util.regex.Pattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import oshi.SystemInfo; import oshi.hardware.CentralProcessor; import oshi.hardware.GlobalMemory; import oshi.hardware.HardwareAbstractionLayer; /** * os utils */ public class OSUtils {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,526
[Bug][WorkerServer] worker server doesn't work fine in K8s
i run a worker server in k8s,not change the worker server parms,sometime i run into the error in the picture,dispath do not find a suiteable worker to do the task. <img width="964" alt="截屏2021-01-20 下午8 44 42" src="https://user-images.githubusercontent.com/3957251/105436336-ff6cbc80-5c99-11eb-993c-ac13193efd96.png">
https://github.com/apache/dolphinscheduler/issues/4526
https://github.com/apache/dolphinscheduler/pull/4524
cfa88a4a804b3bc565f6571d5a6e842df18644a2
5bae9336b025afb77bb0459fc10f333a8ff35d48
"2021-01-22T02:10:46Z"
java
"2021-01-24T06:53:27Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
private static final Logger logger = LoggerFactory.getLogger(OSUtils.class); public static final ThreadLocal<Logger> taskLoggerThreadLocal = new ThreadLocal<>(); private static final SystemInfo SI = new SystemInfo(); public static final String TWO_DECIMAL = "0.00"; /** * return -1 when the function can not get hardware env info * e.g {@link OSUtils#loadAverage()} {@link OSUtils#cpuUsage()} */ public static final double NEGATIVE_ONE = -1; private static HardwareAbstractionLayer hal = SI.getHardware(); private OSUtils() { throw new UnsupportedOperationException("Construct OSUtils"); } /** * Initialization regularization, solve the problem of pre-compilation performance, * avoid the thread safety problem of multi-thread operation */ private static final Pattern PATTERN = Pattern.compile("\\s+"); /** * get memory usage * Keep 2 decimal * * @return percent %
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,526
[Bug][WorkerServer] worker server doesn't work fine in K8s
i run a worker server in k8s,not change the worker server parms,sometime i run into the error in the picture,dispath do not find a suiteable worker to do the task. <img width="964" alt="截屏2021-01-20 下午8 44 42" src="https://user-images.githubusercontent.com/3957251/105436336-ff6cbc80-5c99-11eb-993c-ac13193efd96.png">
https://github.com/apache/dolphinscheduler/issues/4526
https://github.com/apache/dolphinscheduler/pull/4524
cfa88a4a804b3bc565f6571d5a6e842df18644a2
5bae9336b025afb77bb0459fc10f333a8ff35d48
"2021-01-22T02:10:46Z"
java
"2021-01-24T06:53:27Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
*/ public static double memoryUsage() { GlobalMemory memory = hal.getMemory(); double memoryUsage = (memory.getTotal() - memory.getAvailable() - memory.getSwapUsed()) * 0.1 / memory.getTotal() * 10; DecimalFormat df = new DecimalFormat(TWO_DECIMAL); df.setRoundingMode(RoundingMode.HALF_UP); return Double.parseDouble(df.format(memoryUsage)); } /** * get available physical memory size * <p> * Keep 2 decimal * * @return available Physical Memory Size, unit: G */ public static double availablePhysicalMemorySize() { GlobalMemory memory = hal.getMemory(); double availablePhysicalMemorySize = (memory.getAvailable() + memory.getSwapUsed()) / 1024.0 / 1024 / 1024; DecimalFormat df = new DecimalFormat(TWO_DECIMAL); df.setRoundingMode(RoundingMode.HALF_UP); return Double.parseDouble(df.format(availablePhysicalMemorySize)); } /** * get total physical memory size * <p> * Keep 2 decimal * * @return available Physical Memory Size, unit: G */ public static double totalMemorySize() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,526
[Bug][WorkerServer] worker server doesn't work fine in K8s
i run a worker server in k8s,not change the worker server parms,sometime i run into the error in the picture,dispath do not find a suiteable worker to do the task. <img width="964" alt="截屏2021-01-20 下午8 44 42" src="https://user-images.githubusercontent.com/3957251/105436336-ff6cbc80-5c99-11eb-993c-ac13193efd96.png">
https://github.com/apache/dolphinscheduler/issues/4526
https://github.com/apache/dolphinscheduler/pull/4524
cfa88a4a804b3bc565f6571d5a6e842df18644a2
5bae9336b025afb77bb0459fc10f333a8ff35d48
"2021-01-22T02:10:46Z"
java
"2021-01-24T06:53:27Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
GlobalMemory memory = hal.getMemory(); double availablePhysicalMemorySize = memory.getTotal() / 1024.0 / 1024 / 1024; DecimalFormat df = new DecimalFormat(TWO_DECIMAL); df.setRoundingMode(RoundingMode.HALF_UP); return Double.parseDouble(df.format(availablePhysicalMemorySize)); } /** * load average * * @return load average */ public static double loadAverage() { double loadAverage = hal.getProcessor().getSystemLoadAverage(); if (Double.isNaN(loadAverage)) { return NEGATIVE_ONE; } DecimalFormat df = new DecimalFormat(TWO_DECIMAL); df.setRoundingMode(RoundingMode.HALF_UP); return Double.parseDouble(df.format(loadAverage)); } /** * get cpu usage * * @return cpu usage */ public static double cpuUsage() { CentralProcessor processor = hal.getProcessor(); double cpuUsage = processor.getSystemCpuLoad(); if (Double.isNaN(cpuUsage)) { return NEGATIVE_ONE;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,526
[Bug][WorkerServer] worker server doesn't work fine in K8s
i run a worker server in k8s,not change the worker server parms,sometime i run into the error in the picture,dispath do not find a suiteable worker to do the task. <img width="964" alt="截屏2021-01-20 下午8 44 42" src="https://user-images.githubusercontent.com/3957251/105436336-ff6cbc80-5c99-11eb-993c-ac13193efd96.png">
https://github.com/apache/dolphinscheduler/issues/4526
https://github.com/apache/dolphinscheduler/pull/4524
cfa88a4a804b3bc565f6571d5a6e842df18644a2
5bae9336b025afb77bb0459fc10f333a8ff35d48
"2021-01-22T02:10:46Z"
java
"2021-01-24T06:53:27Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
} DecimalFormat df = new DecimalFormat(TWO_DECIMAL); df.setRoundingMode(RoundingMode.HALF_UP); return Double.parseDouble(df.format(cpuUsage)); } public static List<String> getUserList() { try { if (isMacOS()) { return getUserListFromMac(); } else if (isWindows()) { return getUserListFromWindows(); } else { return getUserListFromLinux(); } } catch (Exception e) { logger.error(e.getMessage(), e); } return Collections.emptyList(); } /** * get user list from linux * * @return user list */ private static List<String> getUserListFromLinux() throws IOException { List<String> userList = new ArrayList<>(); try (BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(new FileInputStream("/etc/passwd")))) { String line; while ((line = bufferedReader.readLine()) != null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,526
[Bug][WorkerServer] worker server doesn't work fine in K8s
i run a worker server in k8s,not change the worker server parms,sometime i run into the error in the picture,dispath do not find a suiteable worker to do the task. <img width="964" alt="截屏2021-01-20 下午8 44 42" src="https://user-images.githubusercontent.com/3957251/105436336-ff6cbc80-5c99-11eb-993c-ac13193efd96.png">
https://github.com/apache/dolphinscheduler/issues/4526
https://github.com/apache/dolphinscheduler/pull/4524
cfa88a4a804b3bc565f6571d5a6e842df18644a2
5bae9336b025afb77bb0459fc10f333a8ff35d48
"2021-01-22T02:10:46Z"
java
"2021-01-24T06:53:27Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
if (line.contains(":")) { String[] userInfo = line.split(":"); userList.add(userInfo[0]); } } } return userList; } /** * get user list from mac * * @return user list */ private static List<String> getUserListFromMac() throws IOException { String result = exeCmd("dscl . list /users"); if (StringUtils.isNotEmpty(result)) { return Arrays.asList(result.split("\n")); } return Collections.emptyList(); } /** * get user list from windows * * @return user list */ private static List<String> getUserListFromWindows() throws IOException { String result = exeCmd("net user"); String[] lines = result.split("\n"); int startPos = 0; int endPos = lines.length - 2;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,526
[Bug][WorkerServer] worker server doesn't work fine in K8s
i run a worker server in k8s,not change the worker server parms,sometime i run into the error in the picture,dispath do not find a suiteable worker to do the task. <img width="964" alt="截屏2021-01-20 下午8 44 42" src="https://user-images.githubusercontent.com/3957251/105436336-ff6cbc80-5c99-11eb-993c-ac13193efd96.png">
https://github.com/apache/dolphinscheduler/issues/4526
https://github.com/apache/dolphinscheduler/pull/4524
cfa88a4a804b3bc565f6571d5a6e842df18644a2
5bae9336b025afb77bb0459fc10f333a8ff35d48
"2021-01-22T02:10:46Z"
java
"2021-01-24T06:53:27Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
for (int i = 0; i < lines.length; i++) { if (lines[i].isEmpty()) { continue; } int count = 0; if (lines[i].charAt(0) == '-') { for (int j = 0; j < lines[i].length(); j++) { if (lines[i].charAt(i) == '-') { count++; } } } if (count == lines[i].length()) { startPos = i + 1; break; } } List<String> users = new ArrayList<>(); while (startPos <= endPos) { users.addAll(Arrays.asList(PATTERN.split(lines[startPos]))); startPos++; } return users; } /** * create user * * @param userName user name * @return true if creation was successful, otherwise false */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,526
[Bug][WorkerServer] worker server doesn't work fine in K8s
i run a worker server in k8s,not change the worker server parms,sometime i run into the error in the picture,dispath do not find a suiteable worker to do the task. <img width="964" alt="截屏2021-01-20 下午8 44 42" src="https://user-images.githubusercontent.com/3957251/105436336-ff6cbc80-5c99-11eb-993c-ac13193efd96.png">
https://github.com/apache/dolphinscheduler/issues/4526
https://github.com/apache/dolphinscheduler/pull/4524
cfa88a4a804b3bc565f6571d5a6e842df18644a2
5bae9336b025afb77bb0459fc10f333a8ff35d48
"2021-01-22T02:10:46Z"
java
"2021-01-24T06:53:27Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
public static boolean createUser(String userName) { try { String userGroup = OSUtils.getGroup(); if (StringUtils.isEmpty(userGroup)) { String errorLog = String.format("%s group does not exist for this operating system.", userGroup); LoggerUtils.logError(Optional.ofNullable(logger), errorLog); LoggerUtils.logError(Optional.ofNullable(taskLoggerThreadLocal.get()), errorLog); return false; } if (isMacOS()) { createMacUser(userName, userGroup); } else if (isWindows()) { createWindowsUser(userName, userGroup); } else { createLinuxUser(userName, userGroup); } return true; } catch (Exception e) { LoggerUtils.logError(Optional.ofNullable(logger), e); LoggerUtils.logError(Optional.ofNullable(taskLoggerThreadLocal.get()), e); } return false; } /** * create linux user * * @param userName user name * @param userGroup user group * @throws IOException in case of an I/O error */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,526
[Bug][WorkerServer] worker server doesn't work fine in K8s
i run a worker server in k8s,not change the worker server parms,sometime i run into the error in the picture,dispath do not find a suiteable worker to do the task. <img width="964" alt="截屏2021-01-20 下午8 44 42" src="https://user-images.githubusercontent.com/3957251/105436336-ff6cbc80-5c99-11eb-993c-ac13193efd96.png">
https://github.com/apache/dolphinscheduler/issues/4526
https://github.com/apache/dolphinscheduler/pull/4524
cfa88a4a804b3bc565f6571d5a6e842df18644a2
5bae9336b025afb77bb0459fc10f333a8ff35d48
"2021-01-22T02:10:46Z"
java
"2021-01-24T06:53:27Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
private static void createLinuxUser(String userName, String userGroup) throws IOException { String infoLog1 = String.format("create linux os user : %s", userName); LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog1); LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog1); String cmd = String.format("sudo useradd -g %s %s", userGroup, userName); String infoLog2 = String.format("execute cmd : %s", cmd); LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog2); LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog2); OSUtils.exeCmd(cmd); } /** * create mac user (Supports Mac OSX 10.10+) * * @param userName user name * @param userGroup user group * @throws IOException in case of an I/O error */ private static void createMacUser(String userName, String userGroup) throws IOException { Optional<Logger> optionalLogger = Optional.ofNullable(logger); Optional<Logger> optionalTaskLogger = Optional.ofNullable(taskLoggerThreadLocal.get()); String infoLog1 = String.format("create mac os user : %s", userName); LoggerUtils.logInfo(optionalLogger, infoLog1); LoggerUtils.logInfo(optionalTaskLogger, infoLog1); String createUserCmd = String.format("sudo sysadminctl -addUser %s -password %s", userName, userName); String infoLog2 = String.format("create user command : %s", createUserCmd); LoggerUtils.logInfo(optionalLogger, infoLog2); LoggerUtils.logInfo(optionalTaskLogger, infoLog2); OSUtils.exeCmd(createUserCmd); String appendGroupCmd = String.format("sudo dseditgroup -o edit -a %s -t user %s", userName, userGroup); String infoLog3 = String.format("append user to group : %s", appendGroupCmd);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,526
[Bug][WorkerServer] worker server doesn't work fine in K8s
i run a worker server in k8s,not change the worker server parms,sometime i run into the error in the picture,dispath do not find a suiteable worker to do the task. <img width="964" alt="截屏2021-01-20 下午8 44 42" src="https://user-images.githubusercontent.com/3957251/105436336-ff6cbc80-5c99-11eb-993c-ac13193efd96.png">
https://github.com/apache/dolphinscheduler/issues/4526
https://github.com/apache/dolphinscheduler/pull/4524
cfa88a4a804b3bc565f6571d5a6e842df18644a2
5bae9336b025afb77bb0459fc10f333a8ff35d48
"2021-01-22T02:10:46Z"
java
"2021-01-24T06:53:27Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
LoggerUtils.logInfo(optionalLogger, infoLog3); LoggerUtils.logInfo(optionalTaskLogger, infoLog3); OSUtils.exeCmd(appendGroupCmd); } /** * create windows user * * @param userName user name * @param userGroup user group * @throws IOException in case of an I/O error */ private static void createWindowsUser(String userName, String userGroup) throws IOException { String infoLog1 = String.format("create windows os user : %s", userName); LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog1); LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog1); String userCreateCmd = String.format("net user \"%s\" /add", userName); String infoLog2 = String.format("execute create user command : %s", userCreateCmd); LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog2); LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog2); OSUtils.exeCmd(userCreateCmd); String appendGroupCmd = String.format("net localgroup \"%s\" \"%s\" /add", userGroup, userName); String infoLog3 = String.format("execute append user to group : %s", appendGroupCmd); LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog3); LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog3); OSUtils.exeCmd(appendGroupCmd); } /** * get system group information * * @return system group info
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,526
[Bug][WorkerServer] worker server doesn't work fine in K8s
i run a worker server in k8s,not change the worker server parms,sometime i run into the error in the picture,dispath do not find a suiteable worker to do the task. <img width="964" alt="截屏2021-01-20 下午8 44 42" src="https://user-images.githubusercontent.com/3957251/105436336-ff6cbc80-5c99-11eb-993c-ac13193efd96.png">
https://github.com/apache/dolphinscheduler/issues/4526
https://github.com/apache/dolphinscheduler/pull/4524
cfa88a4a804b3bc565f6571d5a6e842df18644a2
5bae9336b025afb77bb0459fc10f333a8ff35d48
"2021-01-22T02:10:46Z"
java
"2021-01-24T06:53:27Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
* @throws IOException errors */ public static String getGroup() throws IOException { if (isWindows()) { String currentProcUserName = System.getProperty("user.name"); String result = exeCmd(String.format("net user \"%s\"", currentProcUserName)); String line = result.split("\n")[22]; String group = PATTERN.split(line)[1]; if (group.charAt(0) == '*') { return group.substring(1); } else { return group; } } else { String result = exeCmd("groups"); if (StringUtils.isNotEmpty(result)) { String[] groupInfo = result.split(" "); return groupInfo[0]; } } return null; } /** * Execute the corresponding command of Linux or Windows * * @param command command * @return result of execute command * @throws IOException errors */ public static String exeCmd(String command) throws IOException {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,526
[Bug][WorkerServer] worker server doesn't work fine in K8s
i run a worker server in k8s,not change the worker server parms,sometime i run into the error in the picture,dispath do not find a suiteable worker to do the task. <img width="964" alt="截屏2021-01-20 下午8 44 42" src="https://user-images.githubusercontent.com/3957251/105436336-ff6cbc80-5c99-11eb-993c-ac13193efd96.png">
https://github.com/apache/dolphinscheduler/issues/4526
https://github.com/apache/dolphinscheduler/pull/4524
cfa88a4a804b3bc565f6571d5a6e842df18644a2
5bae9336b025afb77bb0459fc10f333a8ff35d48
"2021-01-22T02:10:46Z"
java
"2021-01-24T06:53:27Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
StringTokenizer st = new StringTokenizer(command); String[] cmdArray = new String[st.countTokens()]; for (int i = 0; st.hasMoreTokens(); i++) { cmdArray[i] = st.nextToken(); } return exeShell(cmdArray); } /** * Execute the shell * * @param command command * @return result of execute the shell * @throws IOException errors */ public static String exeShell(String[] command) throws IOException { return ShellExecutor.execCommand(command); } /** * get process id * * @return process id */ public static int getProcessID() { RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean(); return Integer.parseInt(runtimeMXBean.getName().split("@")[0]); } /** * whether is macOS * * @return true if mac
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,526
[Bug][WorkerServer] worker server doesn't work fine in K8s
i run a worker server in k8s,not change the worker server parms,sometime i run into the error in the picture,dispath do not find a suiteable worker to do the task. <img width="964" alt="截屏2021-01-20 下午8 44 42" src="https://user-images.githubusercontent.com/3957251/105436336-ff6cbc80-5c99-11eb-993c-ac13193efd96.png">
https://github.com/apache/dolphinscheduler/issues/4526
https://github.com/apache/dolphinscheduler/pull/4524
cfa88a4a804b3bc565f6571d5a6e842df18644a2
5bae9336b025afb77bb0459fc10f333a8ff35d48
"2021-01-22T02:10:46Z"
java
"2021-01-24T06:53:27Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
*/ public static boolean isMacOS() { return getOSName().startsWith("Mac"); } /** * whether is windows * * @return true if windows */ public static boolean isWindows() { return getOSName().startsWith("Windows"); } /** * get current OS name * * @return current OS name */ public static String getOSName() { return System.getProperty("os.name"); } /** * check memory and cpu usage * * @param systemCpuLoad systemCpuLoad * @param systemReservedMemory systemReservedMemory * @return check memory and cpu usage */ public static Boolean checkResource(double systemCpuLoad, double systemReservedMemory) { double loadAverage = OSUtils.loadAverage();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,526
[Bug][WorkerServer] worker server doesn't work fine in K8s
i run a worker server in k8s,not change the worker server parms,sometime i run into the error in the picture,dispath do not find a suiteable worker to do the task. <img width="964" alt="截屏2021-01-20 下午8 44 42" src="https://user-images.githubusercontent.com/3957251/105436336-ff6cbc80-5c99-11eb-993c-ac13193efd96.png">
https://github.com/apache/dolphinscheduler/issues/4526
https://github.com/apache/dolphinscheduler/pull/4524
cfa88a4a804b3bc565f6571d5a6e842df18644a2
5bae9336b025afb77bb0459fc10f333a8ff35d48
"2021-01-22T02:10:46Z"
java
"2021-01-24T06:53:27Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
double availablePhysicalMemorySize = OSUtils.availablePhysicalMemorySize(); if (loadAverage > systemCpuLoad || availablePhysicalMemorySize < systemReservedMemory) { logger.warn("load is too high or availablePhysicalMemorySize(G) is too low, it's availablePhysicalMemorySize(G):{},loadAvg:{}", availablePhysicalMemorySize, loadAverage); return false; } else { return true; } } /** * check memory and cpu usage * * @param conf conf * @param isMaster is master * @return check memory and cpu usage */ public static Boolean checkResource(Configuration conf, Boolean isMaster) { double systemCpuLoad; double systemReservedMemory; if (Boolean.TRUE.equals(isMaster)) { systemCpuLoad = conf.getDouble(Constants.MASTER_MAX_CPULOAD_AVG, Constants.DEFAULT_MASTER_CPU_LOAD); systemReservedMemory = conf.getDouble(Constants.MASTER_RESERVED_MEMORY, Constants.DEFAULT_MASTER_RESERVED_MEMORY); } else { systemCpuLoad = conf.getDouble(Constants.WORKER_MAX_CPULOAD_AVG, Constants.DEFAULT_WORKER_CPU_LOAD); systemReservedMemory = conf.getDouble(Constants.WORKER_RESERVED_MEMORY, Constants.DEFAULT_WORKER_RESERVED_MEMORY); } return checkResource(systemCpuLoad, systemReservedMemory); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,506
There is a vulnerability in beanutils 1.7.0,upgrade recommended
https://github.com/apache/incubator-dolphinscheduler/blob/17c06ce966fc5c6a6136ee142e4698312fe6532f/pom.xml#L84 CVE-2014-0114 CVE-2019-10086 Recommended upgrade version:1.8.0~beta-1
https://github.com/apache/dolphinscheduler/issues/4506
https://github.com/apache/dolphinscheduler/pull/4525
829fdb52c1769030113b450b0b98ffecfe3693f8
a5f31b75abee3ef12647dbb961013bd941bc78f1
"2021-01-20T05:46:36Z"
java
"2021-01-25T05:43:06Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CollectionUtils.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.common.utils; import org.apache.commons.beanutils.BeanMap; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,506
There is a vulnerability in beanutils 1.7.0,upgrade recommended
https://github.com/apache/incubator-dolphinscheduler/blob/17c06ce966fc5c6a6136ee142e4698312fe6532f/pom.xml#L84 CVE-2014-0114 CVE-2019-10086 Recommended upgrade version:1.8.0~beta-1
https://github.com/apache/dolphinscheduler/issues/4506
https://github.com/apache/dolphinscheduler/pull/4525
829fdb52c1769030113b450b0b98ffecfe3693f8
a5f31b75abee3ef12647dbb961013bd941bc78f1
"2021-01-20T05:46:36Z"
java
"2021-01-25T05:43:06Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CollectionUtils.java
/** * Provides utility methods and decorators for {@link Collection} instances. * <p> * Various utility methods might put the input objects into a Set/Map/Bag. In case * the input objects override {@link Object#equals(Object)}, it is mandatory that * the general contract of the {@link Object#hashCode()} method is maintained. * <p> * NOTE: From 4.0, method parameters will take {@link Iterable} objects when possible. * * @version $Id: CollectionUtils.java 1686855 2015-06-22 13:00:27Z tn $ * @since 1.0 */ public class CollectionUtils { private CollectionUtils() { throw new UnsupportedOperationException("Construct CollectionUtils"); } /** * Returns a new {@link Collection} containing <i>a</i> minus a subset of * <i>b</i>. Only the elements of <i>b</i> that satisfy the predicate * condition, <i>p</i> are subtracted from <i>a</i>. * * <p>The cardinality of each element <i>e</i> in the returned {@link Collection} * that satisfies the predicate condition will be the cardinality of <i>e</i> in <i>a</i> * minus the cardinality of <i>e</i> in <i>b</i>, or zero, whichever is greater.</p> * <p>The cardinality of each element <i>e</i> in the returned {@link Collection} that does <b>not</b> * satisfy the predicate condition will be equal to the cardinality of <i>e</i> in <i>a</i>.</p> * * @param a the collection to subtract from, must not be null * @param b the collection to subtract, must not be null * @param <T> T
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,506
There is a vulnerability in beanutils 1.7.0,upgrade recommended
https://github.com/apache/incubator-dolphinscheduler/blob/17c06ce966fc5c6a6136ee142e4698312fe6532f/pom.xml#L84 CVE-2014-0114 CVE-2019-10086 Recommended upgrade version:1.8.0~beta-1
https://github.com/apache/dolphinscheduler/issues/4506
https://github.com/apache/dolphinscheduler/pull/4525
829fdb52c1769030113b450b0b98ffecfe3693f8
a5f31b75abee3ef12647dbb961013bd941bc78f1
"2021-01-20T05:46:36Z"
java
"2021-01-25T05:43:06Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CollectionUtils.java
* @return a new collection with the results * @see Collection#removeAll */ public static <T> Collection<T> subtract(Set<T> a, Set<T> b) { return org.apache.commons.collections4.CollectionUtils.subtract(a, b); } public static boolean isNotEmpty(Collection coll) { return !isEmpty(coll); } public static boolean isEmpty(Collection coll) { return coll == null || coll.isEmpty(); } /** * String to map * * @param str string * @param separator separator * @return string to map */ public static Map<String, String> stringToMap(String str, String separator) { return stringToMap(str, separator, ""); } /** * String to map * * @param str string * @param separator separator * @param keyPrefix prefix * @return string to map */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,506
There is a vulnerability in beanutils 1.7.0,upgrade recommended
https://github.com/apache/incubator-dolphinscheduler/blob/17c06ce966fc5c6a6136ee142e4698312fe6532f/pom.xml#L84 CVE-2014-0114 CVE-2019-10086 Recommended upgrade version:1.8.0~beta-1
https://github.com/apache/dolphinscheduler/issues/4506
https://github.com/apache/dolphinscheduler/pull/4525
829fdb52c1769030113b450b0b98ffecfe3693f8
a5f31b75abee3ef12647dbb961013bd941bc78f1
"2021-01-20T05:46:36Z"
java
"2021-01-25T05:43:06Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CollectionUtils.java
public static Map<String, String> stringToMap(String str, String separator, String keyPrefix) { Map<String, String> emptyMap = new HashMap<>(0); if (StringUtils.isEmpty(str)) { return emptyMap; } if (StringUtils.isEmpty(separator)) { return emptyMap; } String[] strings = str.split(separator); Map<String, String> map = new HashMap<>(strings.length); for (int i = 0; i < strings.length; i++) { String[] strArray = strings[i].split("="); if (strArray.length != 2) { return emptyMap; } if (StringUtils.isEmpty(keyPrefix)) { map.put(strArray[0], strArray[1]); } else { map.put(keyPrefix + strArray[0], strArray[1]); } } return map; } /** * Helper class to easily access cardinality properties of two collections. * * @param <O> the element type */ private static class CardinalityHelper<O> {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,506
There is a vulnerability in beanutils 1.7.0,upgrade recommended
https://github.com/apache/incubator-dolphinscheduler/blob/17c06ce966fc5c6a6136ee142e4698312fe6532f/pom.xml#L84 CVE-2014-0114 CVE-2019-10086 Recommended upgrade version:1.8.0~beta-1
https://github.com/apache/dolphinscheduler/issues/4506
https://github.com/apache/dolphinscheduler/pull/4525
829fdb52c1769030113b450b0b98ffecfe3693f8
a5f31b75abee3ef12647dbb961013bd941bc78f1
"2021-01-20T05:46:36Z"
java
"2021-01-25T05:43:06Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CollectionUtils.java
/** * Contains the cardinality for each object in collection A. */ final Map<O, Integer> cardinalityA; /** * Contains the cardinality for each object in collection B. */ final Map<O, Integer> cardinalityB; /** * Create a new CardinalityHelper for two collections. * * @param a the first collection * @param b the second collection */ public CardinalityHelper(final Iterable<? extends O> a, final Iterable<? extends O> b) { cardinalityA = CollectionUtils.getCardinalityMap(a); cardinalityB = CollectionUtils.getCardinalityMap(b); } /** * Returns the frequency of this object in collection A.
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,506
There is a vulnerability in beanutils 1.7.0,upgrade recommended
https://github.com/apache/incubator-dolphinscheduler/blob/17c06ce966fc5c6a6136ee142e4698312fe6532f/pom.xml#L84 CVE-2014-0114 CVE-2019-10086 Recommended upgrade version:1.8.0~beta-1
https://github.com/apache/dolphinscheduler/issues/4506
https://github.com/apache/dolphinscheduler/pull/4525
829fdb52c1769030113b450b0b98ffecfe3693f8
a5f31b75abee3ef12647dbb961013bd941bc78f1
"2021-01-20T05:46:36Z"
java
"2021-01-25T05:43:06Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CollectionUtils.java
* * @param obj the object * @return the frequency of the object in collection A */ public int freqA(final Object obj) { return getFreq(obj, cardinalityA); } /** * Returns the frequency of this object in collection B. * * @param obj the object * @return the frequency of the object in collection B */ public int freqB(final Object obj) { return getFreq(obj, cardinalityB); } private int getFreq(final Object obj, final Map<?, Integer> freqMap) { final Integer count = freqMap.get(obj); if (count != null) { return count; } return 0; } } /** * returns {@code true} iff the given {@link Collection}s contain * exactly the same elements with exactly the same cardinalities. * * @param a the first collection * @param b the second collection
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,506
There is a vulnerability in beanutils 1.7.0,upgrade recommended
https://github.com/apache/incubator-dolphinscheduler/blob/17c06ce966fc5c6a6136ee142e4698312fe6532f/pom.xml#L84 CVE-2014-0114 CVE-2019-10086 Recommended upgrade version:1.8.0~beta-1
https://github.com/apache/dolphinscheduler/issues/4506
https://github.com/apache/dolphinscheduler/pull/4525
829fdb52c1769030113b450b0b98ffecfe3693f8
a5f31b75abee3ef12647dbb961013bd941bc78f1
"2021-01-20T05:46:36Z"
java
"2021-01-25T05:43:06Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CollectionUtils.java
* @return Returns true iff the given Collections contain exactly the same elements with exactly the same cardinalities. * That is, iff the cardinality of e in a is equal to the cardinality of e in b, for each element e in a or b. */ public static boolean equalLists(Collection<?> a, Collection<?> b) { if (a == null && b == null) { return true; } if (a == null || b == null) { return false; } return isEqualCollection(a, b); } /** * Returns {@code true} iff the given {@link Collection}s contain * exactly the same elements with exactly the same cardinalities. * <p> * That is, iff the cardinality of <i>e</i> in <i>a</i> is * equal to the cardinality of <i>e</i> in <i>b</i>, * for each element <i>e</i> in <i>a</i> or <i>b</i>. * * @param a the first collection, must not be null * @param b the second collection, must not be null * @return <code>true</code> iff the collections contain the same elements with the same cardinalities. */ public static boolean isEqualCollection(final Collection<?> a, final Collection<?> b) { if (a.size() != b.size()) { return false; } final CardinalityHelper<Object> helper = new CardinalityHelper<>(a, b); if (helper.cardinalityA.size() != helper.cardinalityB.size()) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,506
There is a vulnerability in beanutils 1.7.0,upgrade recommended
https://github.com/apache/incubator-dolphinscheduler/blob/17c06ce966fc5c6a6136ee142e4698312fe6532f/pom.xml#L84 CVE-2014-0114 CVE-2019-10086 Recommended upgrade version:1.8.0~beta-1
https://github.com/apache/dolphinscheduler/issues/4506
https://github.com/apache/dolphinscheduler/pull/4525
829fdb52c1769030113b450b0b98ffecfe3693f8
a5f31b75abee3ef12647dbb961013bd941bc78f1
"2021-01-20T05:46:36Z"
java
"2021-01-25T05:43:06Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CollectionUtils.java
return false; } for (final Object obj : helper.cardinalityA.keySet()) { if (helper.freqA(obj) != helper.freqB(obj)) { return false; } } return true; } /** * Returns a {@link Map} mapping each unique element in the given * {@link Collection} to an {@link Integer} representing the number * of occurrences of that element in the {@link Collection}. * <p> * Only those elements present in the collection will appear as * keys in the map. * * @param <O> the type of object in the returned {@link Map}. This is a super type of O * @param coll the collection to get the cardinality map for, must not be null * @return the populated cardinality map */ public static <O> Map<O, Integer> getCardinalityMap(final Iterable<? extends O> coll) { final Map<O, Integer> count = new HashMap<>(); for (final O obj : coll) { count.put(obj, count.getOrDefault(obj, 0) + 1); } return count; } /** * Removes certain attributes of each object in the list
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,506
There is a vulnerability in beanutils 1.7.0,upgrade recommended
https://github.com/apache/incubator-dolphinscheduler/blob/17c06ce966fc5c6a6136ee142e4698312fe6532f/pom.xml#L84 CVE-2014-0114 CVE-2019-10086 Recommended upgrade version:1.8.0~beta-1
https://github.com/apache/dolphinscheduler/issues/4506
https://github.com/apache/dolphinscheduler/pull/4525
829fdb52c1769030113b450b0b98ffecfe3693f8
a5f31b75abee3ef12647dbb961013bd941bc78f1
"2021-01-20T05:46:36Z"
java
"2021-01-25T05:43:06Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CollectionUtils.java
* * @param originList origin list * @param exclusionSet exclusion set * @param <T> T * @return removes certain attributes of each object in the list */ public static <T extends Object> List<Map<String, Object>> getListByExclusion(List<T> originList, Set<String> exclusionSet) { List<Map<String, Object>> instanceList = new ArrayList<>(); if (exclusionSet == null) { exclusionSet = new HashSet<>(); } if (originList == null) { return instanceList; } Map<String, Object> instanceMap; for (T instance : originList) { Map<String, Object> dataMap = new BeanMap(instance); instanceMap = new LinkedHashMap<>(16, 0.75f, true); for (Map.Entry<String, Object> entry : dataMap.entrySet()) { if (exclusionSet.contains(entry.getKey())) { continue; } instanceMap.put(entry.getKey(), entry.getValue()); } instanceList.add(instanceMap); } return instanceList; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,592
[Improvement][api] Worker group data returned incorrectly
![image](https://user-images.githubusercontent.com/55787491/105975589-16604400-60ca-11eb-91b8-83fd8568673e.png) ![image](https://user-images.githubusercontent.com/55787491/105975823-6212ed80-60ca-11eb-91a5-772c93a899bb.png) **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4592
https://github.com/apache/dolphinscheduler/pull/4620
658376ad363dcafafe1054f8babfc5bb5ffe60c0
afd201e6fa50700cf16aad2a292e61c4e5b6e5f9
"2021-01-27T10:06:43Z"
java
"2021-01-29T08:54:39Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,592
[Improvement][api] Worker group data returned incorrectly
![image](https://user-images.githubusercontent.com/55787491/105975589-16604400-60ca-11eb-91b8-83fd8568673e.png) ![image](https://user-images.githubusercontent.com/55787491/105975823-6212ed80-60ca-11eb-91a5-772c93a899bb.png) **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4592
https://github.com/apache/dolphinscheduler/pull/4620
658376ad363dcafafe1054f8babfc5bb5ffe60c0
afd201e6fa50700cf16aad2a292e61c4e5b6e5f9
"2021-01-27T10:06:43Z"
java
"2021-01-29T08:54:39Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java
* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.service; import static org.apache.dolphinscheduler.common.Constants.DEFAULT_WORKER_GROUP; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.utils.CollectionUtils; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.entity.WorkerGroup; import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper; import org.apache.dolphinscheduler.service.zk.ZookeeperCachedOperator; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * work group service */ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,592
[Improvement][api] Worker group data returned incorrectly
![image](https://user-images.githubusercontent.com/55787491/105975589-16604400-60ca-11eb-91b8-83fd8568673e.png) ![image](https://user-images.githubusercontent.com/55787491/105975823-6212ed80-60ca-11eb-91a5-772c93a899bb.png) **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4592
https://github.com/apache/dolphinscheduler/pull/4620
658376ad363dcafafe1054f8babfc5bb5ffe60c0
afd201e6fa50700cf16aad2a292e61c4e5b6e5f9
"2021-01-27T10:06:43Z"
java
"2021-01-29T08:54:39Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java
public class WorkerGroupService extends BaseService { private static final String NO_NODE_EXCEPTION_REGEX = "KeeperException$NoNodeException"; @Autowired protected ZookeeperCachedOperator zookeeperCachedOperator; @Autowired ProcessInstanceMapper processInstanceMapper; /** * query worker group paging * * @param loginUser login user * @param pageNo page number * @param searchVal search value * @param pageSize page size * @return worker group list page */ public Map<String, Object> queryAllGroupPaging(User loginUser, Integer pageNo, Integer pageSize, String searchVal) { Integer fromIndex = (pageNo - 1) * pageSize; Integer toIndex = (pageNo - 1) * pageSize + pageSize; Map<String, Object> result = new HashMap<>(); if (isNotAdmin(loginUser, result)) { return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,592
[Improvement][api] Worker group data returned incorrectly
![image](https://user-images.githubusercontent.com/55787491/105975589-16604400-60ca-11eb-91b8-83fd8568673e.png) ![image](https://user-images.githubusercontent.com/55787491/105975823-6212ed80-60ca-11eb-91a5-772c93a899bb.png) **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4592
https://github.com/apache/dolphinscheduler/pull/4620
658376ad363dcafafe1054f8babfc5bb5ffe60c0
afd201e6fa50700cf16aad2a292e61c4e5b6e5f9
"2021-01-27T10:06:43Z"
java
"2021-01-29T08:54:39Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java
} List<WorkerGroup> workerGroups = getWorkerGroups(true); List<WorkerGroup> resultDataList = new ArrayList<>(); if (CollectionUtils.isNotEmpty(workerGroups)) { List<WorkerGroup> searchValDataList = new ArrayList<>(); if (StringUtils.isNotEmpty(searchVal)) { for (WorkerGroup workerGroup : workerGroups) { if (workerGroup.getName().contains(searchVal)) { searchValDataList.add(workerGroup); } } } else { searchValDataList = workerGroups; } if (searchValDataList.size() < pageSize) { toIndex = (pageNo - 1) * pageSize + searchValDataList.size(); } resultDataList = searchValDataList.subList(fromIndex, toIndex); } PageInfo<WorkerGroup> pageInfo = new PageInfo<>(pageNo, pageSize); pageInfo.setTotalCount(resultDataList.size()); pageInfo.setLists(resultDataList); result.put(Constants.DATA_LIST, pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * query all worker group * * @return all worker group list
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,592
[Improvement][api] Worker group data returned incorrectly
![image](https://user-images.githubusercontent.com/55787491/105975589-16604400-60ca-11eb-91b8-83fd8568673e.png) ![image](https://user-images.githubusercontent.com/55787491/105975823-6212ed80-60ca-11eb-91a5-772c93a899bb.png) **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4592
https://github.com/apache/dolphinscheduler/pull/4620
658376ad363dcafafe1054f8babfc5bb5ffe60c0
afd201e6fa50700cf16aad2a292e61c4e5b6e5f9
"2021-01-27T10:06:43Z"
java
"2021-01-29T08:54:39Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java
*/ public Map<String, Object> queryAllGroup() { Map<String, Object> result = new HashMap<>(); List<WorkerGroup> workerGroups = getWorkerGroups(false); Set<String> availableWorkerGroupSet = workerGroups.stream() .map(workerGroup -> workerGroup.getName()) .collect(Collectors.toSet()); result.put(Constants.DATA_LIST, availableWorkerGroupSet); putMsg(result, Status.SUCCESS); return result; } /** * get worker groups * * @param isPaging whether paging * @return WorkerGroup list */ private List<WorkerGroup> getWorkerGroups(boolean isPaging) { String workerPath = zookeeperCachedOperator.getZookeeperConfig().getDsRoot() + Constants.ZOOKEEPER_DOLPHINSCHEDULER_WORKERS; List<WorkerGroup> workerGroups = new ArrayList<>(); List<String> workerGroupList; try { workerGroupList = zookeeperCachedOperator.getChildrenKeys(workerPath); } catch (Exception e) { if (e.getMessage().contains(NO_NODE_EXCEPTION_REGEX)) { if (isPaging) { return workerGroups; } else { WorkerGroup wg = new WorkerGroup();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,592
[Improvement][api] Worker group data returned incorrectly
![image](https://user-images.githubusercontent.com/55787491/105975589-16604400-60ca-11eb-91b8-83fd8568673e.png) ![image](https://user-images.githubusercontent.com/55787491/105975823-6212ed80-60ca-11eb-91a5-772c93a899bb.png) **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4592
https://github.com/apache/dolphinscheduler/pull/4620
658376ad363dcafafe1054f8babfc5bb5ffe60c0
afd201e6fa50700cf16aad2a292e61c4e5b6e5f9
"2021-01-27T10:06:43Z"
java
"2021-01-29T08:54:39Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java
wg.setName(DEFAULT_WORKER_GROUP); workerGroups.add(wg); return workerGroups; } } else { throw e; } } List<String> availableWorkerGroupList = new ArrayList<>(); for (String workerGroup : workerGroupList) { String workerGroupPath = workerPath + "/" + workerGroup; List<String> childrenNodes = zookeeperCachedOperator.getChildrenKeys(workerGroupPath); if (CollectionUtils.isNotEmpty(childrenNodes)) { availableWorkerGroupList.add(workerGroup); WorkerGroup wg = new WorkerGroup(); wg.setName(workerGroup); if (isPaging) { wg.setIpList(childrenNodes); String registeredIpValue = zookeeperCachedOperator.get(workerGroupPath + "/" + childrenNodes.get(0)); wg.setCreateTime(DateUtils.stringToDate(registeredIpValue.split(",")[6])); wg.setUpdateTime(DateUtils.stringToDate(registeredIpValue.split(",")[7])); } workerGroups.add(wg); } } return workerGroups; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,101
[BUG] After renaming the branch name, the name of Branch Flow does not change
更改任务名称后,分支流转的名称还是更改前的任务名称 ![image](https://user-images.githubusercontent.com/55787491/76071071-9e2ff200-5fd0-11ea-8702-e7b357d7b060.png) **Which version of Dolphin Scheduler:** -[1.2.0_release]
https://github.com/apache/dolphinscheduler/issues/2101
https://github.com/apache/dolphinscheduler/pull/4555
cfd9db5555b3d8f9f33f25a9272c8741115a9336
14d49bc584685a33e2952573a0cb6e88377ab9f9
"2020-03-06T09:35:19Z"
java
"2021-02-02T08:07:37Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.service; import static org.apache.dolphinscheduler.common.Constants.DATA_LIST; import static org.apache.dolphinscheduler.common.Constants.DEPENDENT_SPLIT; import static org.apache.dolphinscheduler.common.Constants.GLOBAL_PARAMS; import static org.apache.dolphinscheduler.common.Constants.LOCAL_PARAMS; import static org.apache.dolphinscheduler.common.Constants.PROCESS_INSTANCE_STATE; import static org.apache.dolphinscheduler.common.Constants.TASK_LIST;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,101
[BUG] After renaming the branch name, the name of Branch Flow does not change
更改任务名称后,分支流转的名称还是更改前的任务名称 ![image](https://user-images.githubusercontent.com/55787491/76071071-9e2ff200-5fd0-11ea-8702-e7b357d7b060.png) **Which version of Dolphin Scheduler:** -[1.2.0_release]
https://github.com/apache/dolphinscheduler/issues/2101
https://github.com/apache/dolphinscheduler/pull/4555
cfd9db5555b3d8f9f33f25a9272c8741115a9336
14d49bc584685a33e2952573a0cb6e88377ab9f9
"2020-03-06T09:35:19Z"
java
"2021-02-02T08:07:37Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java
import org.apache.dolphinscheduler.api.dto.gantt.GanttDto; import org.apache.dolphinscheduler.api.dto.gantt.Task; import org.apache.dolphinscheduler.api.enums.Status; 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.DependResult; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.Flag; import org.apache.dolphinscheduler.common.enums.TaskType; import org.apache.dolphinscheduler.common.graph.DAG; import org.apache.dolphinscheduler.common.model.TaskNode; import org.apache.dolphinscheduler.common.model.TaskNodeRelation; import org.apache.dolphinscheduler.common.process.ProcessDag; import org.apache.dolphinscheduler.common.process.Property; import org.apache.dolphinscheduler.common.utils.CollectionUtils; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.ParameterUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.common.utils.placeholder.BusinessTimeUtils; import org.apache.dolphinscheduler.dao.entity.ProcessData; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,101
[BUG] After renaming the branch name, the name of Branch Flow does not change
更改任务名称后,分支流转的名称还是更改前的任务名称 ![image](https://user-images.githubusercontent.com/55787491/76071071-9e2ff200-5fd0-11ea-8702-e7b357d7b060.png) **Which version of Dolphin Scheduler:** -[1.2.0_release]
https://github.com/apache/dolphinscheduler/issues/2101
https://github.com/apache/dolphinscheduler/pull/4555
cfd9db5555b3d8f9f33f25a9272c8741115a9336
14d49bc584685a33e2952573a0cb6e88377ab9f9
"2020-03-06T09:35:19Z"
java
"2021-02-02T08:07:37Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper; import org.apache.dolphinscheduler.dao.utils.DagHelper; import org.apache.dolphinscheduler.service.process.ProcessService; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.text.ParseException; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; 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; /** * process instance service */ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,101
[BUG] After renaming the branch name, the name of Branch Flow does not change
更改任务名称后,分支流转的名称还是更改前的任务名称 ![image](https://user-images.githubusercontent.com/55787491/76071071-9e2ff200-5fd0-11ea-8702-e7b357d7b060.png) **Which version of Dolphin Scheduler:** -[1.2.0_release]
https://github.com/apache/dolphinscheduler/issues/2101
https://github.com/apache/dolphinscheduler/pull/4555
cfd9db5555b3d8f9f33f25a9272c8741115a9336
14d49bc584685a33e2952573a0cb6e88377ab9f9
"2020-03-06T09:35:19Z"
java
"2021-02-02T08:07:37Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java
public class ProcessInstanceService extends BaseService { private static final Logger logger = LoggerFactory.getLogger(ProcessInstanceService.class); @Autowired ProjectMapper projectMapper; @Autowired ProjectService projectService; @Autowired ProcessService processService; @Autowired
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,101
[BUG] After renaming the branch name, the name of Branch Flow does not change
更改任务名称后,分支流转的名称还是更改前的任务名称 ![image](https://user-images.githubusercontent.com/55787491/76071071-9e2ff200-5fd0-11ea-8702-e7b357d7b060.png) **Which version of Dolphin Scheduler:** -[1.2.0_release]
https://github.com/apache/dolphinscheduler/issues/2101
https://github.com/apache/dolphinscheduler/pull/4555
cfd9db5555b3d8f9f33f25a9272c8741115a9336
14d49bc584685a33e2952573a0cb6e88377ab9f9
"2020-03-06T09:35:19Z"
java
"2021-02-02T08:07:37Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java
ProcessInstanceMapper processInstanceMapper; @Autowired ProcessDefinitionMapper processDefineMapper; @Autowired ProcessDefinitionService processDefinitionService; @Autowired ProcessDefinitionVersionService processDefinitionVersionService; @Autowired ExecutorService execService; @Autowired TaskInstanceMapper taskInstanceMapper; @Autowired LoggerService loggerService; @Autowired UsersService usersService; /** * return top n SUCCESS process instance order by running time which started between startTime and endTime */ public Map<String, Object> queryTopNLongestRunningProcessInstance(User loginUser, String projectName, int size, String startTime, String endTime) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultEnum = (Status) checkResult.get(Constants.STATUS); if (resultEnum != Status.SUCCESS) { return checkResult; } if (0 > size) { putMsg(result, Status.NEGTIVE_SIZE_NUMBER_ERROR, size); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,101
[BUG] After renaming the branch name, the name of Branch Flow does not change
更改任务名称后,分支流转的名称还是更改前的任务名称 ![image](https://user-images.githubusercontent.com/55787491/76071071-9e2ff200-5fd0-11ea-8702-e7b357d7b060.png) **Which version of Dolphin Scheduler:** -[1.2.0_release]
https://github.com/apache/dolphinscheduler/issues/2101
https://github.com/apache/dolphinscheduler/pull/4555
cfd9db5555b3d8f9f33f25a9272c8741115a9336
14d49bc584685a33e2952573a0cb6e88377ab9f9
"2020-03-06T09:35:19Z"
java
"2021-02-02T08:07:37Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java
if (Objects.isNull(startTime)) { putMsg(result, Status.DATA_IS_NULL, Constants.START_TIME); return result; } Date start = DateUtils.stringToDate(startTime); if (Objects.isNull(endTime)) { putMsg(result, Status.DATA_IS_NULL, Constants.END_TIME); return result; } Date end = DateUtils.stringToDate(endTime); if (start == null || end == null) { putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "startDate,endDate"); return result; } if (start.getTime() > end.getTime()) { putMsg(result, Status.START_TIME_BIGGER_THAN_END_TIME_ERROR, startTime, endTime); return result; } List<ProcessInstance> processInstances = processInstanceMapper.queryTopNProcessInstance(size, start, end, ExecutionStatus.SUCCESS); result.put(DATA_LIST, processInstances); putMsg(result, Status.SUCCESS); return result; } /** * query process instance by id * * @param loginUser login user * @param projectName project name * @param processId process instance id * @return process instance detail
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,101
[BUG] After renaming the branch name, the name of Branch Flow does not change
更改任务名称后,分支流转的名称还是更改前的任务名称 ![image](https://user-images.githubusercontent.com/55787491/76071071-9e2ff200-5fd0-11ea-8702-e7b357d7b060.png) **Which version of Dolphin Scheduler:** -[1.2.0_release]
https://github.com/apache/dolphinscheduler/issues/2101
https://github.com/apache/dolphinscheduler/pull/4555
cfd9db5555b3d8f9f33f25a9272c8741115a9336
14d49bc584685a33e2952573a0cb6e88377ab9f9
"2020-03-06T09:35:19Z"
java
"2021-02-02T08:07:37Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java
*/ public Map<String, Object> queryProcessInstanceById(User loginUser, String projectName, Integer processId) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultEnum = (Status) checkResult.get(Constants.STATUS); if (resultEnum != Status.SUCCESS) { return checkResult; } ProcessInstance processInstance = processService.findProcessInstanceDetailById(processId); ProcessDefinition processDefinition = processService.findProcessDefineById(processInstance.getProcessDefinitionId()); processInstance.setWarningGroupId(processDefinition.getWarningGroupId()); result.put(DATA_LIST, processInstance); putMsg(result, Status.SUCCESS); return result; } /** * paging query process instance list, filtering according to project, process definition, time range, keyword, process status * * @param loginUser login user * @param projectName project name * @param pageNo page number * @param pageSize page size * @param processDefineId process definition id * @param searchVal search value * @param stateType state type * @param host host * @param startDate start time * @param endDate end time * @return process instance list
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,101
[BUG] After renaming the branch name, the name of Branch Flow does not change
更改任务名称后,分支流转的名称还是更改前的任务名称 ![image](https://user-images.githubusercontent.com/55787491/76071071-9e2ff200-5fd0-11ea-8702-e7b357d7b060.png) **Which version of Dolphin Scheduler:** -[1.2.0_release]
https://github.com/apache/dolphinscheduler/issues/2101
https://github.com/apache/dolphinscheduler/pull/4555
cfd9db5555b3d8f9f33f25a9272c8741115a9336
14d49bc584685a33e2952573a0cb6e88377ab9f9
"2020-03-06T09:35:19Z"
java
"2021-02-02T08:07:37Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java
*/ public Map<String, Object> queryProcessInstanceList(User loginUser, String projectName, Integer processDefineId, String startDate, String endDate, String searchVal, String executorName, ExecutionStatus stateType, String host, Integer pageNo, Integer pageSize) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultEnum = (Status) checkResult.get(Constants.STATUS); if (resultEnum != Status.SUCCESS) { return checkResult; } int[] statusArray = null; if (stateType != null) { statusArray = new int[]{stateType.ordinal()}; } Date start = null; Date end = null; try { if (StringUtils.isNotEmpty(startDate)) { start = DateUtils.getScheduleDate(startDate); } if (StringUtils.isNotEmpty(endDate)) { end = DateUtils.getScheduleDate(endDate); } } catch (Exception e) { putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "startDate,endDate"); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,101
[BUG] After renaming the branch name, the name of Branch Flow does not change
更改任务名称后,分支流转的名称还是更改前的任务名称 ![image](https://user-images.githubusercontent.com/55787491/76071071-9e2ff200-5fd0-11ea-8702-e7b357d7b060.png) **Which version of Dolphin Scheduler:** -[1.2.0_release]
https://github.com/apache/dolphinscheduler/issues/2101
https://github.com/apache/dolphinscheduler/pull/4555
cfd9db5555b3d8f9f33f25a9272c8741115a9336
14d49bc584685a33e2952573a0cb6e88377ab9f9
"2020-03-06T09:35:19Z"
java
"2021-02-02T08:07:37Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java
Page<ProcessInstance> page = new Page<>(pageNo, pageSize); PageInfo pageInfo = new PageInfo<ProcessInstance>(pageNo, pageSize); int executorId = usersService.getUserIdByName(executorName); IPage<ProcessInstance> processInstanceList = processInstanceMapper.queryProcessInstanceListPaging(page, project.getId(), processDefineId, searchVal, executorId, statusArray, host, start, end); List<ProcessInstance> processInstances = processInstanceList.getRecords(); for (ProcessInstance processInstance : processInstances) { processInstance.setDuration(DateUtils.differSec(processInstance.getStartTime(), processInstance.getEndTime())); User executor = usersService.queryUser(processInstance.getExecutorId()); if (null != executor) { processInstance.setExecutorName(executor.getUserName()); } } pageInfo.setTotalCount((int) processInstanceList.getTotal()); pageInfo.setLists(processInstances); result.put(DATA_LIST, pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * query task list by process instance id * * @param loginUser login user * @param projectName project name * @param processId process instance id * @return task list for the process instance * @throws IOException io exception */ public Map<String, Object> queryTaskListByProcessId(User loginUser, String projectName, Integer processId) throws IOException {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,101
[BUG] After renaming the branch name, the name of Branch Flow does not change
更改任务名称后,分支流转的名称还是更改前的任务名称 ![image](https://user-images.githubusercontent.com/55787491/76071071-9e2ff200-5fd0-11ea-8702-e7b357d7b060.png) **Which version of Dolphin Scheduler:** -[1.2.0_release]
https://github.com/apache/dolphinscheduler/issues/2101
https://github.com/apache/dolphinscheduler/pull/4555
cfd9db5555b3d8f9f33f25a9272c8741115a9336
14d49bc584685a33e2952573a0cb6e88377ab9f9
"2020-03-06T09:35:19Z"
java
"2021-02-02T08:07:37Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java
Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultEnum = (Status) checkResult.get(Constants.STATUS); if (resultEnum != Status.SUCCESS) { return checkResult; } ProcessInstance processInstance = processService.findProcessInstanceDetailById(processId); List<TaskInstance> taskInstanceList = processService.findValidTaskListByProcessId(processId); addDependResultForTaskList(taskInstanceList); Map<String, Object> resultMap = new HashMap<>(); resultMap.put(PROCESS_INSTANCE_STATE, processInstance.getState().toString()); resultMap.put(TASK_LIST, taskInstanceList); result.put(DATA_LIST, resultMap); putMsg(result, Status.SUCCESS); return result; } /** * add dependent result for dependent task */ private void addDependResultForTaskList(List<TaskInstance> taskInstanceList) throws IOException { for (TaskInstance taskInstance : taskInstanceList) { if (taskInstance.getTaskType().equalsIgnoreCase(TaskType.DEPENDENT.toString())) { Result<String> logResult = loggerService.queryLog( taskInstance.getId(), 0, 4098); if (logResult.getCode() == Status.SUCCESS.ordinal()) { String log = logResult.getData(); Map<String, DependResult> resultMap = parseLogForDependentResult(log); taskInstance.setDependentResult(JSONUtils.toJsonString(resultMap)); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,101
[BUG] After renaming the branch name, the name of Branch Flow does not change
更改任务名称后,分支流转的名称还是更改前的任务名称 ![image](https://user-images.githubusercontent.com/55787491/76071071-9e2ff200-5fd0-11ea-8702-e7b357d7b060.png) **Which version of Dolphin Scheduler:** -[1.2.0_release]
https://github.com/apache/dolphinscheduler/issues/2101
https://github.com/apache/dolphinscheduler/pull/4555
cfd9db5555b3d8f9f33f25a9272c8741115a9336
14d49bc584685a33e2952573a0cb6e88377ab9f9
"2020-03-06T09:35:19Z"
java
"2021-02-02T08:07:37Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java
} } } public Map<String, DependResult> parseLogForDependentResult(String log) throws IOException { Map<String, DependResult> resultMap = new HashMap<>(); if (StringUtils.isEmpty(log)) { return resultMap; } BufferedReader br = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(log.getBytes( StandardCharsets.UTF_8)), StandardCharsets.UTF_8)); String line; while ((line = br.readLine()) != null) { if (line.contains(DEPENDENT_SPLIT)) { String[] tmpStringArray = line.split(":\\|\\|"); if (tmpStringArray.length != 2) { continue; } String dependResultString = tmpStringArray[1]; String[] dependStringArray = dependResultString.split(","); if (dependStringArray.length != 2) { continue; } String key = dependStringArray[0].trim(); DependResult dependResult = DependResult.valueOf(dependStringArray[1].trim()); resultMap.put(key, dependResult); } } return resultMap; } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,101
[BUG] After renaming the branch name, the name of Branch Flow does not change
更改任务名称后,分支流转的名称还是更改前的任务名称 ![image](https://user-images.githubusercontent.com/55787491/76071071-9e2ff200-5fd0-11ea-8702-e7b357d7b060.png) **Which version of Dolphin Scheduler:** -[1.2.0_release]
https://github.com/apache/dolphinscheduler/issues/2101
https://github.com/apache/dolphinscheduler/pull/4555
cfd9db5555b3d8f9f33f25a9272c8741115a9336
14d49bc584685a33e2952573a0cb6e88377ab9f9
"2020-03-06T09:35:19Z"
java
"2021-02-02T08:07:37Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java
* query sub process instance detail info by task id * * @param loginUser login user * @param projectName project name * @param taskId task id * @return sub process instance detail */ public Map<String, Object> querySubProcessInstanceByTaskId(User loginUser, String projectName, Integer taskId) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultEnum = (Status) checkResult.get(Constants.STATUS); if (resultEnum != Status.SUCCESS) { return checkResult; } TaskInstance taskInstance = processService.findTaskInstanceById(taskId); if (taskInstance == null) { putMsg(result, Status.TASK_INSTANCE_NOT_EXISTS, taskId); return result; } if (!taskInstance.isSubProcess()) { putMsg(result, Status.TASK_INSTANCE_NOT_SUB_WORKFLOW_INSTANCE, taskInstance.getName()); return result; } ProcessInstance subWorkflowInstance = processService.findSubProcessInstance( taskInstance.getProcessInstanceId(), taskInstance.getId()); if (subWorkflowInstance == null) { putMsg(result, Status.SUB_PROCESS_INSTANCE_NOT_EXIST, taskId); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,101
[BUG] After renaming the branch name, the name of Branch Flow does not change
更改任务名称后,分支流转的名称还是更改前的任务名称 ![image](https://user-images.githubusercontent.com/55787491/76071071-9e2ff200-5fd0-11ea-8702-e7b357d7b060.png) **Which version of Dolphin Scheduler:** -[1.2.0_release]
https://github.com/apache/dolphinscheduler/issues/2101
https://github.com/apache/dolphinscheduler/pull/4555
cfd9db5555b3d8f9f33f25a9272c8741115a9336
14d49bc584685a33e2952573a0cb6e88377ab9f9
"2020-03-06T09:35:19Z"
java
"2021-02-02T08:07:37Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java
Map<String, Object> dataMap = new HashMap<>(); dataMap.put("subProcessInstanceId", subWorkflowInstance.getId()); result.put(DATA_LIST, dataMap); putMsg(result, Status.SUCCESS); return result; } /** * update process instance * * @param loginUser login user * @param projectName project name * @param processInstanceJson process instance json * @param processInstanceId process instance id * @param scheduleTime schedule time * @param syncDefine sync define * @param flag flag * @param locations locations * @param connects connects * @return update result code * @throws ParseException parse exception for json parse */ public Map<String, Object> updateProcessInstance(User loginUser, String projectName, Integer processInstanceId, String processInstanceJson, String scheduleTime, Boolean syncDefine, Flag flag, String locations, String connects) throws ParseException { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultEnum = (Status) checkResult.get(Constants.STATUS); if (resultEnum != Status.SUCCESS) {