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
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
/** * download file * * @param resourceId resource id * @return resource content * @throws Exception exception */ public org.springframework.core.io.Resource downloadResource(int resourceId) throws Exception { if (!PropertyUtils.getResUploadStartupState()){ logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState()); throw new RuntimeException("hdfs not startup"); } Resource resource = resourcesMapper.selectById(resourceId); if (resource == null) { logger.error("download file not exist, resource id {}", resourceId); return null; } if (resource.isDirectory()) { logger.error("resource id {} is directory,can't download it", resourceId); throw new RuntimeException("cant't download directory"); } User user = userMapper.queryDetailsById(resource.getUserId()); String tenantCode = tenantMapper.queryById(user.getTenantId()).getTenantCode(); String hdfsFileName = HadoopUtils.getHdfsFileName(resource.getType(), tenantCode, resource.getAlias()); String localFileName = FileUtils.getDownloadFilename(resource.getAlias()); logger.info("resource hdfs path is {} ", hdfsFileName); HadoopUtils.getInstance().copyHdfsToLocal(hdfsFileName, localFileName, false, true); return org.apache.dolphinscheduler.api.utils.FileUtils.file2Resource(localFileName); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
/** * list all file * * @param loginUser login user * @param userId user id * @return unauthorized result code */ public Map<String, Object> authorizeResourceTree(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); if (checkAdmin(loginUser, result)) { return result; } List<Resource> resourceList = resourcesMapper.queryResourceExceptUserId(userId); List<ResourceComponent> list ; if (CollectionUtils.isNotEmpty(resourceList)) { Visitor visitor = new ResourceTreeVisitor(resourceList); list = visitor.visit().getChildren(); }else { list = new ArrayList<>(0); } result.put(Constants.DATA_LIST, list); putMsg(result,Status.SUCCESS); return result; } /** * unauthorized file * * @param loginUser login user * @param userId user id * @return unauthorized result code
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
*/ public Map<String, Object> unauthorizedFile(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); if (checkAdmin(loginUser, result)) { return result; } List<Resource> resourceList = resourcesMapper.queryResourceExceptUserId(userId); List<Resource> list ; if (resourceList != null && resourceList.size() > 0) { Set<Resource> resourceSet = new HashSet<>(resourceList); List<Resource> authedResourceList = resourcesMapper.queryAuthorizedResourceList(userId); getAuthorizedResourceList(resourceSet, authedResourceList); list = new ArrayList<>(resourceSet); }else { list = new ArrayList<>(0); } Visitor visitor = new ResourceTreeVisitor(list); result.put(Constants.DATA_LIST, visitor.visit().getChildren()); putMsg(result,Status.SUCCESS); return result; } /** * unauthorized udf function * * @param loginUser login user * @param userId user id * @return unauthorized result code */ public Map<String, Object> unauthorizedUDFFunction(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(5);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
if (checkAdmin(loginUser, result)) { return result; } List<UdfFunc> udfFuncList = udfFunctionMapper.queryUdfFuncExceptUserId(userId); List<UdfFunc> resultList = new ArrayList<>(); Set<UdfFunc> udfFuncSet = null; if (CollectionUtils.isNotEmpty(udfFuncList)) { udfFuncSet = new HashSet<>(udfFuncList); List<UdfFunc> authedUDFFuncList = udfFunctionMapper.queryAuthedUdfFunc(userId); getAuthorizedResourceList(udfFuncSet, authedUDFFuncList); resultList = new ArrayList<>(udfFuncSet); } result.put(Constants.DATA_LIST, resultList); putMsg(result,Status.SUCCESS); return result; } /** * authorized udf function * * @param loginUser login user * @param userId user id * @return authorized result code */ public Map<String, Object> authorizedUDFFunction(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); if (checkAdmin(loginUser, result)) { return result; } List<UdfFunc> udfFuncs = udfFunctionMapper.queryAuthedUdfFunc(userId);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
result.put(Constants.DATA_LIST, udfFuncs); putMsg(result,Status.SUCCESS); return result; } /** * authorized file * * @param loginUser login user * @param userId user id * @return authorized result */ public Map<String, Object> authorizedFile(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(5); if (checkAdmin(loginUser, result)){ return result; } List<Resource> authedResources = resourcesMapper.queryAuthorizedResourceList(userId); Visitor visitor = new ResourceTreeVisitor(authedResources); logger.info(JSON.toJSONString(visitor.visit(), SerializerFeature.SortField)); String jsonTreeStr = JSON.toJSONString(visitor.visit().getChildren(), SerializerFeature.SortField); logger.info(jsonTreeStr); result.put(Constants.DATA_LIST, visitor.visit().getChildren()); putMsg(result,Status.SUCCESS); return result; } /** * get authorized resource list * * @param resourceSet resource set * @param authedResourceList authorized resource list
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
*/ private void getAuthorizedResourceList(Set<?> resourceSet, List<?> authedResourceList) { Set<?> authedResourceSet = null; if (CollectionUtils.isNotEmpty(authedResourceList)) { authedResourceSet = new HashSet<>(authedResourceList); resourceSet.removeAll(authedResourceSet); } } /** * get tenantCode by UserId * * @param userId user id * @param result return result * @return */ private String getTenantCode(int userId,Result result){ User user = userMapper.queryDetailsById(userId); if(user == null){ logger.error("user {} not exists", userId); putMsg(result, Status.USER_NOT_EXIST,userId); return null; } Tenant tenant = tenantMapper.queryById(user.getTenantId()); if (tenant == null){ logger.error("tenant not exists"); putMsg(result, Status.TENANT_NOT_EXIST); return null; } return tenant.getTenantCode(); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
/** * list all children id * @param resource resource * @param containSelf whether add self to children list * @return all children id */ List<Integer> listAllChildren(Resource resource,boolean containSelf){ List<Integer> childList = new ArrayList<>(); if (resource.getId() != -1 && containSelf) { childList.add(resource.getId()); } if(resource.isDirectory()){ listAllChildren(resource.getId(),childList); } return childList; } /** * list all children id * @param resourceId resource id * @param childList child list */ void listAllChildren(int resourceId,List<Integer> childList){ List<Integer> children = resourcesMapper.listChildren(resourceId); for(int chlidId:children){ childList.add(chlidId); listAllChildren(chlidId,childList); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.utils.PageInfo;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ResourceType; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.utils.*; import org.apache.dolphinscheduler.dao.entity.Resource; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.UdfFunc; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.*; 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.omg.CORBA.Any; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.mock.web.MockMultipartFile; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; @RunWith(PowerMockRunner.class)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
@PowerMockIgnore({"sun.security.*", "javax.net.*"}) @PrepareForTest({HadoopUtils.class,PropertyUtils.class, FileUtils.class,org.apache.dolphinscheduler.api.utils.FileUtils.class}) public class ResourcesServiceTest { private static final Logger logger = LoggerFactory.getLogger(ResourcesServiceTest.class); @InjectMocks private ResourcesService resourcesService; @Mock private ResourceMapper resourcesMapper; @Mock private TenantMapper tenantMapper; @Mock private ResourceUserMapper resourceUserMapper; @Mock private HadoopUtils hadoopUtils; @Mock private UserMapper userMapper; @Mock private UdfFuncMapper udfFunctionMapper; @Mock
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
private ProcessDefinitionMapper processDefinitionMapper; @Before public void setUp() { PowerMockito.mockStatic(HadoopUtils.class); PowerMockito.mockStatic(FileUtils.class); PowerMockito.mockStatic(org.apache.dolphinscheduler.api.utils.FileUtils.class); try { PowerMockito.whenNew(HadoopUtils.class).withNoArguments().thenReturn(hadoopUtils); } catch (Exception e) { e.printStackTrace(); } PowerMockito.when(HadoopUtils.getInstance()).thenReturn(hadoopUtils); PowerMockito.mockStatic(PropertyUtils.class); } @Test public void testCreateResource(){ PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(false); User user = new User(); Result result = resourcesService.createResource(user,"ResourcesServiceTest","ResourcesServiceTest",ResourceType.FILE,null,-1,"/"); logger.info(result.toString()); Assert.assertEquals(Status.HDFS_NOT_STARTUP.getMsg(),result.getMsg()); MockMultipartFile mockMultipartFile = new MockMultipartFile("test.pdf",new String().getBytes()); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); result = resourcesService.createResource(user,"ResourcesServiceTest","ResourcesServiceTest",ResourceType.FILE,mockMultipartFile,-1,"/"); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_FILE_IS_EMPTY.getMsg(),result.getMsg());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
mockMultipartFile = new MockMultipartFile("test.pdf","test.pdf","pdf",new String("test").getBytes()); PowerMockito.when(FileUtils.suffix("test.pdf")).thenReturn("pdf"); PowerMockito.when(FileUtils.suffix("ResourcesServiceTest.jar")).thenReturn("jar"); result = resourcesService.createResource(user,"ResourcesServiceTest.jar","ResourcesServiceTest",ResourceType.FILE,mockMultipartFile,-1,"/"); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_SUFFIX_FORBID_CHANGE.getMsg(),result.getMsg()); mockMultipartFile = new MockMultipartFile("ResourcesServiceTest.pdf","ResourcesServiceTest.pdf","pdf",new String("test").getBytes()); PowerMockito.when(FileUtils.suffix("ResourcesServiceTest.pdf")).thenReturn("pdf"); result = resourcesService.createResource(user,"ResourcesServiceTest.pdf","ResourcesServiceTest",ResourceType.UDF,mockMultipartFile,-1,"/"); logger.info(result.toString()); Assert.assertEquals(Status.UDF_RESOURCE_SUFFIX_NOT_JAR.getMsg(),result.getMsg()); } @Test public void testCreateDirecotry(){ PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(false); User user = new User(); Result result = resourcesService.createDirectory(user,"directoryTest","directory test",ResourceType.FILE,-1,"/"); logger.info(result.toString()); Assert.assertEquals(Status.HDFS_NOT_STARTUP.getMsg(),result.getMsg()); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); Mockito.when(resourcesMapper.selectById(Mockito.anyInt())).thenReturn(null); result = resourcesService.createDirectory(user,"directoryTest","directory test",ResourceType.FILE,1,"/"); logger.info(result.toString()); Assert.assertEquals(Status.PARENT_RESOURCE_NOT_EXIST.getMsg(),result.getMsg()); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); Mockito.when(resourcesMapper.queryResourceList("/directoryTest", 0, 0)).thenReturn(getResourceList());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
result = resourcesService.createDirectory(user,"directoryTest","directory test",ResourceType.FILE,-1,"/"); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_EXIST.getMsg(),result.getMsg()); } @Test public void testUpdateResource(){ PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(false); User user = new User(); Result result = resourcesService.updateResource(user,1,"ResourcesServiceTest","ResourcesServiceTest",ResourceType.FILE); logger.info(result.toString()); Assert.assertEquals(Status.HDFS_NOT_STARTUP.getMsg(),result.getMsg()); Mockito.when(resourcesMapper.selectById(1)).thenReturn(getResource()); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); result = resourcesService.updateResource(user,0,"ResourcesServiceTest","ResourcesServiceTest",ResourceType.FILE); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_NOT_EXIST.getMsg(),result.getMsg()); result = resourcesService.updateResource(user,1,"ResourcesServiceTest","ResourcesServiceTest",ResourceType.FILE); logger.info(result.toString()); Assert.assertEquals(Status.USER_NO_OPERATION_PERM.getMsg(),result.getMsg()); user.setId(1); Mockito.when(userMapper.queryDetailsById(1)).thenReturn(getUser()); Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant()); result = resourcesService.updateResource(user,1,"ResourcesServiceTest.jar","ResourcesServiceTest",ResourceType.FILE); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS.getMsg(),result.getMsg());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
Mockito.when(resourcesMapper.queryResourceList("/ResourcesServiceTest1.jar", 0, 0)).thenReturn(getResourceList()); result = resourcesService.updateResource(user,1,"ResourcesServiceTest1.jar","ResourcesServiceTest",ResourceType.FILE); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_EXIST.getMsg(),result.getMsg()); Mockito.when(userMapper.queryDetailsById(Mockito.anyInt())).thenReturn(null); result = resourcesService.updateResource(user,1,"ResourcesServiceTest1.jar","ResourcesServiceTest",ResourceType.UDF); logger.info(result.toString()); Assert.assertTrue(Status.USER_NOT_EXIST.getCode() == result.getCode()); Mockito.when(userMapper.queryDetailsById(1)).thenReturn(getUser()); Mockito.when(tenantMapper.queryById(Mockito.anyInt())).thenReturn(null); result = resourcesService.updateResource(user,1,"ResourcesServiceTest1.jar","ResourcesServiceTest",ResourceType.UDF); logger.info(result.toString()); Assert.assertEquals(Status.TENANT_NOT_EXIST.getMsg(),result.getMsg()); Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant()); PowerMockito.when(HadoopUtils.getHdfsResourceFileName(Mockito.any(), Mockito.any())).thenReturn("test1"); try { Mockito.when(hadoopUtils.exists("test")).thenReturn(true); } catch (IOException e) { e.printStackTrace(); } result = resourcesService.updateResource(user,1,"ResourcesServiceTest1.jar","ResourcesServiceTest",ResourceType.UDF); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_NOT_EXIST.getMsg(),result.getMsg()); PowerMockito.when(HadoopUtils.getHdfsResourceFileName(Mockito.any(), Mockito.any())).thenReturn("test"); result = resourcesService.updateResource(user,1,"ResourcesServiceTest1.jar","ResourcesServiceTest1.jar",ResourceType.UDF); logger.info(result.toString());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
Assert.assertEquals(Status.SUCCESS.getMsg(),result.getMsg()); } @Test public void testQueryResourceListPaging(){ User loginUser = new User(); loginUser.setUserType(UserType.ADMIN_USER); IPage<Resource> resourcePage = new Page<>(1,10); resourcePage.setTotal(1); resourcePage.setRecords(getResourceList()); Mockito.when(resourcesMapper.queryResourcePaging(Mockito.any(Page.class), Mockito.eq(0),Mockito.eq(-1), Mockito.eq(0), Mockito.eq("test"))).thenReturn(resourcePage); Map<String, Object> result = resourcesService.queryResourceListPaging(loginUser,-1,ResourceType.FILE,"test",1,10); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); PageInfo pageInfo = (PageInfo) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(pageInfo.getLists())); } @Test public void testQueryResourceList(){ User loginUser = new User(); loginUser.setId(0); loginUser.setUserType(UserType.ADMIN_USER); Mockito.when(resourcesMapper.queryResourceListAuthored(0, 0,0)).thenReturn(getResourceList()); Map<String, Object> result = resourcesService.queryResourceList(loginUser, ResourceType.FILE); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); List<Resource> resourceList = (List<Resource>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(resourceList)); } @Test
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
public void testDelete(){ User loginUser = new User(); loginUser.setId(0); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(false); Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant()); try { Result result = resourcesService.delete(loginUser,1); logger.info(result.toString()); Assert.assertEquals(Status.HDFS_NOT_STARTUP.getMsg(), result.getMsg()); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); Mockito.when(resourcesMapper.selectById(1)).thenReturn(getResource()); result = resourcesService.delete(loginUser,2); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_NOT_EXIST.getMsg(), result.getMsg()); result = resourcesService.delete(loginUser,2); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_NOT_EXIST.getMsg(), result.getMsg()); loginUser.setUserType(UserType.ADMIN_USER); loginUser.setTenantId(2); Mockito.when(userMapper.queryDetailsById(Mockito.anyInt())).thenReturn(loginUser); result = resourcesService.delete(loginUser,1); logger.info(result.toString()); Assert.assertEquals(Status.TENANT_NOT_EXIST.getMsg(), result.getMsg()); loginUser.setTenantId(1); Mockito.when(hadoopUtils.delete(Mockito.anyString(), Mockito.anyBoolean())).thenReturn(true);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
result = resourcesService.delete(loginUser,1); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS.getMsg(), result.getMsg()); } catch (Exception e) { logger.error("delete error",e); Assert.assertTrue(false); } } @Test public void testVerifyResourceName(){ User user = new User(); user.setId(1); Mockito.when(resourcesMapper.queryResourceList("/ResourcesServiceTest.jar", 0, 0)).thenReturn(getResourceList()); Result result = resourcesService.verifyResourceName("/ResourcesServiceTest.jar",ResourceType.FILE,user); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_EXIST.getMsg(), result.getMsg()); Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant()); String unExistFullName = "/test.jar"; try { Mockito.when(hadoopUtils.exists(unExistFullName)).thenReturn(false); } catch (IOException e) { logger.error("hadoop error",e); } result = resourcesService.verifyResourceName("/test.jar",ResourceType.FILE,user); logger.info(result.toString()); Assert.assertEquals(Status.TENANT_NOT_EXIST.getMsg(), result.getMsg()); user.setTenantId(1); try {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
Mockito.when(hadoopUtils.exists("test")).thenReturn(true); } catch (IOException e) { logger.error("hadoop error",e); } PowerMockito.when(HadoopUtils.getHdfsResourceFileName("123", "test1")).thenReturn("test"); result = resourcesService.verifyResourceName("/ResourcesServiceTest.jar",ResourceType.FILE,user); logger.info(result.toString()); Assert.assertTrue(Status.RESOURCE_EXIST.getCode()==result.getCode()); result = resourcesService.verifyResourceName("test2",ResourceType.FILE,user); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS.getMsg(), result.getMsg()); } @Test public void testReadResource(){ PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(false); Result result = resourcesService.readResource(1,1,10); logger.info(result.toString()); Assert.assertEquals(Status.HDFS_NOT_STARTUP.getMsg(),result.getMsg()); Mockito.when(resourcesMapper.selectById(1)).thenReturn(getResource()); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); result = resourcesService.readResource(2,1,10); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_NOT_EXIST.getMsg(),result.getMsg()); PowerMockito.when(FileUtils.getResourceViewSuffixs()).thenReturn("class"); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); result = resourcesService.readResource(1,1,10);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_SUFFIX_NOT_SUPPORT_VIEW.getMsg(),result.getMsg()); PowerMockito.when(FileUtils.getResourceViewSuffixs()).thenReturn("jar"); PowerMockito.when(FileUtils.suffix("ResourcesServiceTest.jar")).thenReturn("jar"); result = resourcesService.readResource(1,1,10); logger.info(result.toString()); Assert.assertTrue(Status.USER_NOT_EXIST.getCode()==result.getCode()); Mockito.when(userMapper.queryDetailsById(1)).thenReturn(getUser()); result = resourcesService.readResource(1,1,10); logger.info(result.toString()); Assert.assertEquals(Status.TENANT_NOT_EXIST.getMsg(),result.getMsg()); Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant()); try { Mockito.when(hadoopUtils.exists(Mockito.anyString())).thenReturn(false); } catch (IOException e) { logger.error("hadoop error",e); } result = resourcesService.readResource(1,1,10); logger.info(result.toString()); Assert.assertTrue(Status.RESOURCE_FILE_NOT_EXIST.getCode()==result.getCode()); try { Mockito.when(hadoopUtils.exists(null)).thenReturn(true); Mockito.when(hadoopUtils.catFile(null,1,10)).thenReturn(getContent()); } catch (IOException e) { logger.error("hadoop error",e); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
result = resourcesService.readResource(1,1,10); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS.getMsg(),result.getMsg()); } @Test public void testOnlineCreateResource() { PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(false); PowerMockito.when(HadoopUtils.getHdfsResDir("hdfsdDir")).thenReturn("hdfsDir"); PowerMockito.when(HadoopUtils.getHdfsUdfDir("udfDir")).thenReturn("udfDir"); User user = getUser(); Result result = resourcesService.onlineCreateResource(user,ResourceType.FILE,"test","jar","desc","content",-1,"/"); logger.info(result.toString()); Assert.assertEquals(Status.HDFS_NOT_STARTUP.getMsg(),result.getMsg()); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); PowerMockito.when(FileUtils.getResourceViewSuffixs()).thenReturn("class"); result = resourcesService.onlineCreateResource(user,ResourceType.FILE,"test","jar","desc","content",-1,"/"); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_SUFFIX_NOT_SUPPORT_VIEW.getMsg(),result.getMsg()); try { PowerMockito.when(FileUtils.getResourceViewSuffixs()).thenReturn("jar"); Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant()); result = resourcesService.onlineCreateResource(user, ResourceType.FILE, "test", "jar", "desc", "content",-1,"/"); }catch (RuntimeException ex){ logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_NOT_EXIST.getMsg(), ex.getMessage()); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
Mockito.when(FileUtils.getUploadFilename(Mockito.anyString(), Mockito.anyString())).thenReturn("test"); PowerMockito.when(FileUtils.writeContent2File(Mockito.anyString(), Mockito.anyString())).thenReturn(true); result = resourcesService.onlineCreateResource(user,ResourceType.FILE,"test","jar","desc","content",-1,"/"); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS.getMsg(),result.getMsg()); } @Test public void testUpdateResourceContent(){ User loginUser = new User(); loginUser.setId(0); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(false); Result result = resourcesService.updateResourceContent(1,"content"); logger.info(result.toString()); Assert.assertEquals(Status.HDFS_NOT_STARTUP.getMsg(), result.getMsg()); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); Mockito.when(resourcesMapper.selectById(1)).thenReturn(getResource()); result = resourcesService.updateResourceContent(2,"content"); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_NOT_EXIST.getMsg(), result.getMsg()); PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); PowerMockito.when(FileUtils.getResourceViewSuffixs()).thenReturn("class"); result = resourcesService.updateResourceContent(1,"content"); logger.info(result.toString()); Assert.assertEquals(Status.RESOURCE_SUFFIX_NOT_SUPPORT_VIEW.getMsg(),result.getMsg()); PowerMockito.when(FileUtils.getResourceViewSuffixs()).thenReturn("jar"); PowerMockito.when(FileUtils.suffix("ResourcesServiceTest.jar")).thenReturn("jar");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
result = resourcesService.updateResourceContent(1,"content"); logger.info(result.toString()); Assert.assertTrue(Status.USER_NOT_EXIST.getCode() == result.getCode()); Mockito.when(userMapper.queryDetailsById(1)).thenReturn(getUser()); result = resourcesService.updateResourceContent(1,"content"); logger.info(result.toString()); Assert.assertTrue(Status.TENANT_NOT_EXIST.getCode() == result.getCode()); Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant()); Mockito.when(FileUtils.getUploadFilename(Mockito.anyString(), Mockito.anyString())).thenReturn("test"); PowerMockito.when(FileUtils.writeContent2File(Mockito.anyString(), Mockito.anyString())).thenReturn(true); result = resourcesService.updateResourceContent(1,"content"); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS.getMsg(), result.getMsg()); } @Test public void testDownloadResource(){ PowerMockito.when(PropertyUtils.getResUploadStartupState()).thenReturn(true); Mockito.when(tenantMapper.queryById(1)).thenReturn(getTenant()); Mockito.when(userMapper.queryDetailsById(1)).thenReturn(getUser()); org.springframework.core.io.Resource resourceMock = Mockito.mock(org.springframework.core.io.Resource.class); try { org.springframework.core.io.Resource resource = resourcesService.downloadResource(1); Assert.assertNull(resource); Mockito.when(resourcesMapper.selectById(1)).thenReturn(getResource()); PowerMockito.when(org.apache.dolphinscheduler.api.utils.FileUtils.file2Resource(Mockito.any())).thenReturn(resourceMock); resource = resourcesService.downloadResource(1); Assert.assertNotNull(resource);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
} catch (Exception e) { logger.error("DownloadResource error",e); Assert.assertTrue(false); } } @Test public void testUnauthorizedFile(){ User user = getUser(); Map<String, Object> result = resourcesService.unauthorizedFile(user,1); logger.info(result.toString()); Assert.assertEquals(Status.USER_NO_OPERATION_PERM,result.get(Constants.STATUS)); user.setUserType(UserType.ADMIN_USER); Mockito.when(resourcesMapper.queryResourceExceptUserId(1)).thenReturn(getResourceList()); result = resourcesService.unauthorizedFile(user,1); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS,result.get(Constants.STATUS)); List<Resource> resources = (List<Resource>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(resources)); } @Test public void testUnauthorizedUDFFunction(){ User user = getUser(); Map<String, Object> result = resourcesService.unauthorizedUDFFunction(user,1); logger.info(result.toString()); Assert.assertEquals(Status.USER_NO_OPERATION_PERM,result.get(Constants.STATUS)); user.setUserType(UserType.ADMIN_USER);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
Mockito.when(udfFunctionMapper.queryUdfFuncExceptUserId(1)).thenReturn(getUdfFuncList()); result = resourcesService.unauthorizedUDFFunction(user,1); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS,result.get(Constants.STATUS)); List<UdfFunc> udfFuncs = (List<UdfFunc>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(udfFuncs)); } @Test public void testAuthorizedUDFFunction(){ User user = getUser(); Map<String, Object> result = resourcesService.authorizedUDFFunction(user,1); logger.info(result.toString()); Assert.assertEquals(Status.USER_NO_OPERATION_PERM,result.get(Constants.STATUS)); user.setUserType(UserType.ADMIN_USER); Mockito.when(udfFunctionMapper.queryAuthedUdfFunc(1)).thenReturn(getUdfFuncList()); result = resourcesService.authorizedUDFFunction(user,1); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS,result.get(Constants.STATUS)); List<UdfFunc> udfFuncs = (List<UdfFunc>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(udfFuncs)); } @Test public void testAuthorizedFile(){ User user = getUser(); Map<String, Object> result = resourcesService.authorizedFile(user,1); logger.info(result.toString()); Assert.assertEquals(Status.USER_NO_OPERATION_PERM,result.get(Constants.STATUS));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
user.setUserType(UserType.ADMIN_USER); Mockito.when(resourcesMapper.queryAuthorizedResourceList(1)).thenReturn(getResourceList()); result = resourcesService.authorizedFile(user,1); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS,result.get(Constants.STATUS)); List<Resource> resources = (List<Resource>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(resources)); } private List<Resource> getResourceList(){ List<Resource> resources = new ArrayList<>(); resources.add(getResource()); return resources; } private Tenant getTenant() { Tenant tenant = new Tenant(); tenant.setTenantCode("123"); return tenant; } private Resource getResource(){ Resource resource = new Resource(); resource.setPid(-1); resource.setUserId(1); resource.setDescription("ResourcesServiceTest.jar"); resource.setAlias("ResourcesServiceTest.jar"); resource.setFullName("/ResourcesServiceTest.jar"); resource.setType(ResourceType.FILE); return resource; } private Resource getUdfResource(){
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,442
[BUG] update the directory of resource is error
update the directory occasionally appears the resource file does't exist, and the actual update directory is successful ![image](https://user-images.githubusercontent.com/55787491/79429815-9feecb80-7ffa-11ea-9c00-41e88eed05e9.png) ![image](https://user-images.githubusercontent.com/55787491/79429960-cd3b7980-7ffa-11ea-958e-32cefebfeffe.png) ![image](https://user-images.githubusercontent.com/55787491/79430009-e17f7680-7ffa-11ea-91ea-87c9d91237b1.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/2442
https://github.com/apache/dolphinscheduler/pull/2524
c50ad1240c4789403e9518c855c0217fc9030b5b
e6dec8d2a7a6d39280675d225ec818e0cc7012be
"2020-04-16T08:01:56Z"
java
"2020-04-27T06:16:21Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ResourcesServiceTest.java
Resource resource = new Resource(); resource.setUserId(1); resource.setDescription("udfTest"); resource.setAlias("udfTest.jar"); resource.setFullName("/udfTest.jar"); resource.setType(ResourceType.UDF); return resource; } private UdfFunc getUdfFunc(){ UdfFunc udfFunc = new UdfFunc(); udfFunc.setId(1); return udfFunc; } private List<UdfFunc> getUdfFuncList(){ List<UdfFunc> udfFuncs = new ArrayList<>(); udfFuncs.add(getUdfFunc()); return udfFuncs; } private User getUser(){ User user = new User(); user.setId(1); user.setTenantId(1); return user; } private List<String> getContent(){ List<String> contentList = new ArrayList<>(); contentList.add("test"); return contentList; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.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
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
* * 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 com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fasterxml.jackson.core.JsonProcessingException; import org.apache.dolphinscheduler.api.dto.ProcessMeta; import org.apache.dolphinscheduler.api.dto.treeview.Instance; import org.apache.dolphinscheduler.api.dto.treeview.TreeViewDto; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.utils.CheckUtils; import org.apache.dolphinscheduler.api.utils.FileUtils; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.exportprocess.ProcessAddTaskParam; import org.apache.dolphinscheduler.api.utils.exportprocess.TaskNodeParamFactory; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.*; import org.apache.dolphinscheduler.common.graph.DAG; import org.apache.dolphinscheduler.common.model.TaskNode; import org.apache.dolphinscheduler.common.model.TaskNodeRelation;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
import org.apache.dolphinscheduler.common.process.ProcessDag; import org.apache.dolphinscheduler.common.process.Property; import org.apache.dolphinscheduler.common.task.AbstractParameters; import org.apache.dolphinscheduler.common.thread.Stopper; import org.apache.dolphinscheduler.common.utils.*; import org.apache.dolphinscheduler.dao.entity.*; import org.apache.dolphinscheduler.dao.mapper.*; import org.apache.dolphinscheduler.dao.utils.DagHelper; import org.apache.dolphinscheduler.service.permission.PermissionCheck; import org.apache.dolphinscheduler.service.process.ProcessService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.BufferedOutputStream; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_SUB_PROCESS_DEFINE_ID; /** * process definition service */ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
public class ProcessDefinitionService extends BaseDAGService { private static final Logger logger = LoggerFactory.getLogger(ProcessDefinitionService.class); @Autowired private ProjectMapper projectMapper; @Autowired private ProjectService projectService; @Autowired private ProcessDefinitionMapper processDefineMapper; @Autowired private ProcessInstanceMapper processInstanceMapper; @Autowired private TaskInstanceMapper taskInstanceMapper; @Autowired private ScheduleMapper scheduleMapper; @Autowired private ProcessService processService; @Autowired private WorkerGroupMapper workerGroupMapper; /** * create process definition * * @param loginUser login user * @param projectName project name * @param name process definition name * @param processDefinitionJson process definition json * @param desc description * @param locations locations for nodes * @param connects connects for nodes
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
* @return create result code * @throws JsonProcessingException JsonProcessingException */ public Map<String, Object> createProcessDefinition(User loginUser, String projectName, String name, String processDefinitionJson, String desc, String locations, String connects) throws JsonProcessingException { Map<String, Object> result = new HashMap<>(5); 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; } ProcessDefinition processDefine = new ProcessDefinition(); Date now = new Date(); ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class); Map<String, Object> checkProcessJson = checkProcessNodeList(processData, processDefinitionJson); if (checkProcessJson.get(Constants.STATUS) != Status.SUCCESS) { return checkProcessJson; } processDefine.setName(name); processDefine.setReleaseState(ReleaseState.OFFLINE); processDefine.setProjectId(project.getId()); processDefine.setUserId(loginUser.getId()); processDefine.setProcessDefinitionJson(processDefinitionJson);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
processDefine.setDescription(desc); processDefine.setLocations(locations); processDefine.setConnects(connects); processDefine.setTimeout(processData.getTimeout()); processDefine.setTenantId(processData.getTenantId()); processDefine.setModifyBy(loginUser.getUserName()); processDefine.setResourceIds(getResourceIds(processData)); List<Property> globalParamsList = processData.getGlobalParams(); if (CollectionUtils.isNotEmpty(globalParamsList)) { Set<Property> globalParamsSet = new HashSet<>(globalParamsList); globalParamsList = new ArrayList<>(globalParamsSet); processDefine.setGlobalParamList(globalParamsList); } processDefine.setCreateTime(now); processDefine.setUpdateTime(now); processDefine.setFlag(Flag.YES); processDefineMapper.insert(processDefine); putMsg(result, Status.SUCCESS); result.put("processDefinitionId",processDefine.getId()); return result; } /** * get resource ids * @param processData process data * @return resource ids */ private String getResourceIds(ProcessData processData) { List<TaskNode> tasks = processData.getTasks(); Set<Integer> resourceIds = new HashSet<>();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
for(TaskNode taskNode : tasks){ String taskParameter = taskNode.getParams(); AbstractParameters params = TaskParametersUtils.getParameters(taskNode.getType(),taskParameter); if (CollectionUtils.isNotEmpty(params.getResourceFilesList())) { Set<Integer> tempSet = params.getResourceFilesList().stream().map(t->t.getId()).collect(Collectors.toSet()); resourceIds.addAll(tempSet); } } StringBuilder sb = new StringBuilder(); for(int i : resourceIds) { if (sb.length() > 0) { sb.append(","); } sb.append(i); } return sb.toString(); } /** * query process definition list * * @param loginUser login user * @param projectName project name * @return definition list */ public Map<String, Object> queryProcessDefinitionList(User loginUser, String projectName) { HashMap<String, Object> result = new HashMap<>(5); 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) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
return checkResult; } List<ProcessDefinition> resourceList = processDefineMapper.queryAllDefinitionList(project.getId()); result.put(Constants.DATA_LIST, resourceList); putMsg(result, Status.SUCCESS); return result; } /** * query process definition list paging * * @param loginUser login user * @param projectName project name * @param searchVal search value * @param pageNo page number * @param pageSize page size * @param userId user id * @return process definition page */ public Map<String, Object> queryProcessDefinitionListPaging(User loginUser, String projectName, String searchVal, Integer pageNo, Integer pageSize, Integer userId) { Map<String, Object> result = new HashMap<>(5); 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; } Page<ProcessDefinition> page = new Page(pageNo, pageSize); IPage<ProcessDefinition> processDefinitionIPage = processDefineMapper.queryDefineListPaging( page, searchVal, userId, project.getId(),isAdmin(loginUser)); PageInfo pageInfo = new PageInfo<ProcessData>(pageNo, pageSize);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
pageInfo.setTotalCount((int)processDefinitionIPage.getTotal()); pageInfo.setLists(processDefinitionIPage.getRecords()); result.put(Constants.DATA_LIST, pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * query datail of process definition * * @param loginUser login user * @param projectName project name * @param processId process definition id * @return process definition detail */ public Map<String, Object> queryProcessDefinitionById(User loginUser, String projectName, Integer processId) { Map<String, Object> result = new HashMap<>(5); 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; } ProcessDefinition processDefinition = processDefineMapper.selectById(processId); if (processDefinition == null) { putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, processId); } else { result.put(Constants.DATA_LIST, processDefinition); putMsg(result, Status.SUCCESS); } return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
} /** * copy process definition * * @param loginUser login user * @param projectName project name * @param processId process definition id * @return copy result code */ public Map<String, Object> copyProcessDefinition(User loginUser, String projectName, Integer processId) throws JsonProcessingException{ Map<String, Object> result = new HashMap<>(5); 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; } ProcessDefinition processDefinition = processDefineMapper.selectById(processId); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId); return result; } else { return createProcessDefinition( loginUser, projectName, processDefinition.getName()+"_copy_"+System.currentTimeMillis(), processDefinition.getProcessDefinitionJson(), processDefinition.getDescription(), processDefinition.getLocations(), processDefinition.getConnects());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
} } /** * update process definition * * @param loginUser login user * @param projectName project name * @param name process definition name * @param id process definition id * @param processDefinitionJson process definition json * @param desc description * @param locations locations for nodes * @param connects connects for nodes * @return update result code */ public Map<String, Object> updateProcessDefinition(User loginUser, String projectName, int id, String name, String processDefinitionJson, String desc, String locations, String connects) { Map<String, Object> result = new HashMap<>(5); 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; } ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class); Map<String, Object> checkProcessJson = checkProcessNodeList(processData, processDefinitionJson); if ((checkProcessJson.get(Constants.STATUS) != Status.SUCCESS)) { return checkProcessJson; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
ProcessDefinition processDefine = processService.findProcessDefineById(id); if (processDefine == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, id); return result; } else if (processDefine.getReleaseState() == ReleaseState.ONLINE) { putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefine.getName()); return result; } else { putMsg(result, Status.SUCCESS); } Date now = new Date(); processDefine.setId(id); processDefine.setName(name); processDefine.setReleaseState(ReleaseState.OFFLINE); processDefine.setProjectId(project.getId()); processDefine.setProcessDefinitionJson(processDefinitionJson); processDefine.setDescription(desc); processDefine.setLocations(locations); processDefine.setConnects(connects); processDefine.setTimeout(processData.getTimeout()); processDefine.setTenantId(processData.getTenantId()); processDefine.setModifyBy(loginUser.getUserName()); processDefine.setResourceIds(getResourceIds(processData)); List<Property> globalParamsList = new ArrayList<>(); if (CollectionUtils.isNotEmpty(processData.getGlobalParams())) { Set<Property> userDefParamsSet = new HashSet<>(processData.getGlobalParams()); globalParamsList = new ArrayList<>(userDefParamsSet);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
} processDefine.setGlobalParamList(globalParamsList); processDefine.setUpdateTime(now); processDefine.setFlag(Flag.YES); if (processDefineMapper.updateById(processDefine) > 0) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); } return result; } /** * verify process definition name unique * * @param loginUser login user * @param projectName project name * @param name name * @return true if process definition name not exists, otherwise false */ public Map<String, Object> verifyProcessDefinitionName(User loginUser, String projectName, String name) { 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; } ProcessDefinition processDefinition = processDefineMapper.queryByDefineName(project.getId(), name); if (processDefinition == null) { putMsg(result, Status.SUCCESS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
} else { putMsg(result, Status.PROCESS_INSTANCE_EXIST, name); } return result; } /** * delete process definition by id * * @param loginUser login user * @param projectName project name * @param processDefinitionId process definition id * @return delete result code */ @Transactional(rollbackFor = Exception.class) public Map<String, Object> deleteProcessDefinitionById(User loginUser, String projectName, Integer processDefinitionId) { Map<String, Object> result = new HashMap<>(5); 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; } ProcessDefinition processDefinition = processDefineMapper.selectById(processDefinitionId); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionId); return result; } if (loginUser.getId() != processDefinition.getUserId() && loginUser.getUserType() != UserType.ADMIN_USER) { putMsg(result, Status.USER_NO_OPERATION_PERM);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
return result; } if (processDefinition.getReleaseState() == ReleaseState.ONLINE) { putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE,processDefinitionId); return result; } List<Schedule> schedules = scheduleMapper.queryByProcessDefinitionId(processDefinitionId); if (!schedules.isEmpty() && schedules.size() > 1) { logger.warn("scheduler num is {},Greater than 1",schedules.size()); putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_ID_ERROR); return result; }else if(schedules.size() == 1){ Schedule schedule = schedules.get(0); if(schedule.getReleaseState() == ReleaseState.OFFLINE){ scheduleMapper.deleteById(schedule.getId()); }else if(schedule.getReleaseState() == ReleaseState.ONLINE){ putMsg(result, Status.SCHEDULE_CRON_STATE_ONLINE,schedule.getId()); return result; } } int delete = processDefineMapper.deleteById(processDefinitionId); if (delete > 0) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_ID_ERROR); } return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
/** * release process definition: online / offline * * @param loginUser login user * @param projectName project name * @param id process definition id * @param releaseState release state * @return release result code */ @Transactional(rollbackFor = Exception.class) public Map<String, Object> releaseProcessDefinition(User loginUser, String projectName, int id, int releaseState) { HashMap<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; } ReleaseState state = ReleaseState.getEnum(releaseState); if (null == state) { putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "releaseState"); return result; } ProcessDefinition processDefinition = processDefineMapper.selectById(id); switch (state) { case ONLINE: String resourceIds = processDefinition.getResourceIds(); if (StringUtils.isNotBlank(resourceIds)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
Integer[] resourceIdArray = Arrays.stream(resourceIds.split(",")).map(Integer::parseInt).toArray(Integer[]::new); PermissionCheck<Integer> permissionCheck = new PermissionCheck(AuthorizationType.RESOURCE_FILE_ID,processService,resourceIdArray,loginUser.getId(),logger); try { permissionCheck.checkPermission(); } catch (Exception e) { logger.error(e.getMessage(),e); putMsg(result, Status.RESOURCE_NOT_EXIST_OR_NO_PERMISSION, "releaseState"); return result; } } processDefinition.setReleaseState(state); processDefineMapper.updateById(processDefinition); break; case OFFLINE: processDefinition.setReleaseState(state); processDefineMapper.updateById(processDefinition); List<Schedule> scheduleList = scheduleMapper.selectAllByProcessDefineArray( new int[]{processDefinition.getId()} ); for(Schedule schedule:scheduleList){ logger.info("set schedule offline, project id: {}, schedule id: {}, process definition id: {}", project.getId(), schedule.getId(), id); schedule.setReleaseState(ReleaseState.OFFLINE); scheduleMapper.updateById(schedule); SchedulerService.deleteSchedule(project.getId(), schedule.getId()); } break; default: putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "releaseState"); return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
} putMsg(result, Status.SUCCESS); return result; } /** * batch export process definition by ids * @param loginUser * @param projectName * @param processDefinitionIds * @param response */ public void batchExportProcessDefinitionByIds(User loginUser, String projectName, String processDefinitionIds, HttpServletResponse response){ if(StringUtils.isEmpty(processDefinitionIds)){ return; } 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; } List<ProcessMeta> processDefinitionList = getProcessDefinitionList(processDefinitionIds); if(CollectionUtils.isNotEmpty(processDefinitionList)){ downloadProcessDefinitionFile(response, processDefinitionList); } } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
* get process definition list by ids * @param processDefinitionIds * @return */ private List<ProcessMeta> getProcessDefinitionList(String processDefinitionIds){ List<ProcessMeta> processDefinitionList = new ArrayList<>(); String[] processDefinitionIdArray = processDefinitionIds.split(","); for (String strProcessDefinitionId : processDefinitionIdArray) { int processDefinitionId = Integer.parseInt(strProcessDefinitionId); ProcessDefinition processDefinition = processDefineMapper.queryByDefineId(processDefinitionId); if (null != processDefinition) { processDefinitionList.add(exportProcessMetaData(processDefinitionId, processDefinition)); } } return processDefinitionList; } /** * download the process definition file * @param response * @param processDefinitionList */ private void downloadProcessDefinitionFile(HttpServletResponse response, List<ProcessMeta> processDefinitionList) { response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE); BufferedOutputStream buff = null; ServletOutputStream out = null; try { out = response.getOutputStream(); buff = new BufferedOutputStream(out); buff.write(JSON.toJSONString(processDefinitionList).getBytes(StandardCharsets.UTF_8));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
buff.flush(); buff.close(); } catch (IOException e) { logger.warn("export process fail", e); }finally { if (null != buff) { try { buff.close(); } catch (Exception e) { logger.warn("export process buffer not close", e); } } if (null != out) { try { out.close(); } catch (Exception e) { logger.warn("export process output stream not close", e); } } } } /** * get export process metadata string * @param processDefinitionId process definition id * @param processDefinition process definition * @return export process metadata string */ public String exportProcessMetaDataStr(Integer processDefinitionId, ProcessDefinition processDefinition) { return JSONUtils.toJsonString(exportProcessMetaData(processDefinitionId,processDefinition));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
} /** * get export process metadata string * @param processDefinitionId process definition id * @param processDefinition process definition * @return export process metadata string */ public ProcessMeta exportProcessMetaData(Integer processDefinitionId, ProcessDefinition processDefinition) { String correctProcessDefinitionJson = addExportTaskNodeSpecialParam(processDefinition.getProcessDefinitionJson()); processDefinition.setProcessDefinitionJson(correctProcessDefinitionJson); ProcessMeta exportProcessMeta = new ProcessMeta(); exportProcessMeta.setProjectName(processDefinition.getProjectName()); exportProcessMeta.setProcessDefinitionName(processDefinition.getName()); exportProcessMeta.setProcessDefinitionJson(processDefinition.getProcessDefinitionJson()); exportProcessMeta.setProcessDefinitionLocations(processDefinition.getLocations()); exportProcessMeta.setProcessDefinitionConnects(processDefinition.getConnects()); List<Schedule> schedules = scheduleMapper.queryByProcessDefinitionId(processDefinitionId); if (!schedules.isEmpty()) { Schedule schedule = schedules.get(0); exportProcessMeta.setScheduleWarningType(schedule.getWarningType().toString()); exportProcessMeta.setScheduleWarningGroupId(schedule.getWarningGroupId()); exportProcessMeta.setScheduleStartTime(DateUtils.dateToString(schedule.getStartTime())); exportProcessMeta.setScheduleEndTime(DateUtils.dateToString(schedule.getEndTime())); exportProcessMeta.setScheduleCrontab(schedule.getCrontab()); exportProcessMeta.setScheduleFailureStrategy(String.valueOf(schedule.getFailureStrategy())); exportProcessMeta.setScheduleReleaseState(String.valueOf(ReleaseState.OFFLINE)); exportProcessMeta.setScheduleProcessInstancePriority(String.valueOf(schedule.getProcessInstancePriority()));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
exportProcessMeta.setScheduleWorkerGroupName(schedule.getWorkerGroup()); } return exportProcessMeta; } /** * correct task param which has datasource or dependent * @param processDefinitionJson processDefinitionJson * @return correct processDefinitionJson */ public String addExportTaskNodeSpecialParam(String processDefinitionJson) { JSONObject jsonObject = JSONUtils.parseObject(processDefinitionJson); JSONArray jsonArray = (JSONArray) jsonObject.get("tasks"); for (int i = 0; i < jsonArray.size(); i++) { JSONObject taskNode = jsonArray.getJSONObject(i); if (StringUtils.isNotEmpty(taskNode.getString("type"))) { String taskType = taskNode.getString("type"); ProcessAddTaskParam addTaskParam = TaskNodeParamFactory.getByTaskType(taskType); if (null != addTaskParam) { addTaskParam.addExportSpecialParam(taskNode); } } } jsonObject.put("tasks", jsonArray); return jsonObject.toString(); } /** * check task if has sub process * @param taskType task type * @return if task has sub process return true else false
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
*/ private boolean checkTaskHasSubProcess(String taskType) { return taskType.equals(TaskType.SUB_PROCESS.name()); } /** * import process definition * @param loginUser login user * @param file process metadata json file * @param currentProjectName current project name * @return import process */ @Transactional(rollbackFor = Exception.class) public Map<String, Object> importProcessDefinition(User loginUser, MultipartFile file, String currentProjectName) { Map<String, Object> result = new HashMap<>(5); String processMetaJson = FileUtils.file2String(file); List<ProcessMeta> processMetaList = JSON.parseArray(processMetaJson,ProcessMeta.class); if (CollectionUtils.isEmpty(processMetaList)) { putMsg(result, Status.DATA_IS_NULL, "fileContent"); return result; } for(ProcessMeta processMeta:processMetaList){ if (!checkAndImportProcessDefinition(loginUser, currentProjectName, result, processMeta)){ return result; } } return result; } /** * check and import process definition
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
* @param loginUser * @param currentProjectName * @param result * @param processMeta * @return */ private boolean checkAndImportProcessDefinition(User loginUser, String currentProjectName, Map<String, Object> result, ProcessMeta processMeta) { if(!checkImportanceParams(processMeta,result)){ return false; } String processDefinitionName = processMeta.getProcessDefinitionName(); Project targetProject = projectMapper.queryByName(currentProjectName); if(null != targetProject){ processDefinitionName = recursionProcessDefinitionName(targetProject.getId(), processDefinitionName, 1); } Map<String, Object> createProcessResult = getCreateProcessResult(loginUser, currentProjectName, result, processMeta, processDefinitionName, addImportTaskNodeParam(loginUser, processMeta.getProcessDefinitionJson(), targetProject)); if(createProcessResult == null){ return false; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
Integer processDefinitionId = Objects.isNull(createProcessResult.get("processDefinitionId"))? null:Integer.parseInt(createProcessResult.get("processDefinitionId").toString()); return getImportProcessScheduleResult(loginUser, currentProjectName, result, processMeta, processDefinitionName, processDefinitionId); } /** * get create process result * @param loginUser * @param currentProjectName * @param result * @param processMeta * @param processDefinitionName * @param importProcessParam * @return */ private Map<String, Object> getCreateProcessResult(User loginUser, String currentProjectName, Map<String, Object> result, ProcessMeta processMeta, String processDefinitionName, String importProcessParam){ Map<String, Object> createProcessResult = null; try { createProcessResult = createProcessDefinition(loginUser
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
,currentProjectName, processDefinitionName+"_import_"+System.currentTimeMillis(), importProcessParam, processMeta.getProcessDefinitionDescription(), processMeta.getProcessDefinitionLocations(), processMeta.getProcessDefinitionConnects()); putMsg(result, Status.SUCCESS); } catch (JsonProcessingException e) { logger.error("import process meta json data: {}", e.getMessage(), e); putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR); } return createProcessResult; } /** * get import process schedule result * @param loginUser * @param currentProjectName * @param result * @param processMeta * @param processDefinitionName * @param processDefinitionId * @return */ private boolean getImportProcessScheduleResult(User loginUser, String currentProjectName, Map<String, Object> result, ProcessMeta processMeta, String processDefinitionName, Integer processDefinitionId) { if (null != processMeta.getScheduleCrontab() && null != processDefinitionId) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
int scheduleInsert = importProcessSchedule(loginUser, currentProjectName, processMeta, processDefinitionName, processDefinitionId); if (0 == scheduleInsert) { putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR); return false; } } return true; } /** * check importance params * @param processMeta * @param result * @return */ private boolean checkImportanceParams(ProcessMeta processMeta,Map<String, Object> result){ if (StringUtils.isEmpty(processMeta.getProjectName())) { putMsg(result, Status.DATA_IS_NULL, "projectName"); return false; } if (StringUtils.isEmpty(processMeta.getProcessDefinitionName())) { putMsg(result, Status.DATA_IS_NULL, "processDefinitionName"); return false; } if (StringUtils.isEmpty(processMeta.getProcessDefinitionJson())) { putMsg(result, Status.DATA_IS_NULL, "processDefinitionJson"); return false;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
} return true; } /** * import process add special task param * @param loginUser login user * @param processDefinitionJson process definition json * @param targetProject target project * @return import process param */ private String addImportTaskNodeParam(User loginUser, String processDefinitionJson, Project targetProject) { JSONObject jsonObject = JSONUtils.parseObject(processDefinitionJson); JSONArray jsonArray = (JSONArray) jsonObject.get("tasks"); for (int i = 0; i < jsonArray.size(); i++) { JSONObject taskNode = jsonArray.getJSONObject(i); String taskType = taskNode.getString("type"); ProcessAddTaskParam addTaskParam = TaskNodeParamFactory.getByTaskType(taskType); if (null != addTaskParam) { addTaskParam.addImportSpecialParam(taskNode); } } Map<Integer, Integer> subProcessIdMap = new HashMap<>(20); List<Object> subProcessList = jsonArray.stream() .filter(elem -> checkTaskHasSubProcess(JSONUtils.parseObject(elem.toString()).getString("type"))) .collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(subProcessList)) { importSubProcess(loginUser, targetProject, jsonArray, subProcessIdMap); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
jsonObject.put("tasks", jsonArray); return jsonObject.toString(); } /** * import process schedule * @param loginUser login user * @param currentProjectName current project name * @param processMeta process meta data * @param processDefinitionName process definition name * @param processDefinitionId process definition id * @return insert schedule flag */ public int importProcessSchedule(User loginUser, String currentProjectName, ProcessMeta processMeta, String processDefinitionName, Integer processDefinitionId) { Date now = new Date(); Schedule scheduleObj = new Schedule(); scheduleObj.setProjectName(currentProjectName); scheduleObj.setProcessDefinitionId(processDefinitionId); scheduleObj.setProcessDefinitionName(processDefinitionName); scheduleObj.setCreateTime(now); scheduleObj.setUpdateTime(now); scheduleObj.setUserId(loginUser.getId()); scheduleObj.setUserName(loginUser.getUserName()); scheduleObj.setCrontab(processMeta.getScheduleCrontab()); if (null != processMeta.getScheduleStartTime()) { scheduleObj.setStartTime(DateUtils.stringToDate(processMeta.getScheduleStartTime())); } if (null != processMeta.getScheduleEndTime()) { scheduleObj.setEndTime(DateUtils.stringToDate(processMeta.getScheduleEndTime())); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
if (null != processMeta.getScheduleWarningType()) { scheduleObj.setWarningType(WarningType.valueOf(processMeta.getScheduleWarningType())); } if (null != processMeta.getScheduleWarningGroupId()) { scheduleObj.setWarningGroupId(processMeta.getScheduleWarningGroupId()); } if (null != processMeta.getScheduleFailureStrategy()) { scheduleObj.setFailureStrategy(FailureStrategy.valueOf(processMeta.getScheduleFailureStrategy())); } if (null != processMeta.getScheduleReleaseState()) { scheduleObj.setReleaseState(ReleaseState.valueOf(processMeta.getScheduleReleaseState())); } if (null != processMeta.getScheduleProcessInstancePriority()) { scheduleObj.setProcessInstancePriority(Priority.valueOf(processMeta.getScheduleProcessInstancePriority())); } if (null != processMeta.getScheduleWorkerGroupName()) { scheduleObj.setWorkerGroup(processMeta.getScheduleWorkerGroupName()); } return scheduleMapper.insert(scheduleObj); } /** * check import process has sub process * recursion create sub process * @param loginUser login user * @param targetProject target project * @param jsonArray process task array * @param subProcessIdMap correct sub process id map */ public void importSubProcess(User loginUser, Project targetProject, JSONArray jsonArray, Map<Integer, Integer> subProcessIdMap) { for (int i = 0; i < jsonArray.size(); i++) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
JSONObject taskNode = jsonArray.getJSONObject(i); String taskType = taskNode.getString("type"); if (checkTaskHasSubProcess(taskType)) { JSONObject subParams = JSONUtils.parseObject(taskNode.getString("params")); Integer subProcessId = subParams.getInteger("processDefinitionId"); ProcessDefinition subProcess = processDefineMapper.queryByDefineId(subProcessId); if (null != subProcess) { String subProcessJson = subProcess.getProcessDefinitionJson(); ProcessDefinition currentProjectSubProcess = processDefineMapper.queryByDefineName(targetProject.getId(), subProcess.getName()); if (null == currentProjectSubProcess) { JSONArray subJsonArray = (JSONArray) JSONUtils.parseObject(subProcess.getProcessDefinitionJson()).get("tasks"); List<Object> subProcessList = subJsonArray.stream() .filter(item -> checkTaskHasSubProcess(JSONUtils.parseObject(item.toString()).getString("type"))) .collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(subProcessList)) { importSubProcess(loginUser, targetProject, subJsonArray, subProcessIdMap); if (!subProcessIdMap.isEmpty()) { for (Map.Entry<Integer, Integer> entry : subProcessIdMap.entrySet()) { String oldSubProcessId = "\"processDefinitionId\":" + entry.getKey(); String newSubProcessId = "\"processDefinitionId\":" + entry.getValue(); subProcessJson = subProcessJson.replaceAll(oldSubProcessId, newSubProcessId); } subProcessIdMap.clear(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
Date now = new Date(); ProcessDefinition processDefine = new ProcessDefinition(); processDefine.setName(subProcess.getName()); processDefine.setVersion(subProcess.getVersion()); processDefine.setReleaseState(subProcess.getReleaseState()); processDefine.setProjectId(targetProject.getId()); processDefine.setUserId(loginUser.getId()); processDefine.setProcessDefinitionJson(subProcessJson); processDefine.setDescription(subProcess.getDescription()); processDefine.setLocations(subProcess.getLocations()); processDefine.setConnects(subProcess.getConnects()); processDefine.setTimeout(subProcess.getTimeout()); processDefine.setTenantId(subProcess.getTenantId()); processDefine.setGlobalParams(subProcess.getGlobalParams()); processDefine.setCreateTime(now); processDefine.setUpdateTime(now); processDefine.setFlag(subProcess.getFlag()); processDefine.setReceivers(subProcess.getReceivers()); processDefine.setReceiversCc(subProcess.getReceiversCc()); processDefineMapper.insert(processDefine); logger.info("create sub process, project: {}, process name: {}", targetProject.getName(), processDefine.getName()); ProcessDefinition newSubProcessDefine = processDefineMapper.queryByDefineName(processDefine.getProjectId(),processDefine.getName()); if (null != newSubProcessDefine) { subProcessIdMap.put(subProcessId, newSubProcessDefine.getId()); subParams.put("processDefinitionId", newSubProcessDefine.getId()); taskNode.put("params", subParams); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
} } } } /** * check the process definition node meets the specifications * * @param processData process data * @param processDefinitionJson process definition json * @return check result code */ public Map<String, Object> checkProcessNodeList(ProcessData processData, String processDefinitionJson) { Map<String, Object> result = new HashMap<>(5); try { if (processData == null) { logger.error("process data is null"); putMsg(result,Status.DATA_IS_NOT_VALID, processDefinitionJson); return result; } List<TaskNode> taskNodes = processData.getTasks(); if (taskNodes == null) { logger.error("process node info is empty"); putMsg(result, Status.DATA_IS_NULL, processDefinitionJson); return result; } if (graphHasCycle(taskNodes)) { logger.error("process DAG has cycle"); putMsg(result, Status.PROCESS_NODE_HAS_CYCLE);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
return result; } for (TaskNode taskNode : taskNodes) { if (!CheckUtils.checkTaskNodeParameters(taskNode.getParams(), taskNode.getType())) { logger.error("task node {} parameter invalid", taskNode.getName()); putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskNode.getName()); return result; } CheckUtils.checkOtherParams(taskNode.getExtras()); } putMsg(result,Status.SUCCESS); } catch (Exception e) { result.put(Constants.STATUS, Status.REQUEST_PARAMS_NOT_VALID_ERROR); result.put(Constants.MSG, e.getMessage()); } return result; } /** * get task node details based on process definition * * @param defineId define id * @return task node list * @throws Exception exception */ public Map<String, Object> getTaskNodeListByDefinitionId(Integer defineId) throws Exception { Map<String, Object> result = new HashMap<>(); ProcessDefinition processDefinition = processDefineMapper.selectById(defineId); if (processDefinition == null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
logger.info("process define not exists"); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, defineId); return result; } String processDefinitionJson = processDefinition.getProcessDefinitionJson(); ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class); if (null == processData) { logger.error("process data is null"); putMsg(result,Status.DATA_IS_NOT_VALID, processDefinitionJson); return result; } List<TaskNode> taskNodeList = (processData.getTasks() == null) ? new ArrayList<>() : processData.getTasks(); result.put(Constants.DATA_LIST, taskNodeList); putMsg(result, Status.SUCCESS); return result; } /** * get task node details based on process definition * * @param defineIdList define id list * @return task node list * @throws Exception exception */ public Map<String, Object> getTaskNodeListByDefinitionIdList(String defineIdList) throws Exception { Map<String, Object> result = new HashMap<>(); Map<Integer, List<TaskNode>> taskNodeMap = new HashMap<>(); String[] idList = defineIdList.split(","); List<Integer> idIntList = new ArrayList<>(); for(String definitionId : idList) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
idIntList.add(Integer.parseInt(definitionId)); } Integer[] idArray = idIntList.toArray(new Integer[idIntList.size()]); List<ProcessDefinition> processDefinitionList = processDefineMapper.queryDefinitionListByIdList(idArray); if (CollectionUtils.isEmpty(processDefinitionList)) { logger.info("process definition not exists"); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, defineIdList); return result; } for(ProcessDefinition processDefinition : processDefinitionList){ String processDefinitionJson = processDefinition.getProcessDefinitionJson(); ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class); List<TaskNode> taskNodeList = (processData.getTasks() == null) ? new ArrayList<>() : processData.getTasks(); taskNodeMap.put(processDefinition.getId(), taskNodeList); } result.put(Constants.DATA_LIST, taskNodeMap); putMsg(result, Status.SUCCESS); return result; } /** * query process definition all by project id * * @param projectId project id * @return process definitions in the project */ public Map<String, Object> queryProcessDefinitionAllByProjectId(Integer projectId) { HashMap<String, Object> result = new HashMap<>(5); List<ProcessDefinition> resourceList = processDefineMapper.queryAllDefinitionList(projectId); result.put(Constants.DATA_LIST, resourceList); putMsg(result, Status.SUCCESS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
return result; } /** * Encapsulates the TreeView structure * * @param processId process definition id * @param limit limit * @return tree view json data * @throws Exception exception */ public Map<String, Object> viewTree(Integer processId, Integer limit) throws Exception { Map<String, Object> result = new HashMap<>(); ProcessDefinition processDefinition = processDefineMapper.selectById(processId); if (null == processDefinition) { logger.info("process define not exists"); putMsg(result,Status.PROCESS_DEFINE_NOT_EXIST, processDefinition); return result; } DAG<String, TaskNode, TaskNodeRelation> dag = genDagGraph(processDefinition); /** * nodes that is running */ Map<String, List<TreeViewDto>> runningNodeMap = new ConcurrentHashMap<>(); /** * nodes that is waiting torun */ Map<String, List<TreeViewDto>> waitingRunningNodeMap = new ConcurrentHashMap<>(); /** * List of process instances */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
List<ProcessInstance> processInstanceList = processInstanceMapper.queryByProcessDefineId(processId, limit); for(ProcessInstance processInstance:processInstanceList){ processInstance.setDuration(DateUtils.differSec(processInstance.getStartTime(),processInstance.getEndTime())); } if (limit > processInstanceList.size()) { limit = processInstanceList.size(); } TreeViewDto parentTreeViewDto = new TreeViewDto(); parentTreeViewDto.setName("DAG"); parentTreeViewDto.setType(""); for (int i = limit - 1; i >= 0; i--) { ProcessInstance processInstance = processInstanceList.get(i); Date endTime = processInstance.getEndTime() == null ? new Date() : processInstance.getEndTime(); parentTreeViewDto.getInstances().add(new Instance(processInstance.getId(), processInstance.getName(), "", processInstance.getState().toString() , processInstance.getStartTime(), endTime, processInstance.getHost(), DateUtils.format2Readable(endTime.getTime() - processInstance.getStartTime().getTime()))); } List<TreeViewDto> parentTreeViewDtoList = new ArrayList<>(); parentTreeViewDtoList.add(parentTreeViewDto); for (String startNode : dag.getBeginNode()) { runningNodeMap.put(startNode, parentTreeViewDtoList); } while (Stopper.isRunning()) { Set<String> postNodeList = null; Iterator<Map.Entry<String, List<TreeViewDto>>> iter = runningNodeMap.entrySet().iterator(); while (iter.hasNext()) { Map.Entry<String, List<TreeViewDto>> en = iter.next(); String nodeName = en.getKey(); parentTreeViewDtoList = en.getValue();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
TreeViewDto treeViewDto = new TreeViewDto(); treeViewDto.setName(nodeName); TaskNode taskNode = dag.getNode(nodeName); treeViewDto.setType(taskNode.getType()); for (int i = limit - 1; i >= 0; i--) { ProcessInstance processInstance = processInstanceList.get(i); TaskInstance taskInstance = taskInstanceMapper.queryByInstanceIdAndName(processInstance.getId(), nodeName); if (taskInstance == null) { treeViewDto.getInstances().add(new Instance(-1, "not running", "null")); } else { Date startTime = taskInstance.getStartTime() == null ? new Date() : taskInstance.getStartTime(); Date endTime = taskInstance.getEndTime() == null ? new Date() : taskInstance.getEndTime(); int subProcessId = 0; /** * if process is sub process, the return sub id, or sub id=0 */ if (taskInstance.getTaskType().equals(TaskType.SUB_PROCESS.name())) { String taskJson = taskInstance.getTaskJson(); taskNode = JSON.parseObject(taskJson, TaskNode.class); subProcessId = Integer.parseInt(JSON.parseObject( taskNode.getParams()).getString(CMDPARAM_SUB_PROCESS_DEFINE_ID)); } treeViewDto.getInstances().add(new Instance(taskInstance.getId(), taskInstance.getName(), taskInstance.getTaskType(), taskInstance.getState().toString() , taskInstance.getStartTime(), taskInstance.getEndTime(), taskInstance.getHost(), DateUtils.format2Readable(endTime.getTime() - startTime.getTime()), subProcessId)); } } for (TreeViewDto pTreeViewDto : parentTreeViewDtoList) { pTreeViewDto.getChildren().add(treeViewDto); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
postNodeList = dag.getSubsequentNodes(nodeName); if (CollectionUtils.isNotEmpty(postNodeList)) { for (String nextNodeName : postNodeList) { List<TreeViewDto> treeViewDtoList = waitingRunningNodeMap.get(nextNodeName); if (CollectionUtils.isNotEmpty(treeViewDtoList)) { treeViewDtoList.add(treeViewDto); waitingRunningNodeMap.put(nextNodeName, treeViewDtoList); } else { treeViewDtoList = new ArrayList<>(); treeViewDtoList.add(treeViewDto); waitingRunningNodeMap.put(nextNodeName, treeViewDtoList); } } } runningNodeMap.remove(nodeName); } if (waitingRunningNodeMap == null || waitingRunningNodeMap.size() == 0) { break; } else { runningNodeMap.putAll(waitingRunningNodeMap); waitingRunningNodeMap.clear(); } } result.put(Constants.DATA_LIST, parentTreeViewDto); result.put(Constants.STATUS, Status.SUCCESS); result.put(Constants.MSG, Status.SUCCESS.getMsg()); return result; } /** * Generate the DAG Graph based on the process definition id
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
* * @param processDefinition process definition * @return dag graph * @throws Exception if exception happens */ private DAG<String, TaskNode, TaskNodeRelation> genDagGraph(ProcessDefinition processDefinition) throws Exception { String processDefinitionJson = processDefinition.getProcessDefinitionJson(); ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class); if (null != processData) { List<TaskNode> taskNodeList = processData.getTasks(); processDefinition.setGlobalParamList(processData.getGlobalParams()); ProcessDag processDag = DagHelper.getProcessDag(taskNodeList); return DagHelper.buildDagGraph(processDag); } return new DAG<>(); } /** * whether the graph has a ring * * @param taskNodeResponseList task node response list * @return if graph has cycle flag */ private boolean graphHasCycle(List<TaskNode> taskNodeResponseList) { DAG<String, TaskNode, String> graph = new DAG<>(); for (TaskNode taskNodeResponse : taskNodeResponseList) { graph.addNode(taskNodeResponse.getName(), taskNodeResponse); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,559
[Feature]unique processdefinition name in the same project
**branch** dev **Is your feature request related to a problem? Please describe.** if the same name in one project ,im hard to recognize any one . And its usually caused by mistake **Describe the solution you'd like** unique processDifinition name in one project **Additional context** name suffix is also good
https://github.com/apache/dolphinscheduler/issues/2559
https://github.com/apache/dolphinscheduler/pull/2617
33658d57fd9149cc8321e53683eeb756076fe7d7
6127f3a4609cda2937f47432e5c2c2ddb75c4452
"2020-04-28T10:34:05Z"
java
"2020-05-07T09:18:42Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
for (TaskNode taskNodeResponse : taskNodeResponseList) { taskNodeResponse.getPreTasks(); List<String> preTasks = JSONUtils.toList(taskNodeResponse.getPreTasks(),String.class); if (CollectionUtils.isNotEmpty(preTasks)) { for (String preTask : preTasks) { if (!graph.addEdge(preTask, taskNodeResponse.getName())) { return true; } } } } return graph.hasCycle(); } private String recursionProcessDefinitionName(Integer projectId,String processDefinitionName,int num){ ProcessDefinition processDefinition = processDefineMapper.queryByDefineName(projectId, processDefinitionName); if (processDefinition != null) { if(num > 1){ String str = processDefinitionName.substring(0,processDefinitionName.length() - 3); processDefinitionName = str + "("+num+")"; }else{ processDefinitionName = processDefinition.getName() + "("+num+")"; } }else{ return processDefinitionName; } return recursionProcessDefinitionName(projectId,processDefinitionName,num + 1); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,603
[BUG] code annotation error
incubator-dolphinscheduler-dev/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java Source code: /** * master server startup * * master server not use web service * @param args arguments */ public static void main(String[] args) { Thread.currentThread().setName(Constants.THREAD_NAME_WORKER_SERVER); new SpringApplicationBuilder(WorkerServer.class).web(WebApplicationType.NONE).run(args); } The master in the annotation on lines 74 and 76 should be changed to worker.
https://github.com/apache/dolphinscheduler/issues/2603
https://github.com/apache/dolphinscheduler/pull/2614
8e080ef6085e285480e906ee8dee301e3790bc02
8c8e128d18b2a1e189b05554a8c011749c1408b7
"2020-05-06T07:20:42Z"
java
"2020-05-08T07:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.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 *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,603
[BUG] code annotation error
incubator-dolphinscheduler-dev/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java Source code: /** * master server startup * * master server not use web service * @param args arguments */ public static void main(String[] args) { Thread.currentThread().setName(Constants.THREAD_NAME_WORKER_SERVER); new SpringApplicationBuilder(WorkerServer.class).web(WebApplicationType.NONE).run(args); } The master in the annotation on lines 74 and 76 should be changed to worker.
https://github.com/apache/dolphinscheduler/issues/2603
https://github.com/apache/dolphinscheduler/pull/2614
8e080ef6085e285480e906ee8dee301e3790bc02
8c8e128d18b2a1e189b05554a8c011749c1408b7
"2020-05-06T07:20:42Z"
java
"2020-05-08T07:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java
* http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.server.worker; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.thread.Stopper; import org.apache.dolphinscheduler.remote.NettyRemotingServer; import org.apache.dolphinscheduler.remote.command.CommandType; import org.apache.dolphinscheduler.remote.config.NettyServerConfig; import org.apache.dolphinscheduler.server.worker.config.WorkerConfig; import org.apache.dolphinscheduler.server.worker.processor.TaskExecuteProcessor; import org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor; import org.apache.dolphinscheduler.server.worker.registry.WorkerRegistry; import org.apache.dolphinscheduler.service.bean.SpringApplicationContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.WebApplicationType; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.context.annotation.ComponentScan; import javax.annotation.PostConstruct; /** * worker server */ @ComponentScan("org.apache.dolphinscheduler")
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,603
[BUG] code annotation error
incubator-dolphinscheduler-dev/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java Source code: /** * master server startup * * master server not use web service * @param args arguments */ public static void main(String[] args) { Thread.currentThread().setName(Constants.THREAD_NAME_WORKER_SERVER); new SpringApplicationBuilder(WorkerServer.class).web(WebApplicationType.NONE).run(args); } The master in the annotation on lines 74 and 76 should be changed to worker.
https://github.com/apache/dolphinscheduler/issues/2603
https://github.com/apache/dolphinscheduler/pull/2614
8e080ef6085e285480e906ee8dee301e3790bc02
8c8e128d18b2a1e189b05554a8c011749c1408b7
"2020-05-06T07:20:42Z"
java
"2020-05-08T07:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java
public class WorkerServer { /** * logger */ private static final Logger logger = LoggerFactory.getLogger(WorkerServer.class); /** * netty remote server */ private NettyRemotingServer nettyRemotingServer; /** * worker registry */ @Autowired private WorkerRegistry workerRegistry; /** * worker config */ @Autowired private WorkerConfig workerConfig; /** * spring application context * only use it for initialization */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,603
[BUG] code annotation error
incubator-dolphinscheduler-dev/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java Source code: /** * master server startup * * master server not use web service * @param args arguments */ public static void main(String[] args) { Thread.currentThread().setName(Constants.THREAD_NAME_WORKER_SERVER); new SpringApplicationBuilder(WorkerServer.class).web(WebApplicationType.NONE).run(args); } The master in the annotation on lines 74 and 76 should be changed to worker.
https://github.com/apache/dolphinscheduler/issues/2603
https://github.com/apache/dolphinscheduler/pull/2614
8e080ef6085e285480e906ee8dee301e3790bc02
8c8e128d18b2a1e189b05554a8c011749c1408b7
"2020-05-06T07:20:42Z"
java
"2020-05-08T07:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java
@Autowired private SpringApplicationContext springApplicationContext; /** * worker server startup * * worker server not use web service * @param args arguments */ public static void main(String[] args) { Thread.currentThread().setName(Constants.THREAD_NAME_WORKER_SERVER); new SpringApplicationBuilder(WorkerServer.class).web(WebApplicationType.NONE).run(args); } /** * worker server run */ @PostConstruct public void run(){ logger.info("start worker server..."); NettyServerConfig serverConfig = new NettyServerConfig(); serverConfig.setListenPort(workerConfig.getListenPort()); this.nettyRemotingServer = new NettyRemotingServer(serverConfig); this.nettyRemotingServer.registerProcessor(CommandType.TASK_EXECUTE_REQUEST, new TaskExecuteProcessor()); this.nettyRemotingServer.registerProcessor(CommandType.TASK_KILL_REQUEST, new TaskKillProcessor()); this.nettyRemotingServer.start(); this.workerRegistry.registry(); /** * register hooks, which are called before the process exits */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,603
[BUG] code annotation error
incubator-dolphinscheduler-dev/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java Source code: /** * master server startup * * master server not use web service * @param args arguments */ public static void main(String[] args) { Thread.currentThread().setName(Constants.THREAD_NAME_WORKER_SERVER); new SpringApplicationBuilder(WorkerServer.class).web(WebApplicationType.NONE).run(args); } The master in the annotation on lines 74 and 76 should be changed to worker.
https://github.com/apache/dolphinscheduler/issues/2603
https://github.com/apache/dolphinscheduler/pull/2614
8e080ef6085e285480e906ee8dee301e3790bc02
8c8e128d18b2a1e189b05554a8c011749c1408b7
"2020-05-06T07:20:42Z"
java
"2020-05-08T07:23:31Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { @Override public void run() { close("shutdownHook"); } })); } public void close(String cause) { try { if(Stopper.isStopped()){ return; } logger.info("worker server is stopping ..., cause : {}", cause); Stopper.stop(); try { Thread.sleep(3000L); }catch (Exception e){ logger.warn("thread sleep exception", e); } this.nettyRemotingServer.close(); this.workerRegistry.unRegistry(); } catch (Exception e) { logger.error("worker server stop exception ", e); System.exit(-1); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.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
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
*/ package org.apache.dolphinscheduler.service.process; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.cronutils.model.Cron; import org.apache.commons.lang.ArrayUtils; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.*; import org.apache.dolphinscheduler.common.model.DateInterval; import org.apache.dolphinscheduler.common.model.TaskNode; import org.apache.dolphinscheduler.common.process.Property; import org.apache.dolphinscheduler.common.task.subprocess.SubProcessParameters; import org.apache.dolphinscheduler.common.utils.*; import org.apache.dolphinscheduler.dao.entity.*; import org.apache.dolphinscheduler.dao.mapper.*; import org.apache.dolphinscheduler.service.quartz.cron.CronUtils; import org.quartz.CronExpression; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.util.*; import java.util.stream.Collectors; import static java.util.stream.Collectors.toSet; import static org.apache.dolphinscheduler.common.Constants.*; /** * process relative dao that some mappers in this. */ @Component
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
public class ProcessService { private final Logger logger = LoggerFactory.getLogger(getClass()); private final int[] stateArray = new int[]{ExecutionStatus.SUBMITTED_SUCCESS.ordinal(), ExecutionStatus.RUNNING_EXEUTION.ordinal(), ExecutionStatus.READY_PAUSE.ordinal(), ExecutionStatus.READY_STOP.ordinal()}; @Autowired private UserMapper userMapper; @Autowired private ProcessDefinitionMapper processDefineMapper; @Autowired private ProcessInstanceMapper processInstanceMapper; @Autowired private DataSourceMapper dataSourceMapper; @Autowired private ProcessInstanceMapMapper processInstanceMapMapper; @Autowired private TaskInstanceMapper taskInstanceMapper; @Autowired private CommandMapper commandMapper; @Autowired private ScheduleMapper scheduleMapper; @Autowired private UdfFuncMapper udfFuncMapper;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
@Autowired private ResourceMapper resourceMapper; @Autowired private ErrorCommandMapper errorCommandMapper; @Autowired private TenantMapper tenantMapper; @Autowired private ProjectMapper projectMapper; /** * handle Command (construct ProcessInstance from Command) , wrapped in transaction * @param logger logger * @param host host * @param validThreadNum validThreadNum * @param command found command * @return process instance */ @Transactional(rollbackFor = Exception.class) public ProcessInstance handleCommand(Logger logger, String host, int validThreadNum, Command command) { ProcessInstance processInstance = constructProcessInstance(command, host); if(processInstance == null){ logger.error("scan command, command parameter is error: {}", command); moveToErrorCommand(command, "process instance is null"); return null; } if(!checkThreadNum(command, validThreadNum)){ logger.info("there is not enough thread for this command: {}", command); return setWaitingThreadProcess(command, processInstance); } if (processInstance.getCommandType().equals(CommandType.RECOVER_TOLERANCE_FAULT_PROCESS)){
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
delCommandByid(command.getId()); return null; } processInstance.setCommandType(command.getCommandType()); processInstance.addHistoryCmd(command.getCommandType()); saveProcessInstance(processInstance); this.setSubProcessParam(processInstance); delCommandByid(command.getId()); return processInstance; } /** * save error command, and delete original command * @param command command * @param message message */ @Transactional(rollbackFor = Exception.class) public void moveToErrorCommand(Command command, String message) { ErrorCommand errorCommand = new ErrorCommand(command, message); this.errorCommandMapper.insert(errorCommand); delCommandByid(command.getId()); } /** * set process waiting thread * @param command command * @param processInstance processInstance * @return process instance */ private ProcessInstance setWaitingThreadProcess(Command command, ProcessInstance processInstance) { processInstance.setState(ExecutionStatus.WAITTING_THREAD); if(command.getCommandType() != CommandType.RECOVER_WAITTING_THREAD){
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
processInstance.addHistoryCmd(command.getCommandType()); } saveProcessInstance(processInstance); this.setSubProcessParam(processInstance); createRecoveryWaitingThreadCommand(command, processInstance); return null; } /** * check thread num * @param command command * @param validThreadNum validThreadNum * @return if thread is enough */ private boolean checkThreadNum(Command command, int validThreadNum) { int commandThreadCount = this.workProcessThreadNumCount(command.getProcessDefinitionId()); return validThreadNum >= commandThreadCount; } /** * insert one command * @param command command * @return create result */ public int createCommand(Command command) { int result = 0; if (command != null){ result = commandMapper.insert(command); } return result; } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
* find one command from queue list * @return command */ public Command findOneCommand(){ return commandMapper.getOneToRun(); } /** * check the input command exists in queue list * @param command command * @return create command result */ public Boolean verifyIsNeedCreateCommand(Command command){ Boolean isNeedCreate = true; Map<CommandType,Integer> cmdTypeMap = new HashMap<CommandType,Integer>(); cmdTypeMap.put(CommandType.REPEAT_RUNNING,1); cmdTypeMap.put(CommandType.RECOVER_SUSPENDED_PROCESS,1); cmdTypeMap.put(CommandType.START_FAILURE_TASK_PROCESS,1); CommandType commandType = command.getCommandType(); if(cmdTypeMap.containsKey(commandType)){ JSONObject cmdParamObj = (JSONObject) JSON.parse(command.getCommandParam()); JSONObject tempObj; int processInstanceId = cmdParamObj.getInteger(CMDPARAM_RECOVER_PROCESS_ID_STRING); List<Command> commands = commandMapper.selectList(null); for (Command tmpCommand:commands){ if(cmdTypeMap.containsKey(tmpCommand.getCommandType())){ tempObj = (JSONObject) JSON.parse(tmpCommand.getCommandParam()); if(tempObj != null && processInstanceId == tempObj.getInteger(CMDPARAM_RECOVER_PROCESS_ID_STRING)){ isNeedCreate = false; break;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
} } } } return isNeedCreate; } /** * find process instance detail by id * @param processId processId * @return process instance */ public ProcessInstance findProcessInstanceDetailById(int processId){ return processInstanceMapper.queryDetailById(processId); } /** * get task node list by definitionId * @param defineId * @return */ public List<TaskNode> getTaskNodeListByDefinitionId(Integer defineId){ ProcessDefinition processDefinition = processDefineMapper.selectById(defineId); if (processDefinition == null) { logger.info("process define not exists"); return null; } String processDefinitionJson = processDefinition.getProcessDefinitionJson(); ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class); if (null == processData) { logger.error("process data is null");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
return null; } return processData.getTasks(); } /** * find process instance by id * @param processId processId * @return process instance */ public ProcessInstance findProcessInstanceById(int processId){ return processInstanceMapper.selectById(processId); } /** * find process define by id. * @param processDefinitionId processDefinitionId * @return process definition */ public ProcessDefinition findProcessDefineById(int processDefinitionId) { return processDefineMapper.selectById(processDefinitionId); } /** * delete work process instance by id * @param processInstanceId processInstanceId * @return delete process instance result */ public int deleteWorkProcessInstanceById(int processInstanceId){ return processInstanceMapper.deleteById(processInstanceId); } /** * delete all sub process by parent instance id
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
* @param processInstanceId processInstanceId * @return delete all sub process instance result */ public int deleteAllSubWorkProcessByParentId(int processInstanceId){ List<Integer> subProcessIdList = processInstanceMapMapper.querySubIdListByParentId(processInstanceId); for(Integer subId : subProcessIdList ){ deleteAllSubWorkProcessByParentId(subId); deleteWorkProcessMapByParentId(subId); deleteWorkProcessInstanceById(subId); } return 1; } /** * calculate sub process number in the process define. * @param processDefinitionId processDefinitionId * @return process thread num count */ private Integer workProcessThreadNumCount(Integer processDefinitionId){ List<Integer> ids = new ArrayList<>(); recurseFindSubProcessId(processDefinitionId, ids); return ids.size()+1; } /** * recursive query sub process definition id by parent id. * @param parentId parentId * @param ids ids */ public void recurseFindSubProcessId(int parentId, List<Integer> ids){ ProcessDefinition processDefinition = processDefineMapper.selectById(parentId); String processDefinitionJson = processDefinition.getProcessDefinitionJson();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class); List<TaskNode> taskNodeList = processData.getTasks(); if (taskNodeList != null && taskNodeList.size() > 0){ for (TaskNode taskNode : taskNodeList){ String parameter = taskNode.getParams(); if (parameter.contains(CMDPARAM_SUB_PROCESS_DEFINE_ID)){ SubProcessParameters subProcessParam = JSON.parseObject(parameter, SubProcessParameters.class); ids.add(subProcessParam.getProcessDefinitionId()); recurseFindSubProcessId(subProcessParam.getProcessDefinitionId(),ids); } } } } /** * create recovery waiting thread command when thread pool is not enough for the process instance. * sub work process instance need not to create recovery command. * create recovery waiting thread command and delete origin command at the same time. * if the recovery command is exists, only update the field update_time * @param originCommand originCommand * @param processInstance processInstance */ public void createRecoveryWaitingThreadCommand(Command originCommand, ProcessInstance processInstance) { if(processInstance.getIsSubProcess() == Flag.YES){ if(originCommand != null){ commandMapper.deleteById(originCommand.getId()); } return; } Map<String, String> cmdParam = new HashMap<>();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
cmdParam.put(Constants.CMDPARAM_RECOVERY_WAITTING_THREAD, String.valueOf(processInstance.getId())); if(originCommand == null){ Command command = new Command( CommandType.RECOVER_WAITTING_THREAD, processInstance.getTaskDependType(), processInstance.getFailureStrategy(), processInstance.getExecutorId(), processInstance.getProcessDefinitionId(), JSONUtils.toJson(cmdParam), processInstance.getWarningType(), processInstance.getWarningGroupId(), processInstance.getScheduleTime(), processInstance.getProcessInstancePriority() ); saveCommand(command); return ; } if(originCommand.getCommandType() == CommandType.RECOVER_WAITTING_THREAD){ originCommand.setUpdateTime(new Date()); saveCommand(originCommand); }else{ commandMapper.deleteById(originCommand.getId()); originCommand.setId(0); originCommand.setCommandType(CommandType.RECOVER_WAITTING_THREAD); originCommand.setUpdateTime(new Date()); originCommand.setCommandParam(JSONUtils.toJson(cmdParam)); originCommand.setProcessInstancePriority(processInstance.getProcessInstancePriority());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
saveCommand(originCommand); } } /** * get schedule time from command * @param command command * @param cmdParam cmdParam map * @return date */ private Date getScheduleTime(Command command, Map<String, String> cmdParam){ Date scheduleTime = command.getScheduleTime(); if(scheduleTime == null){ if(cmdParam != null && cmdParam.containsKey(CMDPARAM_COMPLEMENT_DATA_START_DATE)){ scheduleTime = DateUtils.stringToDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE)); } } return scheduleTime; } /** * generate a new work process instance from command. * @param processDefinition processDefinition * @param command command * @param cmdParam cmdParam map * @return process instance */ private ProcessInstance generateNewProcessInstance(ProcessDefinition processDefinition, Command command, Map<String, String> cmdParam){ ProcessInstance processInstance = new ProcessInstance(processDefinition); processInstance.setState(ExecutionStatus.RUNNING_EXEUTION);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
processInstance.setRecovery(Flag.NO); processInstance.setStartTime(new Date()); processInstance.setRunTimes(1); processInstance.setMaxTryTimes(0); processInstance.setProcessDefinitionId(command.getProcessDefinitionId()); processInstance.setCommandParam(command.getCommandParam()); processInstance.setCommandType(command.getCommandType()); processInstance.setIsSubProcess(Flag.NO); processInstance.setTaskDependType(command.getTaskDependType()); processInstance.setFailureStrategy(command.getFailureStrategy()); processInstance.setExecutorId(command.getExecutorId()); WarningType warningType = command.getWarningType() == null ? WarningType.NONE : command.getWarningType(); processInstance.setWarningType(warningType); Integer warningGroupId = command.getWarningGroupId() == null ? 0 : command.getWarningGroupId(); processInstance.setWarningGroupId(warningGroupId); Date scheduleTime = getScheduleTime(command, cmdParam); if(scheduleTime != null){ processInstance.setScheduleTime(scheduleTime); } processInstance.setCommandStartTime(command.getStartTime()); processInstance.setLocations(processDefinition.getLocations()); processInstance.setConnects(processDefinition.getConnects()); processInstance.setGlobalParams(ParameterUtils.curingGlobalParams( processDefinition.getGlobalParamMap(), processDefinition.getGlobalParamList(), getCommandTypeIfComplement(processInstance, command), processInstance.getScheduleTime()));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
processInstance.setProcessInstanceJson(processDefinition.getProcessDefinitionJson()); processInstance.setProcessInstancePriority(command.getProcessInstancePriority()); String workerGroup = StringUtils.isBlank(command.getWorkerGroup()) ? Constants.DEFAULT_WORKER_GROUP : command.getWorkerGroup(); processInstance.setWorkerGroup(workerGroup); processInstance.setTimeout(processDefinition.getTimeout()); processInstance.setTenantId(processDefinition.getTenantId()); return processInstance; } /** * get process tenant * there is tenant id in definition, use the tenant of the definition. * if there is not tenant id in the definiton or the tenant not exist * use definition creator's tenant. * @param tenantId tenantId * @param userId userId * @return tenant */ public Tenant getTenantForProcess(int tenantId, int userId){ Tenant tenant = null; if(tenantId >= 0){ tenant = tenantMapper.queryById(tenantId); } if (userId == 0){ return null; } if(tenant == null){ User user = userMapper.selectById(userId); tenant = tenantMapper.queryById(user.getTenantId()); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
return tenant; } /** * check command parameters is valid * @param command command * @param cmdParam cmdParam map * @return whether command param is valid */ private Boolean checkCmdParam(Command command, Map<String, String> cmdParam){ if(command.getTaskDependType() == TaskDependType.TASK_ONLY || command.getTaskDependType()== TaskDependType.TASK_PRE){ if(cmdParam == null || !cmdParam.containsKey(Constants.CMDPARAM_START_NODE_NAMES) || cmdParam.get(Constants.CMDPARAM_START_NODE_NAMES).isEmpty()){ logger.error("command node depend type is {}, but start nodes is null ", command.getTaskDependType()); return false; } } return true; } /** * construct process instance according to one command. * @param command command * @param host host * @return process instance */ private ProcessInstance constructProcessInstance(Command command, String host){ ProcessInstance processInstance = null; CommandType commandType = command.getCommandType(); Map<String, String> cmdParam = JSONUtils.toMap(command.getCommandParam()); ProcessDefinition processDefinition = null;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
if(command.getProcessDefinitionId() != 0){ processDefinition = processDefineMapper.selectById(command.getProcessDefinitionId()); if(processDefinition == null){ logger.error("cannot find the work process define! define id : {}", command.getProcessDefinitionId()); return null; } } if(cmdParam != null ){ Integer processInstanceId = 0; if(cmdParam.containsKey(Constants.CMDPARAM_RECOVER_PROCESS_ID_STRING)) { String processId = cmdParam.get(Constants.CMDPARAM_RECOVER_PROCESS_ID_STRING); processInstanceId = Integer.parseInt(processId); if (processInstanceId == 0) { logger.error("command parameter is error, [ ProcessInstanceId ] is 0"); return null; } }else if(cmdParam.containsKey(Constants.CMDPARAM_SUB_PROCESS)){ String pId = cmdParam.get(Constants.CMDPARAM_SUB_PROCESS); processInstanceId = Integer.parseInt(pId); }else if(cmdParam.containsKey(Constants.CMDPARAM_RECOVERY_WAITTING_THREAD)){ String pId = cmdParam.get(Constants.CMDPARAM_RECOVERY_WAITTING_THREAD); processInstanceId = Integer.parseInt(pId); } if(processInstanceId ==0){ processInstance = generateNewProcessInstance(processDefinition, command, cmdParam); }else{ processInstance = this.findProcessInstanceDetailById(processInstanceId);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
} processDefinition = processDefineMapper.selectById(processInstance.getProcessDefinitionId()); processInstance.setProcessDefinition(processDefinition); if(processInstance.getCommandParam() != null){ Map<String, String> processCmdParam = JSONUtils.toMap(processInstance.getCommandParam()); for(Map.Entry<String, String> entry: processCmdParam.entrySet()) { if(!cmdParam.containsKey(entry.getKey())){ cmdParam.put(entry.getKey(), entry.getValue()); } } } if(cmdParam.containsKey(Constants.CMDPARAM_SUB_PROCESS)){ processInstance.setCommandParam(command.getCommandParam()); } }else{ processInstance = generateNewProcessInstance(processDefinition, command, cmdParam); } if(!checkCmdParam(command, cmdParam)){ logger.error("command parameter check failed!"); return null; } if(command.getScheduleTime() != null){ processInstance.setScheduleTime(command.getScheduleTime()); } processInstance.setHost(host); ExecutionStatus runStatus = ExecutionStatus.RUNNING_EXEUTION; int runTime = processInstance.getRunTimes();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
switch (commandType){ case START_PROCESS: break; case START_FAILURE_TASK_PROCESS: List<Integer> failedList = this.findTaskIdByInstanceState(processInstance.getId(), ExecutionStatus.FAILURE); List<Integer> toleranceList = this.findTaskIdByInstanceState(processInstance.getId(), ExecutionStatus.NEED_FAULT_TOLERANCE); List<Integer> killedList = this.findTaskIdByInstanceState(processInstance.getId(), ExecutionStatus.KILL); cmdParam.remove(Constants.CMDPARAM_RECOVERY_START_NODE_STRING); failedList.addAll(killedList); failedList.addAll(toleranceList); for(Integer taskId : failedList){ initTaskInstance(this.findTaskInstanceById(taskId)); } cmdParam.put(Constants.CMDPARAM_RECOVERY_START_NODE_STRING, String.join(Constants.COMMA, convertIntListToString(failedList))); processInstance.setCommandParam(JSONUtils.toJson(cmdParam)); processInstance.setRunTimes(runTime +1 ); break; case START_CURRENT_TASK_PROCESS: break; case RECOVER_WAITTING_THREAD: break; case RECOVER_SUSPENDED_PROCESS: cmdParam.remove(Constants.CMDPARAM_RECOVERY_START_NODE_STRING); List<Integer> suspendedNodeList = this.findTaskIdByInstanceState(processInstance.getId(), ExecutionStatus.PAUSE); List<Integer> stopNodeList = findTaskIdByInstanceState(processInstance.getId(), ExecutionStatus.KILL); suspendedNodeList.addAll(stopNodeList);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
for(Integer taskId : suspendedNodeList){ initTaskInstance(this.findTaskInstanceById(taskId)); } cmdParam.put(Constants.CMDPARAM_RECOVERY_START_NODE_STRING, String.join(",", convertIntListToString(suspendedNodeList))); processInstance.setCommandParam(JSONUtils.toJson(cmdParam)); processInstance.setRunTimes(runTime +1); break; case RECOVER_TOLERANCE_FAULT_PROCESS: processInstance.setRecovery(Flag.YES); runStatus = processInstance.getState(); break; case COMPLEMENT_DATA: List<TaskInstance> taskInstanceList = this.findValidTaskListByProcessId(processInstance.getId()); for(TaskInstance taskInstance : taskInstanceList){ taskInstance.setFlag(Flag.NO); this.updateTaskInstance(taskInstance); } break; case REPEAT_RUNNING: if(cmdParam.containsKey(Constants.CMDPARAM_RECOVERY_START_NODE_STRING)){ cmdParam.remove(Constants.CMDPARAM_RECOVERY_START_NODE_STRING); processInstance.setCommandParam(JSONUtils.toJson(cmdParam)); } List<TaskInstance> validTaskList = findValidTaskListByProcessId(processInstance.getId()); for(TaskInstance taskInstance : validTaskList){
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
taskInstance.setFlag(Flag.NO); updateTaskInstance(taskInstance); } processInstance.setStartTime(new Date()); processInstance.setEndTime(null); processInstance.setRunTimes(runTime +1); initComplementDataParam(processDefinition, processInstance, cmdParam); break; case SCHEDULER: break; default: break; } processInstance.setState(runStatus); return processInstance; } /** * return complement data if the process start with complement data * @param processInstance processInstance * @param command command * @return command type */ private CommandType getCommandTypeIfComplement(ProcessInstance processInstance, Command command){ if(CommandType.COMPLEMENT_DATA == processInstance.getCmdTypeIfComplement()){ return CommandType.COMPLEMENT_DATA; }else{ return command.getCommandType(); } } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
* initialize complement data parameters * @param processDefinition processDefinition * @param processInstance processInstance * @param cmdParam cmdParam */ private void initComplementDataParam(ProcessDefinition processDefinition, ProcessInstance processInstance, Map<String, String> cmdParam) { if(!processInstance.isComplementData()){ return; } Date startComplementTime = DateUtils.parse(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE), YYYY_MM_DD_HH_MM_SS); processInstance.setScheduleTime(startComplementTime); processInstance.setGlobalParams(ParameterUtils.curingGlobalParams( processDefinition.getGlobalParamMap(), processDefinition.getGlobalParamList(), CommandType.COMPLEMENT_DATA, processInstance.getScheduleTime())); } /** * set sub work process parameters. * handle sub work process instance, update relation table and command parameters * set sub work process flag, extends parent work process command parameters * @param subProcessInstance subProcessInstance * @return process instance */ public ProcessInstance setSubProcessParam(ProcessInstance subProcessInstance){ String cmdParam = subProcessInstance.getCommandParam(); if(StringUtils.isEmpty(cmdParam)){ return subProcessInstance;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
} Map<String, String> paramMap = JSONUtils.toMap(cmdParam); if(paramMap.containsKey(CMDPARAM_SUB_PROCESS) && CMDPARAM_EMPTY_SUB_PROCESS.equals(paramMap.get(CMDPARAM_SUB_PROCESS))){ paramMap.remove(CMDPARAM_SUB_PROCESS); paramMap.put(CMDPARAM_SUB_PROCESS, String.valueOf(subProcessInstance.getId())); subProcessInstance.setCommandParam(JSONUtils.toJson(paramMap)); subProcessInstance.setIsSubProcess(Flag.YES); this.saveProcessInstance(subProcessInstance); } String parentInstanceId = paramMap.get(CMDPARAM_SUB_PROCESS_PARENT_INSTANCE_ID); if(StringUtils.isNotEmpty(parentInstanceId)){ ProcessInstance parentInstance = findProcessInstanceDetailById(Integer.parseInt(parentInstanceId)); if(parentInstance != null){ subProcessInstance.setGlobalParams( joinGlobalParams(parentInstance.getGlobalParams(), subProcessInstance.getGlobalParams())); this.saveProcessInstance(subProcessInstance); }else{ logger.error("sub process command params error, cannot find parent instance: {} ", cmdParam); } } ProcessInstanceMap processInstanceMap = JSONUtils.parseObject(cmdParam, ProcessInstanceMap.class); if(processInstanceMap == null || processInstanceMap.getParentProcessInstanceId() == 0){ return subProcessInstance; } processInstanceMap.setProcessInstanceId(subProcessInstance.getId()); this.updateWorkProcessInstanceMap(processInstanceMap);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
return subProcessInstance; } /** * join parent global params into sub process. * only the keys doesn't in sub process global would be joined. * @param parentGlobalParams parentGlobalParams * @param subGlobalParams subGlobalParams * @return global params join */ private String joinGlobalParams(String parentGlobalParams, String subGlobalParams){ List<Property> parentPropertyList = JSONUtils.toList(parentGlobalParams, Property.class); List<Property> subPropertyList = JSONUtils.toList(subGlobalParams, Property.class); Map<String,String> subMap = subPropertyList.stream().collect(Collectors.toMap(Property::getProp, Property::getValue)); for(Property parent : parentPropertyList){ if(!subMap.containsKey(parent.getProp())){ subPropertyList.add(parent); } } return JSONUtils.toJson(subPropertyList); } /** * initialize task instance * @param taskInstance taskInstance */ private void initTaskInstance(TaskInstance taskInstance){ if(!taskInstance.isSubProcess()){ if(taskInstance.getState().typeIsCancel() || taskInstance.getState().typeIsFailure()){ taskInstance.setFlag(Flag.NO); updateTaskInstance(taskInstance); return;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
} } taskInstance.setState(ExecutionStatus.SUBMITTED_SUCCESS); updateTaskInstance(taskInstance); } /** * submit task to db * submit sub process to command * @param taskInstance taskInstance * @return task instance */ @Transactional(rollbackFor = Exception.class) public TaskInstance submitTask(TaskInstance taskInstance){ ProcessInstance processInstance = this.findProcessInstanceDetailById(taskInstance.getProcessInstanceId()); logger.info("start submit task : {}, instance id:{}, state: {}", taskInstance.getName(), taskInstance.getProcessInstanceId(), processInstance.getState()); TaskInstance task = submitTaskInstanceToDB(taskInstance, processInstance); if(task == null){ logger.error("end submit task to db error, task name:{}, process id:{} state: {} ", taskInstance.getName(), taskInstance.getProcessInstance(), processInstance.getState()); return task; } if(!task.getState().typeIsFinished()){ createSubWorkProcessCommand(processInstance, task); } logger.info("end submit task to db successfully:{} state:{} complete, instance id:{} state: {} ", taskInstance.getName(), task.getState(), processInstance.getId(), processInstance.getState()); return task; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
/** * set work process instance map * @param parentInstance parentInstance * @param parentTask parentTask * @return process instance map */ private ProcessInstanceMap setProcessInstanceMap(ProcessInstance parentInstance, TaskInstance parentTask){ ProcessInstanceMap processMap = findWorkProcessMapByParent(parentInstance.getId(), parentTask.getId()); if(processMap != null){ return processMap; }else if(parentInstance.getCommandType() == CommandType.REPEAT_RUNNING || parentInstance.isComplementData()){ processMap = findPreviousTaskProcessMap(parentInstance, parentTask); if(processMap!= null){ processMap.setParentTaskInstanceId(parentTask.getId()); updateWorkProcessInstanceMap(processMap); return processMap; } } processMap = new ProcessInstanceMap(); processMap.setParentProcessInstanceId(parentInstance.getId()); processMap.setParentTaskInstanceId(parentTask.getId()); createWorkProcessInstanceMap(processMap); return processMap; } /** * find previous task work process map.
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
2,581
[BUG] When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement
*For better global communication, please give priority to using English description, thx! * **Describe the bug** When the process involves sub-processes, the complement operation will only take the start time, and will repeat the number of days to perform the complement. **To Reproduce** Steps to reproduce the behavior, for example: 1. Create a simple sub-process, such as a shell 2. Create another main process and associate sub-processes 3. For complement operation, you can also make up only two days The specific operation is as follows: 1. Create subprocess, ![image](https://user-images.githubusercontent.com/10054719/80662237-5e165880-8ac3-11ea-9e47-ea97af1179ab.png) 2. Save subprocess and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662384-b6e5f100-8ac3-11ea-84f5-a307acc79f88.png) 3. Create the main process and create sub node as in main process ![image](https://user-images.githubusercontent.com/10054719/80662453-d715b000-8ac3-11ea-8186-b7a92a709c79.png) ![image](https://user-images.githubusercontent.com/10054719/80662492-f0b6f780-8ac3-11ea-9c0c-ed628b82772c.png) 4. Save main process and setting variables ![image](https://user-images.githubusercontent.com/10054719/80662523-07f5e500-8ac4-11ea-8b15-8df097cc5c76.png) 5. As follow. ![image](https://user-images.githubusercontent.com/10054719/80662545-193ef180-8ac4-11ea-8343-802808ad278f.png) 6. Then complement ![image](https://user-images.githubusercontent.com/10054719/80662594-3b387400-8ac4-11ea-96b1-75fa364ca167.png) 7. The result is as follows, the date printed is only the start date ![image](https://user-images.githubusercontent.com/10054719/80662665-67ec8b80-8ac4-11ea-9ae2-d082087efe6b.png) ![image](https://user-images.githubusercontent.com/10054719/80662670-6d49d600-8ac4-11ea-8487-608327a30654.png) ![image](https://user-images.githubusercontent.com/10054719/80662674-70dd5d00-8ac4-11ea-914d-096c12cbfb9c.png) 8. The timing of the main process is correct ![image](https://user-images.githubusercontent.com/10054719/80662741-9bc7b100-8ac4-11ea-9d4d-e05c54ca5a86.png) **Which version of Dolphin Scheduler:** -[1.2.1] - Stand-alone deployment
https://github.com/apache/dolphinscheduler/issues/2581
https://github.com/apache/dolphinscheduler/pull/2656
050dae7ca4a1b6243fbc0dd9c4018d45e1655566
d54aab5cd530b2e135a58fbd6b22564583b5abb8
"2020-04-30T01:27:32Z"
java
"2020-05-09T07:03:02Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
* @param parentProcessInstance parentProcessInstance * @param parentTask parentTask * @return process instance map */ private ProcessInstanceMap findPreviousTaskProcessMap(ProcessInstance parentProcessInstance, TaskInstance parentTask) { Integer preTaskId = 0; List<TaskInstance> preTaskList = this.findPreviousTaskListByWorkProcessId(parentProcessInstance.getId()); for(TaskInstance task : preTaskList){ if(task.getName().equals(parentTask.getName())){ preTaskId = task.getId(); ProcessInstanceMap map = findWorkProcessMapByParent(parentProcessInstance.getId(), preTaskId); if(map!=null){ return map; } } } logger.info("sub process instance is not found,parent task:{},parent instance:{}", parentTask.getId(), parentProcessInstance.getId()); return null; } /** * create sub work process command * @param parentProcessInstance parentProcessInstance * @param task task */ private void createSubWorkProcessCommand(ProcessInstance parentProcessInstance, TaskInstance task){ if(!task.isSubProcess()){ return;