status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
233
body
stringlengths
0
186k
issue_url
stringlengths
38
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
unknown
language
stringclasses
5 values
commit_datetime
unknown
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,037
[Bug] [Data Supplement] process instance can not be killed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Starting a job with data supplement in proccess definition ui. Stopping process instance with stop button in process instance list ui. Not only did it not stop, it also restart the same task instance. ### What you expected to happen stopping process instance successfully. ### How to reproduce Starting a job with data supplement in proccess definition ui. Stopping process instance with stop button in process instance list ui. ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7037
https://github.com/apache/dolphinscheduler/pull/7140
3361d763c4af1b387602dfc97a5a57961b5a7c43
d83735ab5191f37bfb90b9cb3d534386f7792fbf
"2021-11-29T07:07:51Z"
java
"2021-12-05T07:03:52Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
* * @return recovery node code lst */ prvate Lst<Strng> getRecoveryNodeCodeLst(Lst<TaskInstance> recoverNodeLst) { Lst<Strng> recoveryNodeCodeLst = new ArrayLst<>(); f (CollectonUtls.sNotEmpty(recoverNodeLst)) { for (TaskInstance task : recoverNodeLst) { recoveryNodeCodeLst.add(Long.toStrng(task.getTaskCode())); } } return recoveryNodeCodeLst; } /** * generate flow dag * * @param totalTaskNodeLst total task node lst * @param startNodeNameLst start node name lst * @param recoveryNodeCodeLst recovery node code lst * @param depNodeType depend node type * @return ProcessDag process dag * @throws Excepton excepton */ publc ProcessDag generateFlowDag(Lst<TaskNode> totalTaskNodeLst, Lst<Strng> startNodeNameLst, Lst<Strng> recoveryNodeCodeLst, TaskDependType depNodeType) throws Excepton { return DagHelper.generateFlowDag(totalTaskNodeLst, startNodeNameLst, recoveryNodeCodeLst, depNodeType); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.service.impl; import static org.apache.dolphinscheduler.common.Constants.ALIAS; import static org.apache.dolphinscheduler.common.Constants.CONTENT; import static org.apache.dolphinscheduler.common.Constants.JAR;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
import org.apache.dolphinscheduler.api.dto.resources.ResourceComponent; import org.apache.dolphinscheduler.api.dto.resources.filter.ResourceFilter; import org.apache.dolphinscheduler.api.dto.resources.visitor.ResourceTreeVisitor; import org.apache.dolphinscheduler.api.dto.resources.visitor.Visitor; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.exceptions.ServiceException; import org.apache.dolphinscheduler.api.service.ResourcesService; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.RegexUtils; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ProgramType; import org.apache.dolphinscheduler.spi.enums.ResourceType; import org.apache.dolphinscheduler.common.utils.FileUtils; import org.apache.dolphinscheduler.common.utils.HadoopUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.PropertyUtils; import org.apache.dolphinscheduler.dao.entity.Resource; import org.apache.dolphinscheduler.dao.entity.ResourcesUser; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.UdfFunc; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ResourceMapper; import org.apache.dolphinscheduler.dao.mapper.ResourceUserMapper; import org.apache.dolphinscheduler.dao.mapper.TenantMapper; import org.apache.dolphinscheduler.dao.mapper.UdfFuncMapper; import org.apache.dolphinscheduler.dao.mapper.UserMapper; import org.apache.dolphinscheduler.dao.utils.ResourceProcessDefinitionUtils; import org.apache.commons.beanutils.BeanMap;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; import java.io.IOException; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; import java.util.regex.Matcher; import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DuplicateKeyException; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fasterxml.jackson.databind.SerializationFeature; import com.google.common.io.Files; /** * resources service impl */ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesService { private static final Logger logger = LoggerFactory.getLogger(ResourcesServiceImpl.class); @Autowired private ResourceMapper resourcesMapper; @Autowired private UdfFuncMapper udfFunctionMapper; @Autowired private TenantMapper tenantMapper; @Autowired private UserMapper userMapper; @Autowired private ResourceUserMapper resourceUserMapper; @Autowired private ProcessDefinitionMapper processDefinitionMapper; /** * create directory * * @param loginUser login user * @param name alias * @param description description * @param type type * @param pid parent id * @param currentDir current directory * @return create directory result */ @Override @Transactional(rollbackFor = Exception.class) public Result<Object> createDirectory(User loginUser, String name, String description,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
ResourceType type, int pid, String currentDir) { Result<Object> result = checkResourceUploadStartupState(); if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result; } String fullName = currentDir.equals("/") ? String.format("%s%s",currentDir,name) : String.format("%s/%s",currentDir,name); result = verifyResource(loginUser, type, fullName, pid); if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result; } if (checkResourceExists(fullName, type.ordinal())) { logger.error("resource directory {} has exist, can't recreate", fullName); putMsg(result, Status.RESOURCE_EXIST); return result; } Date now = new Date(); Resource resource = new Resource(pid,name,fullName,true,description,name,loginUser.getId(),type,0,now,now); try { resourcesMapper.insert(resource); putMsg(result, Status.SUCCESS); Map<Object, Object> dataMap = new BeanMap(resource); Map<String, Object> resultMap = new HashMap<>(); for (Map.Entry<Object, Object> entry: dataMap.entrySet()) { if (!"class".equalsIgnoreCase(entry.getKey().toString())) { resultMap.put(entry.getKey().toString(), entry.getValue()); } } result.setData(resultMap);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
} catch (DuplicateKeyException e) { logger.error("resource directory {} has exist, can't recreate", fullName); putMsg(result, Status.RESOURCE_EXIST); return result; } catch (Exception e) { logger.error("resource already exists, can't recreate ", e); throw new ServiceException("resource already exists, can't recreate"); } createDirectory(loginUser,fullName,type,result); return result; } /** * create resource * * @param loginUser login user * @param name alias * @param desc description * @param file file * @param type type * @param pid parent id * @param currentDir current directory * @return create result code */ @Override @Transactional(rollbackFor = Exception.class) public Result<Object> createResource(User loginUser, String name, String desc, ResourceType type,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
MultipartFile file, int pid, String currentDir) { Result<Object> result = checkResourceUploadStartupState(); if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result; } result = verifyPid(loginUser, pid); if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result; } result = verifyFile(name, type, file); if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result; } String fullName = currentDir.equals("/") ? String.format("%s%s",currentDir,name) : String.format("%s/%s",currentDir,name); if (checkResourceExists(fullName, type.ordinal())) { logger.error("resource {} has exist, can't recreate", RegexUtils.escapeNRT(name)); putMsg(result, Status.RESOURCE_EXIST); return result; } Date now = new Date(); Resource resource = new Resource(pid,name,fullName,false,desc,file.getOriginalFilename(),loginUser.getId(),type,file.getSize(),now,now); try { resourcesMapper.insert(resource); putMsg(result, Status.SUCCESS); Map<Object, Object> dataMap = new BeanMap(resource); Map<String, Object> resultMap = new HashMap<>(); for (Map.Entry<Object, Object> entry: dataMap.entrySet()) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
if (!"class".equalsIgnoreCase(entry.getKey().toString())) { resultMap.put(entry.getKey().toString(), entry.getValue()); } } result.setData(resultMap); } catch (Exception e) { logger.error("resource already exists, can't recreate ", e); throw new ServiceException("resource already exists, can't recreate"); } if (!upload(loginUser, fullName, file, type)) { logger.error("upload resource: {} file: {} failed.", RegexUtils.escapeNRT(name), RegexUtils.escapeNRT(file.getOriginalFilename())); putMsg(result, Status.HDFS_OPERATION_ERROR); throw new ServiceException(String.format("upload resource: %s file: %s failed.", name, file.getOriginalFilename())); } return result; } /** * check resource is exists * * @param fullName fullName * @param type type * @return true if resource exists */ private boolean checkResourceExists(String fullName, int type) { Boolean existResource = resourcesMapper.existResource(fullName, type); return existResource == Boolean.TRUE; } /** * update resource
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
* @param loginUser login user * @param resourceId resource id * @param name name * @param desc description * @param type resource type * @param file resource file * @return update result code */ @Override @Transactional(rollbackFor = Exception.class) public Result<Object> updateResource(User loginUser, int resourceId, String name, String desc, ResourceType type, MultipartFile file) { Result<Object> result = checkResourceUploadStartupState(); if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result; } Resource resource = resourcesMapper.selectById(resourceId); if (resource == null) { putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } if (!hasPerm(loginUser, resource.getUserId())) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } if (file == null && name.equals(resource.getAlias()) && desc.equals(resource.getDescription())) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
putMsg(result, Status.SUCCESS); return result; } String originFullName = resource.getFullName(); String originResourceName = resource.getAlias(); String fullName = String.format("%s%s",originFullName.substring(0,originFullName.lastIndexOf("/") + 1),name); if (!originResourceName.equals(name) && checkResourceExists(fullName, type.ordinal())) { logger.error("resource {} already exists, can't recreate", name); putMsg(result, Status.RESOURCE_EXIST); return result; } result = verifyFile(name, type, file); if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result; } String tenantCode = getTenantCode(resource.getUserId(),result); if (StringUtils.isEmpty(tenantCode)) { return result; } String originHdfsFileName = HadoopUtils.getHdfsFileName(resource.getType(),tenantCode,originFullName); try { if (!HadoopUtils.getInstance().exists(originHdfsFileName)) { logger.error("{} not exist", originHdfsFileName); putMsg(result,Status.RESOURCE_NOT_EXIST); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
} catch (IOException e) { logger.error(e.getMessage(),e); throw new ServiceException(Status.HDFS_OPERATION_ERROR); } if (!resource.isDirectory()) { String originSuffix = Files.getFileExtension(originFullName); String suffix = Files.getFileExtension(fullName); boolean suffixIsChanged = false; if (StringUtils.isBlank(suffix) && StringUtils.isNotBlank(originSuffix)) { suffixIsChanged = true; } if (StringUtils.isNotBlank(suffix) && !suffix.equals(originSuffix)) { suffixIsChanged = true; } if (suffixIsChanged) { Map<String, Object> columnMap = new HashMap<>(); columnMap.put("resources_id", resourceId); List<ResourcesUser> resourcesUsers = resourceUserMapper.selectByMap(columnMap); if (CollectionUtils.isNotEmpty(resourcesUsers)) { List<Integer> userIds = resourcesUsers.stream().map(ResourcesUser::getUserId).collect(Collectors.toList()); List<User> users = userMapper.selectBatchIds(userIds); String userNames = users.stream().map(User::getUserName).collect(Collectors.toList()).toString(); logger.error("resource is authorized to user {},suffix not allowed to be modified", userNames); putMsg(result,Status.RESOURCE_IS_AUTHORIZED,userNames); return result; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
} Date now = new Date(); resource.setAlias(name); resource.setFileName(name); resource.setFullName(fullName); resource.setDescription(desc); resource.setUpdateTime(now); if (file != null) { resource.setSize(file.getSize()); } try { resourcesMapper.updateById(resource); if (resource.isDirectory()) { List<Integer> childrenResource = listAllChildren(resource,false); if (CollectionUtils.isNotEmpty(childrenResource)) { String matcherFullName = Matcher.quoteReplacement(fullName); List<Resource> childResourceList; Integer[] childResIdArray = childrenResource.toArray(new Integer[childrenResource.size()]); List<Resource> resourceList = resourcesMapper.listResourceByIds(childResIdArray); childResourceList = resourceList.stream().map(t -> { t.setFullName(t.getFullName().replaceFirst(originFullName, matcherFullName)); t.setUpdateTime(now); return t; }).collect(Collectors.toList()); resourcesMapper.batchUpdateResource(childResourceList); if (ResourceType.UDF.equals(resource.getType())) { List<UdfFunc> udfFuncs = udfFunctionMapper.listUdfByResourceId(childResIdArray); if (CollectionUtils.isNotEmpty(udfFuncs)) { udfFuncs = udfFuncs.stream().map(t -> {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
t.setResourceName(t.getResourceName().replaceFirst(originFullName, matcherFullName)); t.setUpdateTime(now); return t; }).collect(Collectors.toList()); udfFunctionMapper.batchUpdateUdfFunc(udfFuncs); } } } } else if (ResourceType.UDF.equals(resource.getType())) { List<UdfFunc> udfFuncs = udfFunctionMapper.listUdfByResourceId(new Integer[]{resourceId}); if (CollectionUtils.isNotEmpty(udfFuncs)) { udfFuncs = udfFuncs.stream().map(t -> { t.setResourceName(fullName); t.setUpdateTime(now); return t; }).collect(Collectors.toList()); udfFunctionMapper.batchUpdateUdfFunc(udfFuncs); } } putMsg(result, Status.SUCCESS); Map<Object, Object> dataMap = new BeanMap(resource); Map<String, Object> resultMap = new HashMap<>(); for (Map.Entry<Object, Object> entry: dataMap.entrySet()) { if (!Constants.CLASS.equalsIgnoreCase(entry.getKey().toString())) { resultMap.put(entry.getKey().toString(), entry.getValue()); } } result.setData(resultMap); } catch (Exception e) { logger.error(Status.UPDATE_RESOURCE_ERROR.getMsg(), e);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
throw new ServiceException(Status.UPDATE_RESOURCE_ERROR); } if (originResourceName.equals(name) && file == null) { return result; } if (file != null) { if (!upload(loginUser, fullName, file, type)) { logger.error("upload resource: {} file: {} failed.", name, RegexUtils.escapeNRT(file.getOriginalFilename())); putMsg(result, Status.HDFS_OPERATION_ERROR); throw new ServiceException(String.format("upload resource: %s file: %s failed.", name, file.getOriginalFilename())); } if (!fullName.equals(originFullName)) { try { HadoopUtils.getInstance().delete(originHdfsFileName,false); } catch (IOException e) { logger.error(e.getMessage(),e); throw new ServiceException(String.format("delete resource: %s failed.", originFullName)); } } return result; } String destHdfsFileName = HadoopUtils.getHdfsFileName(resource.getType(),tenantCode,fullName); try { logger.info("start hdfs copy {} -> {}", originHdfsFileName, destHdfsFileName); HadoopUtils.getInstance().copy(originHdfsFileName, destHdfsFileName, true, true); } catch (Exception e) { logger.error(MessageFormat.format("hdfs copy {0} -> {1} fail", originHdfsFileName, destHdfsFileName), e);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
putMsg(result,Status.HDFS_COPY_FAIL); throw new ServiceException(Status.HDFS_COPY_FAIL); } return result; } private Result<Object> verifyFile(String name, ResourceType type, MultipartFile file) { Result<Object> result = new Result<>(); putMsg(result, Status.SUCCESS); if (file != null) { if (file.isEmpty()) { logger.error("file is empty: {}", RegexUtils.escapeNRT(file.getOriginalFilename())); putMsg(result, Status.RESOURCE_FILE_IS_EMPTY); return result; } String fileSuffix = Files.getFileExtension(file.getOriginalFilename()); String nameSuffix = Files.getFileExtension(name); if (!(StringUtils.isNotEmpty(fileSuffix) && fileSuffix.equalsIgnoreCase(nameSuffix))) { logger.error("rename file suffix and original suffix must be consistent: {}", RegexUtils.escapeNRT(file.getOriginalFilename())); putMsg(result, Status.RESOURCE_SUFFIX_FORBID_CHANGE); return result; } if (Constants.UDF.equals(type.name()) && !JAR.equalsIgnoreCase(fileSuffix)) { logger.error(Status.UDF_RESOURCE_SUFFIX_NOT_JAR.getMsg()); putMsg(result, Status.UDF_RESOURCE_SUFFIX_NOT_JAR); return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
} if (file.getSize() > Constants.MAX_FILE_SIZE) { logger.error("file size is too large: {}", RegexUtils.escapeNRT(file.getOriginalFilename())); putMsg(result, Status.RESOURCE_SIZE_EXCEED_LIMIT); return result; } } return result; } /** * query resources list paging * * @param loginUser login user * @param type resource type * @param searchVal search value * @param pageNo page number * @param pageSize page size * @return resource list page */ @Override public Result queryResourceListPaging(User loginUser, int directoryId, ResourceType type, String searchVal, Integer pageNo, Integer pageSize) { Result result = new Result(); Page<Resource> page = new Page<>(pageNo, pageSize); int userId = loginUser.getId(); if (isAdmin(loginUser)) { userId = 0; } if (directoryId != -1) { Resource directory = resourcesMapper.selectById(directoryId); if (directory == null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } } List<Integer> resourcesIds = resourceUserMapper.queryResourcesIdListByUserIdAndPerm(userId, 0); IPage<Resource> resourceIPage = resourcesMapper.queryResourcePaging(page, userId, directoryId, type.ordinal(), searchVal,resourcesIds); PageInfo<Resource> pageInfo = new PageInfo<>(pageNo, pageSize); pageInfo.setTotal((int)resourceIPage.getTotal()); pageInfo.setTotalList(resourceIPage.getRecords()); result.setData(pageInfo); putMsg(result,Status.SUCCESS); return result; } /** * create directory * @param loginUser login user * @param fullName full name * @param type resource type * @param result Result */ private void createDirectory(User loginUser,String fullName,ResourceType type,Result<Object> result) { String tenantCode = tenantMapper.queryById(loginUser.getTenantId()).getTenantCode(); String directoryName = HadoopUtils.getHdfsFileName(type,tenantCode,fullName); String resourceRootPath = HadoopUtils.getHdfsDir(type,tenantCode); try { if (!HadoopUtils.getInstance().exists(resourceRootPath)) { createTenantDirIfNotExists(tenantCode); } if (!HadoopUtils.getInstance().mkdir(directoryName)) { logger.error("create resource directory {} of hdfs failed",directoryName);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
putMsg(result,Status.HDFS_OPERATION_ERROR); throw new ServiceException(String.format("create resource directory: %s failed.", directoryName)); } } catch (Exception e) { logger.error("create resource directory {} of hdfs failed",directoryName); putMsg(result,Status.HDFS_OPERATION_ERROR); throw new ServiceException(String.format("create resource directory: %s failed.", directoryName)); } } /** * upload file to hdfs * * @param loginUser login user * @param fullName full name * @param file file */ private boolean upload(User loginUser, String fullName, MultipartFile file, ResourceType type) { String fileSuffix = Files.getFileExtension(file.getOriginalFilename()); String nameSuffix = Files.getFileExtension(fullName); if (!(StringUtils.isNotEmpty(fileSuffix) && fileSuffix.equalsIgnoreCase(nameSuffix))) { return false; } String tenantCode = tenantMapper.queryById(loginUser.getTenantId()).getTenantCode(); String localFilename = FileUtils.getUploadFilename(tenantCode, UUID.randomUUID().toString()); String hdfsFilename = HadoopUtils.getHdfsFileName(type,tenantCode,fullName);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
String resourcePath = HadoopUtils.getHdfsDir(type,tenantCode); try { if (!HadoopUtils.getInstance().exists(resourcePath)) { createTenantDirIfNotExists(tenantCode); } org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(file, localFilename); HadoopUtils.getInstance().copyLocalToHdfs(localFilename, hdfsFilename, true, true); } catch (Exception e) { FileUtils.deleteFile(localFilename); logger.error(e.getMessage(), e); return false; } return true; } /** * query resource list * * @param loginUser login user * @param type resource type * @return resource list */ @Override public Map<String, Object> queryResourceList(User loginUser, ResourceType type) { Map<String, Object> result = new HashMap<>(); List<Resource> allResourceList = queryAuthoredResourceList(loginUser, type); Visitor resourceTreeVisitor = new ResourceTreeVisitor(allResourceList); result.put(Constants.DATA_LIST, resourceTreeVisitor.visit().getChildren()); putMsg(result, Status.SUCCESS); return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
} /** * query resource list by program type * * @param loginUser login user * @param type resource type * @return resource list */ @Override public Map<String, Object> queryResourceByProgramType(User loginUser, ResourceType type, ProgramType programType) { Map<String, Object> result = new HashMap<>(); List<Resource> allResourceList = queryAuthoredResourceList(loginUser, type); String suffix = ".jar"; if (programType != null) { switch (programType) { case JAVA: case SCALA: break; case PYTHON: suffix = ".py"; break; default: } } List<Resource> resources = new ResourceFilter(suffix, new ArrayList<>(allResourceList)).filter(); Visitor resourceTreeVisitor = new ResourceTreeVisitor(resources); result.put(Constants.DATA_LIST, resourceTreeVisitor.visit().getChildren()); putMsg(result, Status.SUCCESS); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
/** * delete resource * * @param loginUser login user * @param resourceId resource id * @return delete result code * @throws IOException exception */ @Override @Transactional(rollbackFor = Exception.class) public Result<Object> delete(User loginUser, int resourceId) throws IOException { Result<Object> result = checkResourceUploadStartupState(); if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result; } Resource resource = resourcesMapper.selectById(resourceId); if (resource == null) { putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } if (!hasPerm(loginUser, resource.getUserId())) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } String tenantCode = getTenantCode(resource.getUserId(),result); if (StringUtils.isEmpty(tenantCode)) { return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
List<Map<String, Object>> list = processDefinitionMapper.listResources(); Map<Integer, Set<Long>> resourceProcessMap = ResourceProcessDefinitionUtils.getResourceProcessDefinitionMap(list); Set<Integer> resourceIdSet = resourceProcessMap.keySet(); List<Integer> allChildren = listAllChildren(resource,true); Integer[] needDeleteResourceIdArray = allChildren.toArray(new Integer[allChildren.size()]); if (resource.getType() == (ResourceType.UDF)) { List<UdfFunc> udfFuncs = udfFunctionMapper.listUdfByResourceId(needDeleteResourceIdArray); if (CollectionUtils.isNotEmpty(udfFuncs)) { logger.error("can't be deleted,because it is bound by UDF functions:{}", udfFuncs); putMsg(result,Status.UDF_RESOURCE_IS_BOUND,udfFuncs.get(0).getFuncName()); return result; } } if (resourceIdSet.contains(resource.getPid())) { logger.error("can't be deleted,because it is used of process definition"); putMsg(result, Status.RESOURCE_IS_USED); return result; } resourceIdSet.retainAll(allChildren); if (CollectionUtils.isNotEmpty(resourceIdSet)) { logger.error("can't be deleted,because it is used of process definition"); for (Integer resId : resourceIdSet) { logger.error("resource id:{} is used of process definition {}",resId,resourceProcessMap.get(resId)); } putMsg(result, Status.RESOURCE_IS_USED); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
String hdfsFilename = HadoopUtils.getHdfsFileName(resource.getType(), tenantCode, resource.getFullName()); resourcesMapper.deleteIds(needDeleteResourceIdArray); resourceUserMapper.deleteResourceUserArray(0, needDeleteResourceIdArray); HadoopUtils.getInstance().delete(hdfsFilename, true); putMsg(result, Status.SUCCESS); return result; } /** * verify resource by name and type * @param loginUser login user * @param fullName resource full name * @param type resource type * @return true if the resource name not exists, otherwise return false */ @Override public Result<Object> verifyResourceName(String fullName, ResourceType type, User loginUser) { Result<Object> result = new Result<>(); putMsg(result, Status.SUCCESS); if (checkResourceExists(fullName, type.ordinal())) { logger.error("resource type:{} name:{} has exist, can't create again.", type, RegexUtils.escapeNRT(fullName)); putMsg(result, Status.RESOURCE_EXIST); } else { Tenant tenant = tenantMapper.queryById(loginUser.getTenantId()); if (tenant != null) { String tenantCode = tenant.getTenantCode(); try { String hdfsFilename = HadoopUtils.getHdfsFileName(type,tenantCode,fullName);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
if (HadoopUtils.getInstance().exists(hdfsFilename)) { logger.error("resource type:{} name:{} has exist in hdfs {}, can't create again.", type, RegexUtils.escapeNRT(fullName), hdfsFilename); putMsg(result, Status.RESOURCE_FILE_EXIST,hdfsFilename); } } catch (Exception e) { logger.error(e.getMessage(),e); putMsg(result,Status.HDFS_OPERATION_ERROR); } } else { putMsg(result,Status.CURRENT_LOGIN_USER_TENANT_NOT_EXIST); } } return result; } /** * verify resource by full name or pid and type * @param fullName resource full name * @param id resource id * @param type resource type * @return true if the resource full name or pid not exists, otherwise return false */ @Override public Result<Object> queryResource(String fullName, Integer id, ResourceType type) { Result<Object> result = new Result<>(); if (StringUtils.isBlank(fullName) && id == null) { putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR); return result; } if (StringUtils.isNotBlank(fullName)) { List<Resource> resourceList = resourcesMapper.queryResource(fullName,type.ordinal());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
if (CollectionUtils.isEmpty(resourceList)) { putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } putMsg(result, Status.SUCCESS); result.setData(resourceList.get(0)); } else { Resource resource = resourcesMapper.selectById(id); if (resource == null) { putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } Resource parentResource = resourcesMapper.selectById(resource.getPid()); if (parentResource == null) { putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } putMsg(result, Status.SUCCESS); result.setData(parentResource); } return result; } /** * view resource file online * * @param resourceId resource id * @param skipLineNum skip line number * @param limit limit * @return resource content */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
@Override public Result<Object> readResource(int resourceId, int skipLineNum, int limit) { Result<Object> result = checkResourceUploadStartupState(); if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result; } Resource resource = resourcesMapper.selectById(resourceId); if (resource == null) { putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } String nameSuffix = Files.getFileExtension(resource.getAlias()); String resourceViewSuffixs = FileUtils.getResourceViewSuffixs(); if (StringUtils.isNotEmpty(resourceViewSuffixs)) { List<String> strList = Arrays.asList(resourceViewSuffixs.split(",")); if (!strList.contains(nameSuffix)) { logger.error("resource suffix {} not support view, resource id {}", nameSuffix, resourceId); putMsg(result, Status.RESOURCE_SUFFIX_NOT_SUPPORT_VIEW); return result; } } String tenantCode = getTenantCode(resource.getUserId(),result); if (StringUtils.isEmpty(tenantCode)) { return result; } String hdfsFileName = HadoopUtils.getHdfsResourceFileName(tenantCode, resource.getFullName()); logger.info("resource hdfs path is {}", hdfsFileName);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
try { if (HadoopUtils.getInstance().exists(hdfsFileName)) { List<String> content = HadoopUtils.getInstance().catFile(hdfsFileName, skipLineNum, limit); putMsg(result, Status.SUCCESS); Map<String, Object> map = new HashMap<>(); map.put(ALIAS, resource.getAlias()); map.put(CONTENT, String.join("\n", content)); result.setData(map); } else { logger.error("read file {} not exist in hdfs", hdfsFileName); putMsg(result, Status.RESOURCE_FILE_NOT_EXIST,hdfsFileName); } } catch (Exception e) { logger.error("Resource {} read failed", hdfsFileName, e); putMsg(result, Status.HDFS_OPERATION_ERROR); } return result; } /** * create resource file online * * @param loginUser login user * @param type resource type * @param fileName file name * @param fileSuffix file suffix * @param desc description * @param content content * @param pid pid * @param currentDir current directory * @return create result code
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
*/ @Override @Transactional(rollbackFor = Exception.class) public Result<Object> onlineCreateResource(User loginUser, ResourceType type, String fileName, String fileSuffix, String desc, String content,int pid,String currentDir) { Result<Object> result = checkResourceUploadStartupState(); if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result; } String nameSuffix = fileSuffix.trim(); String resourceViewSuffixs = FileUtils.getResourceViewSuffixs(); if (StringUtils.isNotEmpty(resourceViewSuffixs)) { List<String> strList = Arrays.asList(resourceViewSuffixs.split(",")); if (!strList.contains(nameSuffix)) { logger.error("resource suffix {} not support create", nameSuffix); putMsg(result, Status.RESOURCE_SUFFIX_NOT_SUPPORT_VIEW); return result; } } String name = fileName.trim() + "." + nameSuffix; String fullName = currentDir.equals("/") ? String.format("%s%s",currentDir,name) : String.format("%s/%s",currentDir,name); result = verifyResource(loginUser, type, fullName, pid); if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result; } Date now = new Date(); Resource resource = new Resource(pid,name,fullName,false,desc,name,loginUser.getId(),type,content.getBytes().length,now,now); resourcesMapper.insert(resource); putMsg(result, Status.SUCCESS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
Map<Object, Object> dataMap = new BeanMap(resource); Map<String, Object> resultMap = new HashMap<>(); for (Map.Entry<Object, Object> entry: dataMap.entrySet()) { if (!Constants.CLASS.equalsIgnoreCase(entry.getKey().toString())) { resultMap.put(entry.getKey().toString(), entry.getValue()); } } result.setData(resultMap); String tenantCode = tenantMapper.queryById(loginUser.getTenantId()).getTenantCode(); result = uploadContentToHdfs(fullName, tenantCode, content); if (!result.getCode().equals(Status.SUCCESS.getCode())) { throw new ServiceException(result.getMsg()); } return result; } private Result<Object> checkResourceUploadStartupState() { Result<Object> result = new Result<>(); putMsg(result, Status.SUCCESS); if (!PropertyUtils.getResUploadStartupState()) { logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState()); putMsg(result, Status.HDFS_NOT_STARTUP); return result; } return result; } private Result<Object> verifyResource(User loginUser, ResourceType type, String fullName, int pid) { Result<Object> result = verifyResourceName(fullName, type, loginUser); if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
} return verifyPid(loginUser, pid); } private Result<Object> verifyPid(User loginUser, int pid) { Result<Object> result = new Result<>(); putMsg(result, Status.SUCCESS); if (pid != -1) { Resource parentResource = resourcesMapper.selectById(pid); if (parentResource == null) { putMsg(result, Status.PARENT_RESOURCE_NOT_EXIST); return result; } if (!hasPerm(loginUser, parentResource.getUserId())) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } } return result; } /** * updateProcessInstance resource * * @param resourceId resource id * @param content content * @return update result cod */ @Override @Transactional(rollbackFor = Exception.class) public Result<Object> updateResourceContent(int resourceId, String content) { Result<Object> result = checkResourceUploadStartupState();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
if (!result.getCode().equals(Status.SUCCESS.getCode())) { return result; } Resource resource = resourcesMapper.selectById(resourceId); if (resource == null) { logger.error("read file not exist, resource id {}", resourceId); putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } String nameSuffix = Files.getFileExtension(resource.getAlias()); String resourceViewSuffixs = FileUtils.getResourceViewSuffixs(); if (StringUtils.isNotEmpty(resourceViewSuffixs)) { List<String> strList = Arrays.asList(resourceViewSuffixs.split(",")); if (!strList.contains(nameSuffix)) { logger.error("resource suffix {} not support updateProcessInstance, resource id {}", nameSuffix, resourceId); putMsg(result, Status.RESOURCE_SUFFIX_NOT_SUPPORT_VIEW); return result; } } String tenantCode = getTenantCode(resource.getUserId(),result); if (StringUtils.isEmpty(tenantCode)) { return result; } resource.setSize(content.getBytes().length); resource.setUpdateTime(new Date()); resourcesMapper.updateById(resource); result = uploadContentToHdfs(resource.getFullName(), tenantCode, content); if (!result.getCode().equals(Status.SUCCESS.getCode())) { throw new ServiceException(result.getMsg());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
} return result; } /** * @param resourceName resource name * @param tenantCode tenant code * @param content content * @return result */ private Result<Object> uploadContentToHdfs(String resourceName, String tenantCode, String content) { Result<Object> result = new Result<>(); String localFilename = ""; String hdfsFileName = ""; try { localFilename = FileUtils.getUploadFilename(tenantCode, UUID.randomUUID().toString()); if (!FileUtils.writeContent2File(content, localFilename)) { logger.error("file {} fail, content is {}", localFilename, RegexUtils.escapeNRT(content)); putMsg(result, Status.RESOURCE_NOT_EXIST); return result; } hdfsFileName = HadoopUtils.getHdfsResourceFileName(tenantCode, resourceName); String resourcePath = HadoopUtils.getHdfsResDir(tenantCode); logger.info("resource hdfs path is {}, resource dir is {}", hdfsFileName, resourcePath); HadoopUtils hadoopUtils = HadoopUtils.getInstance(); if (!hadoopUtils.exists(resourcePath)) { createTenantDirIfNotExists(tenantCode); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
if (hadoopUtils.exists(hdfsFileName)) { hadoopUtils.delete(hdfsFileName, false); } hadoopUtils.copyLocalToHdfs(localFilename, hdfsFileName, true, true); } catch (Exception e) { logger.error(e.getMessage(), e); result.setCode(Status.HDFS_OPERATION_ERROR.getCode()); result.setMsg(String.format("copy %s to hdfs %s fail", localFilename, hdfsFileName)); return result; } putMsg(result, Status.SUCCESS); return result; } /** * download file * * @param resourceId resource id * @return resource content * @throws IOException exception */ @Override public org.springframework.core.io.Resource downloadResource(int resourceId) throws IOException { if (!PropertyUtils.getResUploadStartupState()) { logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState()); throw new ServiceException("hdfs not startup"); } Resource resource = resourcesMapper.selectById(resourceId); if (resource == null) { logger.error("download file not exist, resource id {}", resourceId);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
return null; } if (resource.isDirectory()) { logger.error("resource id {} is directory,can't download it", resourceId); throw new ServiceException("can't download directory"); } int userId = resource.getUserId(); User user = userMapper.selectById(userId); if (user == null) { logger.error("user id {} not exists", userId); throw new ServiceException(String.format("resource owner id %d not exist",userId)); } Tenant tenant = tenantMapper.queryById(user.getTenantId()); if (tenant == null) { logger.error("tenant id {} not exists", user.getTenantId()); throw new ServiceException(String.format("The tenant id %d of resource owner not exist",user.getTenantId())); } String tenantCode = tenant.getTenantCode(); String hdfsFileName = HadoopUtils.getHdfsFileName(resource.getType(), tenantCode, resource.getFullName()); String localFileName = FileUtils.getDownloadFilename(resource.getAlias()); logger.info("resource hdfs path is {}, download local filename is {}", hdfsFileName, localFileName); HadoopUtils.getInstance().copyHdfsToLocal(hdfsFileName, localFileName, false, true); return org.apache.dolphinscheduler.api.utils.FileUtils.file2Resource(localFileName); } /** * list all file * * @param loginUser login user * @param userId user id * @return unauthorized result code
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
*/ @Override public Map<String, Object> authorizeResourceTree(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); if (isNotAdmin(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 */ @Override public Map<String, Object> unauthorizedFile(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); if (isNotAdmin(loginUser, result)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
return result; } List<Resource> resourceList = resourcesMapper.queryResourceExceptUserId(userId); List<Resource> list; if (resourceList != null && !resourceList.isEmpty()) { Set<Resource> resourceSet = new HashSet<>(resourceList); List<Resource> authedResourceList = queryResourceList(userId, Constants.AUTHORIZE_WRITABLE_PERM); 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 */ @Override public Map<String, Object> unauthorizedUDFFunction(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); if (isNotAdmin(loginUser, result)) { return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
} List<UdfFunc> udfFuncList = udfFunctionMapper.queryUdfFuncExceptUserId(userId); List<UdfFunc> resultList = new ArrayList<>(); Set<UdfFunc> udfFuncSet; 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 */ @Override public Map<String, Object> authorizedUDFFunction(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); if (isNotAdmin(loginUser, result)) { return result; } List<UdfFunc> udfFuncs = udfFunctionMapper.queryAuthedUdfFunc(userId); result.put(Constants.DATA_LIST, udfFuncs); putMsg(result, Status.SUCCESS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
return result; } /** * authorized file * * @param loginUser login user * @param userId user id * @return authorized result */ @Override public Map<String, Object> authorizedFile(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); if (isNotAdmin(loginUser, result)) { return result; } List<Resource> authedResources = queryResourceList(userId, Constants.AUTHORIZE_WRITABLE_PERM); Visitor visitor = new ResourceTreeVisitor(authedResources); String visit = JSONUtils.toJsonString(visitor.visit(), SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); logger.info(visit); String jsonTreeStr = JSONUtils.toJsonString(visitor.visit().getChildren(), SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS); 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
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
*/ private void getAuthorizedResourceList(Set<?> resourceSet, List<?> authedResourceList) { Set<?> authedResourceSet; if (CollectionUtils.isNotEmpty(authedResourceList)) { authedResourceSet = new HashSet<>(authedResourceList); resourceSet.removeAll(authedResourceSet); } } /** * get tenantCode by UserId * * @param userId user id * @param result return result * @return tenant code */ private String getTenantCode(int userId,Result<Object> result) { User user = userMapper.selectById(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.CURRENT_LOGIN_USER_TENANT_NOT_EXIST); return null; } return tenant.getTenantCode(); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.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 childId : children) { childList.add(childId); listAllChildren(childId, childList); } } /** * query authored resource list (own and authorized)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
* @param loginUser login user * @param type ResourceType * @return all authored resource list */ private List<Resource> queryAuthoredResourceList(User loginUser, ResourceType type) { List<Resource> relationResources; int userId = loginUser.getId(); if (isAdmin(loginUser)) { userId = 0; relationResources = new ArrayList<>(); } else { relationResources = queryResourceList(userId, 0); } List<Resource> ownResourceList = resourcesMapper.queryResourceListAuthored(userId, type.ordinal()); ownResourceList.addAll(relationResources); return ownResourceList; } /** * query resource list by userId and perm * @param userId userId * @param perm perm * @return resource list */ private List<Resource> queryResourceList(Integer userId, int perm) { List<Integer> resIds = resourceUserMapper.queryResourcesIdListByUserIdAndPerm(userId, perm); return CollectionUtils.isEmpty(resIds) ? new ArrayList<>() : resourcesMapper.queryResourceListById(resIds); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/FileUtils.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.utils; import org.apache.commons.io.IOUtils; import java.io.File;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/FileUtils.java
import java.io.IOException; import java.net.MalformedURLException; import java.nio.charset.StandardCharsets; import java.nio.file.Path; import java.nio.file.Paths; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.core.io.Resource; import org.springframework.core.io.UrlResource; import org.springframework.web.multipart.MultipartFile; /** * file utils */ public class FileUtils { private static final Logger logger = LoggerFactory.getLogger(FileUtils.class); /** * copy source file to target file * * @param file file * @param destFilename destination file name */ public static void copyFile(MultipartFile file, String destFilename) { try { org.apache.commons.io.FileUtils.copyFile(file.getResource().getFile(), new File(destFilename)); } catch (IOException e) { logger.error("failed to copy file , {} is empty file", file.getOriginalFilename(), e); } } /** * file to resource
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/FileUtils.java
* * @param filename file name * @return resource * @throws MalformedURLException io exceptions */ public static Resource file2Resource(String filename) throws MalformedURLException { Path file = Paths.get(filename); Resource resource = new UrlResource(file.toUri()); if (resource.exists() || resource.isReadable()) { return resource; } else { logger.error("file can not read : {}", filename); } return null; } /** * file convert String * @param file MultipartFile file * @return file content string */ public static String file2String(MultipartFile file) { try { return IOUtils.toString(file.getInputStream(), StandardCharsets.UTF_8); } catch (IOException e) { logger.error("file convert to string failed: {}", file.getName()); } return ""; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/utils/FileUtilsTest.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.utils; import org.apache.http.entity.ContentType; import org.junit.*; import org.junit.rules.TemporaryFolder; import org.mockito.Mockito; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.core.io.Resource; import org.springframework.mock.web.MockMultipartFile; import org.springframework.web.multipart.MultipartFile; import java.io.*; import static org.junit.Assert.*; public class FileUtilsTest {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/utils/FileUtilsTest.java
private static final Logger logger = LoggerFactory.getLogger(FileUtilsTest.class); @Rule public TemporaryFolder folder = null; private String rootPath = null; @Before
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/utils/FileUtilsTest.java
public void setUp() throws Exception { folder = new TemporaryFolder(); folder.create(); rootPath = folder.getRoot().getAbsolutePath(); } @After public void tearDown() throws Exception { folder.delete(); } /** * Use mock to test copyFile * @throws IOException */ @Test public void testCopyFile() throws IOException { String src = rootPath + System.getProperty("file.separator") + "src.txt"; String destFilename = rootPath + System.getProperty("file.separator") + "data.txt"; logger.info("destFilename: "+destFilename); String data = "data text"; org.apache.commons.io.FileUtils.writeStringToFile(new File(src), data); MultipartFile file = Mockito.mock(MultipartFile.class, Mockito.RETURNS_DEEP_STUBS); Mockito.when(file.getResource().getFile()).thenReturn(new File(src)); FileUtils.copyFile(file,destFilename); File destFile = new File(destFilename); assertTrue(destFile.exists());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,154
[Bug] [API] MultipartFile resource [file] cannot be resolved to absolute file path
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened The resource management function upload file is abnormal: ``` java.io.FileNotFoundException: MultipartFile resource [file] cannot be resolved to absolute file path at org.springframework.core.io.AbstractResource.getFile(AbstractResource.java:138) ~[spring-core-5.3.12.jar:5.3.12] at org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(FileUtils.java:48) ~[classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.upload(ResourcesServiceImpl.java:599) [classes/:na] at org.apache.dolphinscheduler.api.service.impl.ResourcesServiceImpl.createResource(ResourcesServiceImpl.java:238) [classes/:na] ``` ### What you expected to happen Upload files normally ### How to reproduce The resource management function upload file ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7154
https://github.com/apache/dolphinscheduler/pull/7155
3c8d1c6da91b23aa9106353829469f40899a7bed
8f77fbbeb8e2261365ebc6921a8095eb56243afb
"2021-12-03T10:05:33Z"
java
"2021-12-06T06:13:53Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/utils/FileUtilsTest.java
} @Test public void testFile2Resource() throws IOException { String destFilename = rootPath + System.getProperty("file.separator") + "data.txt"; logger.info("destFilename: "+destFilename); File file = folder.newFile("resource.txt"); Resource resource = FileUtils.file2Resource(file.getAbsolutePath()); assertNotNull(resource); Resource resource1 = FileUtils.file2Resource(file.getAbsolutePath()+"abc"); assertNull(resource1); } @Test public void testFile2String() throws IOException { String content = "123"; org.apache.commons.io.FileUtils.writeStringToFile(new File("/tmp/task.json"),content); File file = new File("/tmp/task.json"); FileInputStream fileInputStream = new FileInputStream("/tmp/task.json"); MultipartFile multipartFile = new MockMultipartFile(file.getName(), file.getName(), ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream); String resultStr = FileUtils.file2String(multipartFile); Assert.assertEquals(content, resultStr); boolean delete = file.delete(); Assert.assertTrue(delete); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,195
[Bug] [DAO] The wrong separator is used in the file path of 'sql/upgrade/2.0.1-schema'
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I initialized the database through the class of UpgradeDolphinScheduler, I encountered an error. The details is as follows: ``` java.lang.IllegalStateException: Failed to execute CommandLineRunner at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:794) ~[spring-boot-2.5.6.jar:2.5.6] at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:775) ~[spring-boot-2.5.6.jar:2.5.6] at org.springframework.boot.SpringApplication.run(SpringApplication.java:345) ~[spring-boot-2.5.6.jar:2.5.6] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:143) [spring-boot-2.5.6.jar:2.5.6] at org.apache.dolphinscheduler.dao.upgrade.shell.CreateDolphinScheduler.main(CreateDolphinScheduler.java:40) [dolphinscheduler-dao-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT] Caused by: java.lang.RuntimeException: java.lang.NumberFormatException: For input string: "1-schema" at org.apache.dolphinscheduler.dao.upgrade.SchemaUtils.lambda$getAllSchemaList$0(SchemaUtils.java:71) ~[dolphinscheduler-dao-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT] at java.util.TimSort.binarySort(TimSort.java:296) ~[na:1.8.0_312] at java.util.TimSort.sort(TimSort.java:221) ~[na:1.8.0_312] at java.util.Arrays.sort(Arrays.java:1512) ~[na:1.8.0_312] at java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:353) ~[na:1.8.0_312] at java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:1.8.0_312] at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:483) ~[na:1.8.0_312] at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[na:1.8.0_312] at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[na:1.8.0_312] at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_312] at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566) ~[na:1.8.0_312] at org.apache.dolphinscheduler.dao.upgrade.SchemaUtils.getAllSchemaList(SchemaUtils.java:73) ~[dolphinscheduler-dao-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT] at org.apache.dolphinscheduler.dao.upgrade.DolphinSchedulerManager.upgradeDolphinScheduler(DolphinSchedulerManager.java:75) ~[dolphinscheduler-dao-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT] at org.apache.dolphinscheduler.dao.upgrade.shell.CreateDolphinScheduler$CreateRunner.run(CreateDolphinScheduler.java:58) ~[dolphinscheduler-dao-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT] at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:791) ~[spring-boot-2.5.6.jar:2.5.6] ... 4 common frames omitted Caused by: java.lang.NumberFormatException: For input string: "1-schema" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[na:1.8.0_312] at java.lang.Integer.parseInt(Integer.java:580) ~[na:1.8.0_312] at java.lang.Integer.parseInt(Integer.java:615) ~[na:1.8.0_312] at org.apache.dolphinscheduler.dao.upgrade.SchemaUtils.isAGreatVersion(SchemaUtils.java:92) ~[dolphinscheduler-dao-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT] at org.apache.dolphinscheduler.dao.upgrade.SchemaUtils.lambda$getAllSchemaList$0(SchemaUtils.java:64) ~[dolphinscheduler-dao-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT] ... 18 common frames omitted ``` ### What you expected to happen I expect that the process of initializing database can be executed exactly and correctly. ### How to reproduce I've found this root cause that the wrong separator is used in the file path of 'sql/upgrade/2.0.1-schema'. ![image](https://user-images.githubusercontent.com/4928204/144785147-502b4b28-1ee3-41eb-966e-8f44883903cd.png) ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7195
https://github.com/apache/dolphinscheduler/pull/7200
c7b06b007922c387f7edcf4936a2568a04d35573
705ba74f529a50dbf700e528701b8c19bd65f028
"2021-12-06T04:00:37Z"
java
"2021-12-06T09:29:11Z"
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/upgrade/SchemaUtilsTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.dao.upgrade; import org.junit.Assert; import org.junit.Test; public class SchemaUtilsTest { @Test public void testIsAGreatVersion() { try { SchemaUtils.isAGreatVersion(null, null); } catch (RuntimeException e) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,195
[Bug] [DAO] The wrong separator is used in the file path of 'sql/upgrade/2.0.1-schema'
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When I initialized the database through the class of UpgradeDolphinScheduler, I encountered an error. The details is as follows: ``` java.lang.IllegalStateException: Failed to execute CommandLineRunner at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:794) ~[spring-boot-2.5.6.jar:2.5.6] at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:775) ~[spring-boot-2.5.6.jar:2.5.6] at org.springframework.boot.SpringApplication.run(SpringApplication.java:345) ~[spring-boot-2.5.6.jar:2.5.6] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:143) [spring-boot-2.5.6.jar:2.5.6] at org.apache.dolphinscheduler.dao.upgrade.shell.CreateDolphinScheduler.main(CreateDolphinScheduler.java:40) [dolphinscheduler-dao-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT] Caused by: java.lang.RuntimeException: java.lang.NumberFormatException: For input string: "1-schema" at org.apache.dolphinscheduler.dao.upgrade.SchemaUtils.lambda$getAllSchemaList$0(SchemaUtils.java:71) ~[dolphinscheduler-dao-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT] at java.util.TimSort.binarySort(TimSort.java:296) ~[na:1.8.0_312] at java.util.TimSort.sort(TimSort.java:221) ~[na:1.8.0_312] at java.util.Arrays.sort(Arrays.java:1512) ~[na:1.8.0_312] at java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:353) ~[na:1.8.0_312] at java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:1.8.0_312] at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:483) ~[na:1.8.0_312] at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[na:1.8.0_312] at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[na:1.8.0_312] at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_312] at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566) ~[na:1.8.0_312] at org.apache.dolphinscheduler.dao.upgrade.SchemaUtils.getAllSchemaList(SchemaUtils.java:73) ~[dolphinscheduler-dao-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT] at org.apache.dolphinscheduler.dao.upgrade.DolphinSchedulerManager.upgradeDolphinScheduler(DolphinSchedulerManager.java:75) ~[dolphinscheduler-dao-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT] at org.apache.dolphinscheduler.dao.upgrade.shell.CreateDolphinScheduler$CreateRunner.run(CreateDolphinScheduler.java:58) ~[dolphinscheduler-dao-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT] at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:791) ~[spring-boot-2.5.6.jar:2.5.6] ... 4 common frames omitted Caused by: java.lang.NumberFormatException: For input string: "1-schema" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[na:1.8.0_312] at java.lang.Integer.parseInt(Integer.java:580) ~[na:1.8.0_312] at java.lang.Integer.parseInt(Integer.java:615) ~[na:1.8.0_312] at org.apache.dolphinscheduler.dao.upgrade.SchemaUtils.isAGreatVersion(SchemaUtils.java:92) ~[dolphinscheduler-dao-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT] at org.apache.dolphinscheduler.dao.upgrade.SchemaUtils.lambda$getAllSchemaList$0(SchemaUtils.java:64) ~[dolphinscheduler-dao-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT] ... 18 common frames omitted ``` ### What you expected to happen I expect that the process of initializing database can be executed exactly and correctly. ### How to reproduce I've found this root cause that the wrong separator is used in the file path of 'sql/upgrade/2.0.1-schema'. ![image](https://user-images.githubusercontent.com/4928204/144785147-502b4b28-1ee3-41eb-966e-8f44883903cd.png) ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7195
https://github.com/apache/dolphinscheduler/pull/7200
c7b06b007922c387f7edcf4936a2568a04d35573
705ba74f529a50dbf700e528701b8c19bd65f028
"2021-12-06T04:00:37Z"
java
"2021-12-06T09:29:11Z"
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/upgrade/SchemaUtilsTest.java
Assert.assertEquals("schemaVersion or version is empty", e.getMessage()); } try { SchemaUtils.isAGreatVersion("", ""); } catch (RuntimeException e) { Assert.assertEquals("schemaVersion or version is empty", e.getMessage()); } Assert.assertFalse(SchemaUtils.isAGreatVersion("1", "1")); Assert.assertTrue(SchemaUtils.isAGreatVersion("2", "1")); Assert.assertTrue(SchemaUtils.isAGreatVersion("1.1", "1")); Assert.assertTrue(SchemaUtils.isAGreatVersion("1.1", "1.0.1")); Assert.assertFalse(SchemaUtils.isAGreatVersion("1.1", "1.2")); Assert.assertTrue(SchemaUtils.isAGreatVersion("1.1.1", "1.1")); Assert.assertTrue(SchemaUtils.isAGreatVersion("10.1.1", "1.01.100")); try { SchemaUtils.isAGreatVersion("10.1.1", ".1"); Assert.fail("Should fail"); } catch (Exception ignored) { } try { SchemaUtils.isAGreatVersion("a.1.1", "b.1"); Assert.fail("Should fail"); } catch (Exception ignored) { } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.server.master.runner; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.thread.Stopper; import org.apache.dolphinscheduler.common.thread.ThreadUtils; import org.apache.dolphinscheduler.common.utils.NetUtils; import org.apache.dolphinscheduler.common.utils.OSUtils; import org.apache.dolphinscheduler.dao.entity.Command; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.remote.NettyRemotingClient; import org.apache.dolphinscheduler.remote.config.NettyClientConfig;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
import org.apache.dolphinscheduler.server.master.cache.ProcessInstanceExecCacheManager; import org.apache.dolphinscheduler.server.master.config.MasterConfig; import org.apache.dolphinscheduler.server.master.dispatch.executor.NettyExecutorManager; import org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient; import org.apache.dolphinscheduler.server.master.registry.ServerNodeManager; import org.apache.dolphinscheduler.server.master.runner.task.TaskProcessorFactory; import org.apache.dolphinscheduler.service.alert.ProcessAlertManager; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.commons.collections4.CollectionUtils; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * master scheduler thread */ @Service public class MasterSchedulerService extends Thread { /** * logger of MasterSchedulerService */ private static final Logger logger = LoggerFactory.getLogger(MasterSchedulerService.class);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
/** * dolphinscheduler database interface */ @Autowired private ProcessService processService; @Autowired private TaskProcessorFactory taskProcessorFactory; /** * zookeeper master client */ @Autowired private MasterRegistryClient masterRegistryClient; /** * master config */ @Autowired private MasterConfig masterConfig; /** * alert manager */ @Autowired private ProcessAlertManager processAlertManager; /** * netty remoting client */ private NettyRemotingClient nettyRemotingClient; @Autowired NettyExecutorManager nettyExecutorManager; /** * master prepare exec service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
*/ private ThreadPoolExecutor masterPrepareExecService; /** * master exec service */ private ThreadPoolExecutor masterExecService; @Autowired private ProcessInstanceExecCacheManager processInstanceExecCacheManager; /** * process timeout check list */ ConcurrentHashMap<Integer, ProcessInstance> processTimeoutCheckList = new ConcurrentHashMap<>(); /** * task time out checkout list */ ConcurrentHashMap<Integer, TaskInstance> taskTimeoutCheckList = new ConcurrentHashMap<>(); private StateWheelExecuteThread stateWheelExecuteThread; /** * constructor of MasterSchedulerService */ public void init() { this.masterPrepareExecService = (ThreadPoolExecutor) ThreadUtils.newDaemonFixedThreadExecutor("Master-Pre-Exec-Thread", masterConfig.getPreExecThreads()); this.masterExecService = (ThreadPoolExecutor) ThreadUtils.newDaemonFixedThreadExecutor("Master-Exec-Thread", masterConfig.getExecThreads()); NettyClientConfig clientConfig = new NettyClientConfig(); this.nettyRemotingClient = new NettyRemotingClient(clientConfig); stateWheelExecuteThread = new StateWheelExecuteThread(processTimeoutCheckList, taskTimeoutCheckList, this.processInstanceExecCacheManager, masterConfig.getStateWheelInterval() * Constants.SLEEP_TIME_MILLIS); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
@Override public synchronized void start() { super.setName("MasterSchedulerService"); super.start(); this.stateWheelExecuteThread.start(); } public void close() { masterExecService.shutdown(); boolean terminated = false; try { terminated = masterExecService.awaitTermination(5, TimeUnit.SECONDS); } catch (InterruptedException ignore) { Thread.currentThread().interrupt(); } if (!terminated) { logger.warn("masterExecService shutdown without terminated, increase await time"); } nettyRemotingClient.close(); logger.info("master schedule service stopped..."); } /** * run of MasterSchedulerService */ @Override public void run() { logger.info("master scheduler started"); while (Stopper.isRunning()) { try { boolean runCheckFlag = OSUtils.checkResource(masterConfig.getMaxCpuLoadAvg(), masterConfig.getReservedMemory()); if (!runCheckFlag) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
Thread.sleep(Constants.SLEEP_TIME_MILLIS); continue; } scheduleProcess(); } catch (Exception e) { logger.error("master scheduler thread error", e); } } } /** * 1. get command by slot * 2. donot handle command if slot is empty */ private void scheduleProcess() throws Exception { List<Command> commands = findCommands(); if (CollectionUtils.isEmpty(commands)) { Thread.sleep(Constants.SLEEP_TIME_MILLIS); return; } List<ProcessInstance> processInstances = command2ProcessInstance(commands); if (CollectionUtils.isEmpty(processInstances)) { return; } for (ProcessInstance processInstance : processInstances) { if (processInstance == null) { continue; } WorkflowExecuteThread workflowExecuteThread = new WorkflowExecuteThread( processInstance
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
, processService , nettyExecutorManager , processAlertManager , masterConfig , taskTimeoutCheckList , taskProcessorFactory); this.processInstanceExecCacheManager.cache(processInstance.getId(), workflowExecuteThread); if (processInstance.getTimeout() > 0) { this.processTimeoutCheckList.put(processInstance.getId(), processInstance); } masterExecService.execute(workflowExecuteThread); } } private List<ProcessInstance> command2ProcessInstance(List<Command> commands) { if (CollectionUtils.isEmpty(commands)) { return null; } ProcessInstance[] processInstances = new ProcessInstance[commands.size()]; CountDownLatch latch = new CountDownLatch(commands.size()); for (int i = 0; i < commands.size(); i++) { int index = i; this.masterPrepareExecService.execute(() -> { Command command = commands.get(index); if (!slotCheck(command)) { latch.countDown(); return; } try { ProcessInstance processInstance = processService.handleCommand(logger,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
getLocalAddress(), command); if (processInstance != null) { processInstances[index] = processInstance; logger.info("handle command command {} end, create process instance {}", command.getId(), processInstance.getId()); } } catch (Exception e) { logger.error("scan command error ", e); processService.moveToErrorCommand(command, e.toString()); } finally { latch.countDown(); } }); } try { latch.await(); } catch (InterruptedException e) { logger.error("countDownLatch await error ", e); } return Arrays.asList(processInstances); } private List<Command> findCommands() { int pageNumber = 0; int pageSize = masterConfig.getFetchCommandNum(); List<Command> result = new ArrayList<>(); while (Stopper.isRunning()) { if (ServerNodeManager.MASTER_SIZE == 0) { return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
} List<Command> commandList = processService.findCommandPage(pageSize, pageNumber); if (commandList.size() == 0) { return result; } for (Command command : commandList) { if (slotCheck(command)) { result.add(command); } } if (CollectionUtils.isNotEmpty(result)) { logger.info("find {} commands, slot:{}", result.size(), ServerNodeManager.getSlot()); break; } pageNumber += 1; } return result; } private boolean slotCheck(Command command) { int slot = ServerNodeManager.getSlot(); if (ServerNodeManager.MASTER_SIZE != 0 && command.getId() % ServerNodeManager.MASTER_SIZE == slot) { return true; } return false; } private String getLocalAddress() { return NetUtils.getAddr(masterConfig.getListenPort()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.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
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java
*/ package org.apache.dolphinscheduler.server.master.runner; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.StateEvent; import org.apache.dolphinscheduler.common.enums.StateEventType; import org.apache.dolphinscheduler.common.enums.TimeoutFlag; import org.apache.dolphinscheduler.common.thread.Stopper; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.server.master.cache.ProcessInstanceExecCacheManager; import org.apache.hadoop.util.ThreadUtil; import java.util.concurrent.ConcurrentHashMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * 1. timeout check wheel * 2. dependent task check wheel */ public class StateWheelExecuteThread extends Thread { private static final Logger logger = LoggerFactory.getLogger(StateWheelExecuteThread.class); ConcurrentHashMap<Integer, ProcessInstance> processInstanceCheckList; ConcurrentHashMap<Integer, TaskInstance> taskInstanceCheckList; private ProcessInstanceExecCacheManager processInstanceExecCacheManager; private int stateCheckIntervalSecs; public StateWheelExecuteThread(ConcurrentHashMap<Integer, ProcessInstance> processInstances, ConcurrentHashMap<Integer, TaskInstance> taskInstances, ProcessInstanceExecCacheManager processInstanceExecCacheManager, int stateCheckIntervalSecs) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java
this.processInstanceCheckList = processInstances; this.taskInstanceCheckList = taskInstances; this.processInstanceExecCacheManager = processInstanceExecCacheManager; this.stateCheckIntervalSecs = stateCheckIntervalSecs; } @Override public void run() { logger.info("state wheel thread start"); while (Stopper.isRunning()) { try { checkProcess(); checkTask(); } catch (Exception e) { logger.error("state wheel thread check error:", e); } ThreadUtil.sleepAtLeastIgnoreInterrupts(stateCheckIntervalSecs); } } public boolean addProcess(ProcessInstance processInstance) { this.processInstanceCheckList.put(processInstance.getId(), processInstance); return true; } public boolean addTask(TaskInstance taskInstance) { this.taskInstanceCheckList.put(taskInstance.getId(), taskInstance); return true; } private void checkTask() { if (taskInstanceCheckList.isEmpty()) { return; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java
for (TaskInstance taskInstance : this.taskInstanceCheckList.values()) { if (TimeoutFlag.OPEN == taskInstance.getTaskDefine().getTimeoutFlag()) { long timeRemain = DateUtils.getRemainTime(taskInstance.getStartTime(), taskInstance.getTaskDefine().getTimeout() * Constants.SEC_2_MINUTES_TIME_UNIT); if (0 >= timeRemain && processTimeout(taskInstance)) { taskInstanceCheckList.remove(taskInstance.getId()); } } if (taskInstance.taskCanRetry() && taskInstance.retryTaskIntervalOverTime()) { processDependCheck(taskInstance); taskInstanceCheckList.remove(taskInstance.getId()); } if (taskInstance.isSubProcess() || taskInstance.isDependTask()) { processDependCheck(taskInstance); } } } private void checkProcess() { if (processInstanceCheckList.isEmpty()) { return; } for (ProcessInstance processInstance : this.processInstanceCheckList.values()) { long timeRemain = DateUtils.getRemainTime(processInstance.getStartTime(), processInstance.getTimeout() * Constants.SEC_2_MINUTES_TIME_UNIT); if (0 <= timeRemain && processTimeout(processInstance)) { processInstanceCheckList.remove(processInstance.getId()); } } } private void putEvent(StateEvent stateEvent) { if (!processInstanceExecCacheManager.contains(stateEvent.getProcessInstanceId())) { return;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java
} WorkflowExecuteThread workflowExecuteThread = this.processInstanceExecCacheManager.getByProcessInstanceId(stateEvent.getProcessInstanceId()); workflowExecuteThread.addStateEvent(stateEvent); } private boolean processDependCheck(TaskInstance taskInstance) { StateEvent stateEvent = new StateEvent(); stateEvent.setType(StateEventType.TASK_STATE_CHANGE); stateEvent.setProcessInstanceId(taskInstance.getProcessInstanceId()); stateEvent.setTaskInstanceId(taskInstance.getId()); stateEvent.setExecutionStatus(ExecutionStatus.RUNNING_EXECUTION); putEvent(stateEvent); return true; } private boolean processTimeout(TaskInstance taskInstance) { StateEvent stateEvent = new StateEvent(); stateEvent.setType(StateEventType.TASK_TIMEOUT); stateEvent.setProcessInstanceId(taskInstance.getProcessInstanceId()); stateEvent.setTaskInstanceId(taskInstance.getId()); putEvent(stateEvent); return true; } private boolean processTimeout(ProcessInstance processInstance) { StateEvent stateEvent = new StateEvent(); stateEvent.setType(StateEventType.PROCESS_TIMEOUT); stateEvent.setProcessInstanceId(processInstance.getId()); putEvent(stateEvent); return true; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
/* * Lcensed to the Apache Software Foundaton (ASF) under one or more * contrbutor lcense agreements. See the NOTICE fle dstrbuted wth * ths work for addtonal nformaton regardng copyrght ownershp. * The ASF lcenses ths fle to You under the Apache Lcense, Verson 2.0 * (the "Lcense"); you may not use ths fle except n complance wth * the Lcense. You may obtan a copy of the Lcense at * * http://www.apache.org/lcenses/LICENSE-2.0
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
* * Unless requred by applcable law or agreed to n wrtng, software * dstrbuted under the Lcense s dstrbuted on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, ether express or mpled. * See the Lcense for the specfc language governng permssons and * lmtatons under the Lcense. */ package org.apache.dolphnscheduler.server.master.runner; mport statc org.apache.dolphnscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE; mport statc org.apache.dolphnscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_START_DATE; mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_RECOVERY_START_NODE_STRING; mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_RECOVER_PROCESS_ID_STRING; mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_START_NODES; mport statc org.apache.dolphnscheduler.common.Constants.DEFAULT_WORKER_GROUP; mport org.apache.dolphnscheduler.common.Constants; mport org.apache.dolphnscheduler.common.enums.CommandType; mport org.apache.dolphnscheduler.common.enums.DependResult; mport org.apache.dolphnscheduler.common.enums.Drect; mport org.apache.dolphnscheduler.common.enums.ExecutonStatus; mport org.apache.dolphnscheduler.common.enums.FalureStrategy; mport org.apache.dolphnscheduler.common.enums.Flag; mport org.apache.dolphnscheduler.common.enums.Prorty; mport org.apache.dolphnscheduler.common.enums.StateEvent; mport org.apache.dolphnscheduler.common.enums.StateEventType; mport org.apache.dolphnscheduler.common.enums.TaskDependType; mport org.apache.dolphnscheduler.common.enums.TaskGroupQueueStatus; mport org.apache.dolphnscheduler.common.enums.TaskTmeoutStrategy; mport org.apache.dolphnscheduler.common.enums.TmeoutFlag; mport org.apache.dolphnscheduler.common.graph.DAG; mport org.apache.dolphnscheduler.common.model.TaskNode;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
mport org.apache.dolphnscheduler.common.model.TaskNodeRelaton; mport org.apache.dolphnscheduler.common.process.ProcessDag; mport org.apache.dolphnscheduler.common.process.Property; mport org.apache.dolphnscheduler.common.utls.DateUtls; mport org.apache.dolphnscheduler.common.utls.JSONUtls; mport org.apache.dolphnscheduler.common.utls.NetUtls; mport org.apache.dolphnscheduler.common.utls.ParameterUtls; mport org.apache.dolphnscheduler.dao.entty.Command; mport org.apache.dolphnscheduler.dao.entty.Envronment; mport org.apache.dolphnscheduler.dao.entty.ProcessDefnton; mport org.apache.dolphnscheduler.dao.entty.ProcessInstance; mport org.apache.dolphnscheduler.dao.entty.ProjectUser; mport org.apache.dolphnscheduler.dao.entty.Schedule; mport org.apache.dolphnscheduler.dao.entty.TaskDefnton; mport org.apache.dolphnscheduler.dao.entty.TaskGroupQueue; mport org.apache.dolphnscheduler.dao.entty.TaskInstance; mport org.apache.dolphnscheduler.dao.utls.DagHelper; mport org.apache.dolphnscheduler.remote.command.HostUpdateCommand; mport org.apache.dolphnscheduler.remote.utls.Host; mport org.apache.dolphnscheduler.server.master.confg.MasterConfg; mport org.apache.dolphnscheduler.server.master.dspatch.executor.NettyExecutorManager; mport org.apache.dolphnscheduler.server.master.runner.task.ITaskProcessor; mport org.apache.dolphnscheduler.server.master.runner.task.TaskActon; mport org.apache.dolphnscheduler.server.master.runner.task.TaskProcessorFactory; mport org.apache.dolphnscheduler.servce.alert.ProcessAlertManager; mport org.apache.dolphnscheduler.servce.process.ProcessServce; mport org.apache.dolphnscheduler.servce.quartz.cron.CronUtls; mport org.apache.dolphnscheduler.servce.queue.PeerTaskInstancePrortyQueue; mport org.apache.commons.collectons.CollectonUtls; mport org.apache.commons.lang.StrngUtls;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
mport java.utl.ArrayLst; mport java.utl.Arrays; mport java.utl.Collecton; mport java.utl.Date; mport java.utl.HashMap; mport java.utl.Iterator; mport java.utl.Lst; mport java.utl.Map; mport java.utl.Objects; mport java.utl.Set; mport java.utl.concurrent.ConcurrentHashMap; mport java.utl.concurrent.ConcurrentLnkedQueue; mport org.slf4j.Logger; mport org.slf4j.LoggerFactory; mport com.google.common.collect.Lsts; /** * master exec thread,splt dag */ publc class WorkflowExecuteThread mplements Runnable { /** * logger of WorkflowExecuteThread */ prvate statc fnal Logger logger = LoggerFactory.getLogger(WorkflowExecuteThread.class); /** * master confg */ prvate MasterConfg masterConfg; /** * process servce */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
prvate ProcessServce processServce; /** * alert manager */ prvate ProcessAlertManager processAlertManager; /** * netty executor manager */ prvate NettyExecutorManager nettyExecutorManager; /** * process nstance */ prvate ProcessInstance processInstance; /** * process defnton */ prvate ProcessDefnton processDefnton; /** * task processor */ prvate TaskProcessorFactory taskProcessorFactory; /** * the object of DAG */ prvate DAG<Strng, TaskNode, TaskNodeRelaton> dag; /** * key of workflow */ prvate Strng key; /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
* start flag, true: start nodes submt completely */ prvate boolean sStart = false; /** * submt falure nodes */ prvate boolean taskFaledSubmt = false; /** * task nstance hash map, taskId as key */ prvate Map<Integer, TaskInstance> taskInstanceMap = new ConcurrentHashMap<>(); /** * runnng TaskNode, taskId as key */ prvate fnal Map<Integer, ITaskProcessor> actveTaskProcessorMaps = new ConcurrentHashMap<>(); /** * vald task map, taskCode as key, taskId as value */ prvate Map<Strng, Integer> valdTaskMap = new ConcurrentHashMap<>(); /** * error task map, taskCode as key, taskId as value */ prvate Map<Strng, Integer> errorTaskMap = new ConcurrentHashMap<>(); /** * complete task map, taskCode as key, taskId as value */ prvate Map<Strng, Integer> completeTaskMap = new ConcurrentHashMap<>(); /** * depend faled task map, taskCode as key, taskId as value */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
prvate Map<Strng, Integer> dependFaledTaskMap = new ConcurrentHashMap<>(); /** * forbdden task map, code as key */ prvate Map<Strng, TaskNode> forbddenTaskMap = new ConcurrentHashMap<>(); /** * skp task map, code as key */ prvate Map<Strng, TaskNode> skpTaskNodeMap = new ConcurrentHashMap<>(); /** * complement date lst */ prvate Lst<Date> complementLstDate = Lsts.newLnkedLst(); /** * task tmeout check lst */ prvate ConcurrentHashMap<Integer, TaskInstance> taskTmeoutCheckLst; /** * state event queue */ prvate ConcurrentLnkedQueue<StateEvent> stateEvents = new ConcurrentLnkedQueue<>(); /** * ready to submt task queue */ prvate PeerTaskInstancePrortyQueue readyToSubmtTaskQueue = new PeerTaskInstancePrortyQueue(); /** * constructor of WorkflowExecuteThread * * @param processInstance processInstance * @param processServce processServce
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
* @param nettyExecutorManager nettyExecutorManager * @param processAlertManager processAlertManager * @param masterConfg masterConfg * @param taskTmeoutCheckLst taskTmeoutCheckLst * @param taskProcessorFactory taskProcessorFactory */ publc WorkflowExecuteThread(ProcessInstance processInstance , ProcessServce processServce , NettyExecutorManager nettyExecutorManager , ProcessAlertManager processAlertManager , MasterConfg masterConfg , ConcurrentHashMap<Integer, TaskInstance> taskTmeoutCheckLst , TaskProcessorFactory taskProcessorFactory) { ths.processServce = processServce; ths.processInstance = processInstance; ths.masterConfg = masterConfg; ths.nettyExecutorManager = nettyExecutorManager; ths.processAlertManager = processAlertManager; ths.taskTmeoutCheckLst = taskTmeoutCheckLst; ths.taskProcessorFactory = taskProcessorFactory; } @Overrde publc vod run() { try { f (!ths.sStart()) { startProcess(); } else { handleEvents(); } } catch (Excepton e) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
logger.error("handler error:", e); } } /** * the process start nodes are submtted completely. */ publc boolean sStart() { return ths.sStart; } prvate vod handleEvents() { whle (!ths.stateEvents.sEmpty()) { try { StateEvent stateEvent = ths.stateEvents.peek(); f (stateEventHandler(stateEvent)) { ths.stateEvents.remove(stateEvent); } } catch (Excepton e) { logger.error("state handle error:", e); } } } publc Strng getKey() { f (StrngUtls.sNotEmpty(key) || ths.processDefnton == null) { return key; } key = Strng.format("%d_%d_%d", ths.processDefnton.getCode(), ths.processDefnton.getVerson(), ths.processInstance.getId());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
return key; } publc boolean addStateEvent(StateEvent stateEvent) { f (processInstance.getId() != stateEvent.getProcessInstanceId()) { logger.nfo("state event would be abounded :{}", stateEvent.toStrng()); return false; } ths.stateEvents.add(stateEvent); return true; } publc nt eventSze() { return ths.stateEvents.sze(); } publc ProcessInstance getProcessInstance() { return ths.processInstance; } prvate boolean stateEventHandler(StateEvent stateEvent) { logger.nfo("process event: {}", stateEvent.toStrng()); f (!checkProcessInstance(stateEvent)) { return false; } boolean result = false; swtch (stateEvent.getType()) { case PROCESS_STATE_CHANGE: result = processStateChangeHandler(stateEvent); break; case TASK_STATE_CHANGE: result = taskStateChangeHandler(stateEvent); break; case PROCESS_TIMEOUT:
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
result = processTmeout(); break; case TASK_TIMEOUT: result = taskTmeout(stateEvent); break; case WAIT_TASK_GROUP: result = checkForceStartAndWakeUp(stateEvent); break; default: break; } f (result) { ths.stateEvents.remove(stateEvent); } return result; } prvate boolean checkForceStartAndWakeUp(StateEvent stateEvent) { TaskGroupQueue taskGroupQueue = ths.processServce.loadTaskGroupQueue(stateEvent.getTaskInstanceId()); f (taskGroupQueue.getForceStart() == Flag.YES.getCode()) { ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(stateEvent.getTaskInstanceId()); TaskInstance taskInstance = ths.processServce.fndTaskInstanceById(stateEvent.getTaskInstanceId()); ProcessInstance processInstance = ths.processServce.fndProcessInstanceById(taskInstance.getProcessInstanceId()); taskProcessor.dspatch(taskInstance, processInstance); ths.processServce.updateTaskGroupQueueStatus(taskGroupQueue.getId(), TaskGroupQueueStatus.ACQUIRE_SUCCESS.getCode()); return true; } f (taskGroupQueue.getInQueue() == Flag.YES.getCode()) { boolean acqureTaskGroup = processServce.acqureTaskGroupAgan(taskGroupQueue); f (acqureTaskGroup) { ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(stateEvent.getTaskInstanceId());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
TaskInstance taskInstance = ths.processServce.fndTaskInstanceById(stateEvent.getTaskInstanceId()); ProcessInstance processInstance = ths.processServce.fndProcessInstanceById(taskInstance.getProcessInstanceId()); taskProcessor.dspatch(taskInstance, processInstance); return true; } } return false; } prvate boolean taskTmeout(StateEvent stateEvent) { f (!checkTaskInstanceByStateEvent(stateEvent)) { return true; } TaskInstance taskInstance = taskInstanceMap.get(stateEvent.getTaskInstanceId()); f (TmeoutFlag.CLOSE == taskInstance.getTaskDefne().getTmeoutFlag()) { return true; } TaskTmeoutStrategy taskTmeoutStrategy = taskInstance.getTaskDefne().getTmeoutNotfyStrategy(); f (TaskTmeoutStrategy.FAILED == taskTmeoutStrategy) { ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(stateEvent.getTaskInstanceId()); taskProcessor.acton(TaskActon.TIMEOUT); return false; } else { processAlertManager.sendTaskTmeoutAlert(processInstance, taskInstance, taskInstance.getTaskDefne()); return true; } } prvate boolean processTmeout() { ths.processAlertManager.sendProcessTmeoutAlert(ths.processInstance, ths.processDefnton); return true; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
prvate boolean taskStateChangeHandler(StateEvent stateEvent) { f (!checkTaskInstanceByStateEvent(stateEvent)) { return true; } TaskInstance task = getTaskInstance(stateEvent.getTaskInstanceId()); f (task.getState() == null) { logger.error("task state s null, state handler error: {}", stateEvent); return true; } f (task.getState().typeIsFnshed() && !completeTaskMap.contansKey(Long.toStrng(task.getTaskCode()))) { taskFnshed(task); f (task.getTaskGroupId() > 0) { TaskInstance nextTaskInstance = ths.processServce.releaseTaskGroup(task); f (nextTaskInstance != null) { f (nextTaskInstance.getProcessInstanceId() == task.getProcessInstanceId()) { StateEvent nextEvent = new StateEvent(); nextEvent.setProcessInstanceId(ths.processInstance.getId()); nextEvent.setTaskInstanceId(nextTaskInstance.getId()); nextEvent.setType(StateEventType.WAIT_TASK_GROUP); ths.stateEvents.add(nextEvent); } else { ProcessInstance processInstance = ths.processServce.fndProcessInstanceById(nextTaskInstance.getProcessInstanceId()); ths.processServce.sendStartTask2Master(processInstance,nextTaskInstance.getId(), org.apache.dolphnscheduler.remote.command.CommandType.TASK_WAKEUP_EVENT_REQUEST); } } } } else f (actveTaskProcessorMaps.contansKey(stateEvent.getTaskInstanceId())) { ITaskProcessor TaskProcessor = actveTaskProcessorMaps.get(stateEvent.getTaskInstanceId());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
TaskProcessor.run(); f (TaskProcessor.taskState().typeIsFnshed()) { task = processServce.fndTaskInstanceById(stateEvent.getTaskInstanceId()); taskFnshed(task); } } else { logger.error("state handler error: {}", stateEvent); } return true; } prvate vod taskFnshed(TaskInstance task) { logger.nfo("work flow {} task {} state:{} ", processInstance.getId(), task.getId(), task.getState()); f (task.taskCanRetry()) { addTaskToStandByLst(task); f (!task.retryTaskIntervalOverTme()) { logger.nfo("falure task wll be submtted: process d: {}, task nstance d: {} state:{} retry tmes:{} / {}, nterval:{}", processInstance.getId(), task.getId(), task.getState(), task.getRetryTmes(), task.getMaxRetryTmes(), task.getRetryInterval()); ths.addTmeoutCheck(task); } else { submtStandByTask(); } return;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
} completeTaskMap.put(Long.toStrng(task.getTaskCode()), task.getId()); actveTaskProcessorMaps.remove(task.getId()); taskTmeoutCheckLst.remove(task.getId()); f (task.getState().typeIsSuccess()) { processInstance.setVarPool(task.getVarPool()); processServce.saveProcessInstance(processInstance); submtPostNode(Long.toStrng(task.getTaskCode())); } else f (task.getState().typeIsFalure()) { f (task.sCondtonsTask() || DagHelper.haveCondtonsAfterNode(Long.toStrng(task.getTaskCode()), dag)) { submtPostNode(Long.toStrng(task.getTaskCode())); } else { errorTaskMap.put(Long.toStrng(task.getTaskCode()), task.getId()); f (processInstance.getFalureStrategy() == FalureStrategy.END) { kllAllTasks(); } } } ths.updateProcessInstanceState(); } /** * update process nstance */ publc vod refreshProcessInstance(nt processInstanceId) { logger.nfo("process nstance update: {}", processInstanceId); processInstance = processServce.fndProcessInstanceById(processInstanceId); processDefnton = processServce.fndProcessDefnton(processInstance.getProcessDefntonCode(), processInstance.getProcessDefntonVerson()); processInstance.setProcessDefnton(processDefnton);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
} /** * update task nstance */ publc vod refreshTaskInstance(nt taskInstanceId) { logger.nfo("task nstance update: {} ", taskInstanceId); TaskInstance taskInstance = processServce.fndTaskInstanceById(taskInstanceId); f (taskInstance == null) { logger.error("can not fnd task nstance, d:{}", taskInstanceId); return; } processServce.packageTaskInstance(taskInstance, processInstance); taskInstanceMap.put(taskInstance.getId(), taskInstance); valdTaskMap.remove(Long.toStrng(taskInstance.getTaskCode())); f (Flag.YES == taskInstance.getFlag()) { valdTaskMap.put(Long.toStrng(taskInstance.getTaskCode()), taskInstance.getId()); } } /** * check process nstance by state event */ publc boolean checkProcessInstance(StateEvent stateEvent) { f (ths.processInstance.getId() != stateEvent.getProcessInstanceId()) { logger.error("msmatch process nstance d: {}, state event:{}", ths.processInstance.getId(), stateEvent); return false; } return true; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
/** * check f task nstance exst by state event */ publc boolean checkTaskInstanceByStateEvent(StateEvent stateEvent) { f (stateEvent.getTaskInstanceId() == 0) { logger.error("task nstance d null, state event:{}", stateEvent); return false; } f (!taskInstanceMap.contansKey(stateEvent.getTaskInstanceId())) { logger.error("msmatch task nstance d, event:{}", stateEvent); return false; } return true; } /** * check f task nstance exst by task code */ publc boolean checkTaskInstanceByCode(long taskCode) { f (taskInstanceMap == null || taskInstanceMap.sze() == 0) { return false; } for (TaskInstance taskInstance : taskInstanceMap.values()) { f (taskInstance.getTaskCode() == taskCode) { return true; } } return false; } /** * check f task nstance exst by d
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
*/ publc boolean checkTaskInstanceById(nt taskInstanceId) { f (taskInstanceMap == null || taskInstanceMap.sze() == 0) { return false; } return taskInstanceMap.contansKey(taskInstanceId); } /** * get task nstance from memory */ publc TaskInstance getTaskInstance(nt taskInstanceId) { f (taskInstanceMap.contansKey(taskInstanceId)) { return taskInstanceMap.get(taskInstanceId); } return null; } prvate boolean processStateChangeHandler(StateEvent stateEvent) { try { logger.nfo("process:{} state {} change to {}", processInstance.getId(), processInstance.getState(), stateEvent.getExecutonStatus()); f (processComplementData()) { return true; } f (stateEvent.getExecutonStatus().typeIsFnshed()) { endProcess(); } f (processInstance.getState() == ExecutonStatus.READY_STOP) { kllAllTasks(); } return true; } catch (Excepton e) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
logger.error("process state change error:", e); } return true; } prvate boolean processComplementData() throws Excepton { f (!needComplementProcess()) { return false; } f (processInstance.getState() == ExecutonStatus.READY_STOP) { return false; } Date scheduleDate = processInstance.getScheduleTme(); f (scheduleDate == null) { scheduleDate = complementLstDate.get(0); } else f (processInstance.getState().typeIsFnshed()) { endProcess(); f (complementLstDate.sze() <= 0) { logger.nfo("process complement end. process d:{}", processInstance.getId()); return true; } nt ndex = complementLstDate.ndexOf(scheduleDate); f (ndex >= complementLstDate.sze() - 1 || !processInstance.getState().typeIsSuccess()) { logger.nfo("process complement end. process d:{}", processInstance.getId()); return true; } logger.nfo("process complement contnue. process d:{}, schedule tme:{} complementLstDate:{}", processInstance.getId(), processInstance.getScheduleTme(), complementLstDate.toStrng());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
scheduleDate = complementLstDate.get(ndex + 1); processInstance.setId(0); } processInstance.setScheduleTme(scheduleDate); Map<Strng, Strng> cmdParam = JSONUtls.toMap(processInstance.getCommandParam()); f (cmdParam.contansKey(Constants.CMD_PARAM_RECOVERY_START_NODE_STRING)) { cmdParam.remove(Constants.CMD_PARAM_RECOVERY_START_NODE_STRING); processInstance.setCommandParam(JSONUtls.toJsonStrng(cmdParam)); } processInstance.setState(ExecutonStatus.RUNNING_EXECUTION); processInstance.setGlobalParams(ParameterUtls.curngGlobalParams( processDefnton.getGlobalParamMap(), processDefnton.getGlobalParamLst(), CommandType.COMPLEMENT_DATA, processInstance.getScheduleTme())); processInstance.setStartTme(new Date()); processInstance.setEndTme(null); processServce.saveProcessInstance(processInstance); ths.taskInstanceMap.clear(); startProcess(); return true; } prvate boolean needComplementProcess() { f (processInstance.sComplementData() && Flag.NO == processInstance.getIsSubProcess()) { return true; } return false; } prvate vod startProcess() throws Excepton {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
f (ths.taskInstanceMap.sze() == 0) { sStart = false; buldFlowDag(); ntTaskQueue(); submtPostNode(null); sStart = true; } } /** * process end handle */ prvate vod endProcess() { ths.stateEvents.clear(); f (processDefnton.getExecutonType().typeIsSeralWat()) { checkSeralProcess(processDefnton); } f (processInstance.getState().typeIsWatngThread()) { processServce.createRecoveryWatngThreadCommand(null, processInstance); } f (processAlertManager.sNeedToSendWarnng(processInstance)) { ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId()); processAlertManager.sendAlertProcessInstance(processInstance, getValdTaskLst(), projectUser); } Lst<TaskInstance> taskInstances = processServce.fndValdTaskLstByProcessId(processInstance.getId()); ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId()); processAlertManager.sendAlertProcessInstance(processInstance, taskInstances, projectUser); processServce.releaseAllTaskGroup(processInstance.getId()); } publc vod checkSeralProcess(ProcessDefnton processDefnton) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
nt nextInstanceId = processInstance.getNextProcessInstanceId(); f (nextInstanceId == 0) { ProcessInstance nextProcessInstance = ths.processServce.loadNextProcess4Seral(processInstance.getProcessDefnton().getCode(), ExecutonStatus.SERIAL_WAIT.getCode()); f (nextProcessInstance == null) { return; } nextInstanceId = nextProcessInstance.getId(); } ProcessInstance nextProcessInstance = ths.processServce.fndProcessInstanceById(nextInstanceId); f (nextProcessInstance.getState().typeIsFnshed() || nextProcessInstance.getState().typeIsRunnng()) { return; } Map<Strng, Object> cmdParam = new HashMap<>(); cmdParam.put(CMD_PARAM_RECOVER_PROCESS_ID_STRING, nextInstanceId); Command command = new Command(); command.setCommandType(CommandType.RECOVER_SERIAL_WAIT); command.setProcessDefntonCode(processDefnton.getCode()); command.setCommandParam(JSONUtls.toJsonStrng(cmdParam)); processServce.createCommand(command); } /** * generate process dag * * @throws Excepton excepton */ prvate vod buldFlowDag() throws Excepton { f (ths.dag != null) { return; } processDefnton = processServce.fndProcessDefnton(processInstance.getProcessDefntonCode(),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
processInstance.getProcessDefntonVerson()); processInstance.setProcessDefnton(processDefnton); Lst<TaskInstance> recoverNodeLst = getStartTaskInstanceLst(processInstance.getCommandParam()); Lst<TaskNode> taskNodeLst = processServce.transformTask(processServce.fndRelatonByCode(processDefnton.getProjectCode(), processDefnton.getCode()), Lsts.newArrayLst()); forbddenTaskMap.clear(); taskNodeLst.forEach(taskNode -> { f (taskNode.sForbdden()) { forbddenTaskMap.put(Long.toStrng(taskNode.getCode()), taskNode); } }); Lst<Strng> recoveryNodeCodeLst = getRecoveryNodeCodeLst(recoverNodeLst); Lst<Strng> startNodeNameLst = parseStartNodeName(processInstance.getCommandParam()); ProcessDag processDag = generateFlowDag(taskNodeLst, startNodeNameLst, recoveryNodeCodeLst, processInstance.getTaskDependType()); f (processDag == null) { logger.error("processDag s null"); return; } dag = DagHelper.buldDagGraph(processDag); } /** * nt task queue */ prvate vod ntTaskQueue() { taskFaledSubmt = false; actveTaskProcessorMaps.clear(); dependFaledTaskMap.clear();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
completeTaskMap.clear(); errorTaskMap.clear(); f (ExecutonStatus.SUBMITTED_SUCCESS != processInstance.getState()) { Lst<TaskInstance> valdTaskInstanceLst = processServce.fndValdTaskLstByProcessId(processInstance.getId()); for (TaskInstance task : valdTaskInstanceLst) { valdTaskMap.put(Long.toStrng(task.getTaskCode()), task.getId()); taskInstanceMap.put(task.getId(), task); f (task.sTaskComplete()) { completeTaskMap.put(Long.toStrng(task.getTaskCode()), task.getId()); } f (task.sCondtonsTask() || DagHelper.haveCondtonsAfterNode(Long.toStrng(task.getTaskCode()), dag)) { contnue; } f (task.getState().typeIsFalure() && !task.taskCanRetry()) { errorTaskMap.put(Long.toStrng(task.getTaskCode()), task.getId()); } } } f (processInstance.sComplementData() && complementLstDate.sze() == 0) { Map<Strng, Strng> cmdParam = JSONUtls.toMap(processInstance.getCommandParam()); f (cmdParam != null && cmdParam.contansKey(CMDPARAM_COMPLEMENT_DATA_START_DATE)) { Date start = DateUtls.strngToDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE)); Date end = DateUtls.strngToDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_END_DATE)); Lst<Schedule> schedules = processServce.queryReleaseSchedulerLstByProcessDefntonCode(processInstance.getProcessDefntonCode()); f (complementLstDate.sze() == 0 && needComplementProcess()) { complementLstDate = CronUtls.getSelfFreDateLst(start, end, schedules); logger.nfo(" process defnton code:{} complement data: {}", processInstance.getProcessDefntonCode(), complementLstDate.toStrng()); f (complementLstDate.sze() > 0 && Flag.NO == processInstance.getIsSubProcess()) { processInstance.setScheduleTme(complementLstDate.get(0));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
processInstance.setGlobalParams(ParameterUtls.curngGlobalParams( processDefnton.getGlobalParamMap(), processDefnton.getGlobalParamLst(), CommandType.COMPLEMENT_DATA, processInstance.getScheduleTme())); processServce.updateProcessInstance(processInstance); } } } } } /** * submt task to execute * * @param taskInstance task nstance * @return TaskInstance */ prvate TaskInstance submtTaskExec(TaskInstance taskInstance) { try { ITaskProcessor taskProcessor = taskProcessorFactory.getTaskProcessor(taskInstance.getTaskType()); f (taskInstance.getState() == ExecutonStatus.RUNNING_EXECUTION && taskProcessor.getType().equalsIgnoreCase(Constants.COMMON_TASK_TYPE)) { notfyProcessHostUpdate(taskInstance); } TaskDefnton taskDefnton = processServce.fndTaskDefnton( taskInstance.getTaskCode(), taskInstance.getTaskDefntonVerson()); taskInstance.setTaskGroupId(taskDefnton.getTaskGroupId()); processServce.packageTaskInstance(taskInstance, processInstance); boolean submt = taskProcessor.submt(taskInstance, processInstance, masterConfg.getTaskCommtRetryTmes(), masterConfg.getTaskCommtInterval());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
f (!submt) { logger.error("process d:{} name:{} submt standby task d:{} name:{} faled!", processInstance.getId(), processInstance.getName(), taskInstance.getId(), taskInstance.getName()); return null; } taskInstanceMap.put(taskInstance.getId(), taskInstance); actveTaskProcessorMaps.put(taskInstance.getId(), taskProcessor); taskProcessor.run(); addTmeoutCheck(taskInstance); f (taskProcessor.taskState().typeIsFnshed()) { StateEvent stateEvent = new StateEvent(); stateEvent.setProcessInstanceId(ths.processInstance.getId()); stateEvent.setTaskInstanceId(taskInstance.getId()); stateEvent.setExecutonStatus(taskProcessor.taskState()); stateEvent.setType(StateEventType.TASK_STATE_CHANGE); ths.stateEvents.add(stateEvent); } return taskInstance; } catch (Excepton e) { logger.error("submt standby task error", e); return null; } } prvate vod notfyProcessHostUpdate(TaskInstance taskInstance) { f (StrngUtls.sEmpty(taskInstance.getHost())) { return; } try { HostUpdateCommand hostUpdateCommand = new HostUpdateCommand();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
hostUpdateCommand.setProcessHost(NetUtls.getAddr(masterConfg.getLstenPort())); hostUpdateCommand.setTaskInstanceId(taskInstance.getId()); Host host = new Host(taskInstance.getHost()); nettyExecutorManager.doExecute(host, hostUpdateCommand.convert2Command()); } catch (Excepton e) { logger.error("notfy process host update", e); } } prvate vod addTmeoutCheck(TaskInstance taskInstance) { f (taskTmeoutCheckLst.contansKey(taskInstance.getId())) { return; } TaskDefnton taskDefnton = taskInstance.getTaskDefne(); f (taskDefnton == null) { logger.error("taskDefnton s null, taskId:{}", taskInstance.getId()); return; } f (TmeoutFlag.OPEN == taskDefnton.getTmeoutFlag() || taskInstance.taskCanRetry()) { ths.taskTmeoutCheckLst.put(taskInstance.getId(), taskInstance); } else { f (taskInstance.sDependTask() || taskInstance.sSubProcess()) { ths.taskTmeoutCheckLst.put(taskInstance.getId(), taskInstance); } } } /** * fnd task nstance n db. * n case submt more than one same name task n the same tme. * * @param taskCode task code
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
* @param taskVerson task verson * @return TaskInstance */ prvate TaskInstance fndTaskIfExsts(Long taskCode, nt taskVerson) { Lst<TaskInstance> valdTaskInstanceLst = getValdTaskLst(); for (TaskInstance taskInstance : valdTaskInstanceLst) { f (taskInstance.getTaskCode() == taskCode && taskInstance.getTaskDefntonVerson() == taskVerson) { return taskInstance; } } return null; } /** * encapsulaton task * * @param processInstance process nstance * @param taskNode taskNode * @return TaskInstance */ prvate TaskInstance createTaskInstance(ProcessInstance processInstance, TaskNode taskNode) { TaskInstance taskInstance = fndTaskIfExsts(taskNode.getCode(), taskNode.getVerson()); f (taskInstance == null) { taskInstance = new TaskInstance(); taskInstance.setTaskCode(taskNode.getCode()); taskInstance.setTaskDefntonVerson(taskNode.getVerson()); taskInstance.setName(taskNode.getName()); taskInstance.setState(ExecutonStatus.SUBMITTED_SUCCESS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
taskInstance.setProcessInstanceId(processInstance.getId()); taskInstance.setTaskType(taskNode.getType().toUpperCase()); taskInstance.setAlertFlag(Flag.NO); taskInstance.setStartTme(null); taskInstance.setFlag(Flag.YES); taskInstance.setDryRun(processInstance.getDryRun()); taskInstance.setRetryTmes(0); taskInstance.setMaxRetryTmes(taskNode.getMaxRetryTmes()); taskInstance.setRetryInterval(taskNode.getRetryInterval()); taskInstance.setTaskParams(taskNode.getTaskParams()); f (taskNode.getTaskInstanceProrty() == null) { taskInstance.setTaskInstanceProrty(Prorty.MEDIUM); } else { taskInstance.setTaskInstanceProrty(taskNode.getTaskInstanceProrty()); } Strng processWorkerGroup = processInstance.getWorkerGroup(); processWorkerGroup = StrngUtls.sBlank(processWorkerGroup) ? DEFAULT_WORKER_GROUP : processWorkerGroup; Strng taskWorkerGroup = StrngUtls.sBlank(taskNode.getWorkerGroup()) ? processWorkerGroup : taskNode.getWorkerGroup(); Long processEnvronmentCode = Objects.sNull(processInstance.getEnvronmentCode()) ? -1 : processInstance.getEnvronmentCode(); Long taskEnvronmentCode = Objects.sNull(taskNode.getEnvronmentCode()) ? processEnvronmentCode : taskNode.getEnvronmentCode();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
f (!processWorkerGroup.equals(DEFAULT_WORKER_GROUP) && taskWorkerGroup.equals(DEFAULT_WORKER_GROUP)) { taskInstance.setWorkerGroup(processWorkerGroup); taskInstance.setEnvronmentCode(processEnvronmentCode); } else { taskInstance.setWorkerGroup(taskWorkerGroup); taskInstance.setEnvronmentCode(taskEnvronmentCode); } f (!taskInstance.getEnvronmentCode().equals(-1L)) { Envronment envronment = processServce.fndEnvronmentByCode(taskInstance.getEnvronmentCode()); f (Objects.nonNull(envronment) && StrngUtls.sNotEmpty(envronment.getConfg())) { taskInstance.setEnvronmentConfg(envronment.getConfg()); } } taskInstance.setDelayTme(taskNode.getDelayTme()); } return taskInstance; } publc vod getPreVarPool(TaskInstance taskInstance, Set<Strng> preTask) { Map<Strng, Property> allProperty = new HashMap<>(); Map<Strng, TaskInstance> allTaskInstance = new HashMap<>(); f (CollectonUtls.sNotEmpty(preTask)) { for (Strng preTaskCode : preTask) { Integer taskId = completeTaskMap.get(preTaskCode); f (taskId == null) { contnue; } TaskInstance preTaskInstance = taskInstanceMap.get(taskId); f (preTaskInstance == null) { contnue;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
} Strng preVarPool = preTaskInstance.getVarPool(); f (StrngUtls.sNotEmpty(preVarPool)) { Lst<Property> propertes = JSONUtls.toLst(preVarPool, Property.class); for (Property nfo : propertes) { setVarPoolValue(allProperty, allTaskInstance, preTaskInstance, nfo); } } } f (allProperty.sze() > 0) { taskInstance.setVarPool(JSONUtls.toJsonStrng(allProperty.values())); } } } prvate vod setVarPoolValue(Map<Strng, Property> allProperty, Map<Strng, TaskInstance> allTaskInstance, TaskInstance preTaskInstance, Property thsProperty) { thsProperty.setDrect(Drect.IN); Strng proName = thsProperty.getProp(); f (allProperty.contansKey(proName)) { Property otherPro = allProperty.get(proName); f (StrngUtls.sEmpty(thsProperty.getValue())) { allProperty.put(proName, otherPro); } else f (StrngUtls.sNotEmpty(otherPro.getValue())) { TaskInstance otherTask = allTaskInstance.get(proName); f (otherTask.getEndTme().getTme() > preTaskInstance.getEndTme().getTme()) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
allProperty.put(proName, thsProperty); allTaskInstance.put(proName, preTaskInstance); } else { allProperty.put(proName, otherPro); } } else { allProperty.put(proName, thsProperty); allTaskInstance.put(proName, preTaskInstance); } } else { allProperty.put(proName, thsProperty); allTaskInstance.put(proName, preTaskInstance); } } /** * get complete task nstance map, taskCode as key */ prvate Map<Strng, TaskInstance> getCompleteTaskInstanceMap() { Map<Strng, TaskInstance> completeTaskInstanceMap = new HashMap<>(); for (Integer taskInstanceId : completeTaskMap.values()) { TaskInstance taskInstance = taskInstanceMap.get(taskInstanceId); completeTaskInstanceMap.put(Long.toStrng(taskInstance.getTaskCode()), taskInstance); } return completeTaskInstanceMap; } /** * get vald task lst */ prvate Lst<TaskInstance> getValdTaskLst() { Lst<TaskInstance> valdTaskInstanceLst = new ArrayLst<>();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
for (Integer taskInstanceId : valdTaskMap.values()) { valdTaskInstanceLst.add(taskInstanceMap.get(taskInstanceId)); } return valdTaskInstanceLst; } prvate vod submtPostNode(Strng parentNodeCode) { Set<Strng> submtTaskNodeLst = DagHelper.parsePostNodes(parentNodeCode, skpTaskNodeMap, dag, getCompleteTaskInstanceMap()); Lst<TaskInstance> taskInstances = new ArrayLst<>(); for (Strng taskNode : submtTaskNodeLst) { TaskNode taskNodeObject = dag.getNode(taskNode); f (checkTaskInstanceByCode(taskNodeObject.getCode())) { contnue; } TaskInstance task = createTaskInstance(processInstance, taskNodeObject); taskInstances.add(task); } for (TaskInstance task : taskInstances) { f (readyToSubmtTaskQueue.contans(task)) { contnue; } f (completeTaskMap.contansKey(Long.toStrng(task.getTaskCode()))) { logger.nfo("task {} has already run success", task.getName()); contnue; } f (task.getState().typeIsPause() || task.getState().typeIsCancel()) { logger.nfo("task {} stopped, the state s {}", task.getName(), task.getState()); contnue; } addTaskToStandByLst(task);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
} submtStandByTask(); updateProcessInstanceState(); } /** * determne whether the dependences of the task node are complete * * @return DependResult */ prvate DependResult sTaskDepsComplete(Strng taskCode) { Collecton<Strng> startNodes = dag.getBegnNode(); f (startNodes.contans(taskCode)) { return DependResult.SUCCESS; } TaskNode taskNode = dag.getNode(taskCode); Lst<Strng> depCodeLst = taskNode.getDepLst(); for (Strng depsNode : depCodeLst) { f (!dag.contansNode(depsNode) || forbddenTaskMap.contansKey(depsNode) || skpTaskNodeMap.contansKey(depsNode)) { contnue; } f (!completeTaskMap.contansKey(depsNode)) { return DependResult.WAITING; } Integer depsTaskId = completeTaskMap.get(depsNode); ExecutonStatus depTaskState = taskInstanceMap.get(depsTaskId).getState(); f (depTaskState.typeIsPause() || depTaskState.typeIsCancel()) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,206
[Bug] [MasterServer] processInstance always running when task was timeout and failed.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when task was timeout and failed, processInstance runs without retry and finish. ### What you expected to happen processInstance can goto retry and finish. ### How to reproduce ![image](https://user-images.githubusercontent.com/11962619/144804188-bae18b81-4e9d-437e-b7cc-d71bba251e93.png) ### Anything else _No response_ ### Version 2.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/7206
https://github.com/apache/dolphinscheduler/pull/7207
705ba74f529a50dbf700e528701b8c19bd65f028
ff9bc806ac04d07ff0581e7a88514f943310d2c9
"2021-12-06T07:20:55Z"
java
"2021-12-06T10:20:56Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
return DependResult.NON_EXEC; } f (taskNode.sCondtonsTask()) { contnue; } f (!dependTaskSuccess(depsNode, taskCode)) { return DependResult.FAILED; } } logger.nfo("taskCode: {} completeDependTaskLst: {}", taskCode, Arrays.toStrng(completeTaskMap.keySet().toArray())); return DependResult.SUCCESS; } /** * depend node s completed, but here need check the condton task branch s the next node */ prvate boolean dependTaskSuccess(Strng dependNodeName, Strng nextNodeName) { f (dag.getNode(dependNodeName).sCondtonsTask()) { Lst<Strng> nextTaskLst = DagHelper.parseCondtonTask(dependNodeName, skpTaskNodeMap, dag, getCompleteTaskInstanceMap()); f (!nextTaskLst.contans(nextNodeName)) { return false; } } else { Integer taskInstanceId = completeTaskMap.get(dependNodeName); ExecutonStatus depTaskState = taskInstanceMap.get(taskInstanceId).getState(); f (depTaskState.typeIsFalure()) { return false; } }