status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
233
body
stringlengths
0
186k
issue_url
stringlengths
38
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
unknown
language
stringclasses
5 values
commit_datetime
unknown
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.server.utils; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.utils.CollectionUtils; import org.apache.dolphinscheduler.common.utils.CommonUtils; import org.apache.dolphinscheduler.common.utils.FileUtils; import org.apache.dolphinscheduler.common.utils.HadoopUtils; import org.apache.dolphinscheduler.common.utils.LoggerUtils; import org.apache.dolphinscheduler.common.utils.OSUtils; import org.apache.dolphinscheduler.common.utils.PropertyUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.remote.utils.Host; import org.apache.dolphinscheduler.server.entity.TaskExecutionContext; import org.apache.dolphinscheduler.service.log.LogClientService; import java.io.File; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * mainly used to get the start command line of a process. */ public class ProcessUtils {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
/** * logger */ private static final Logger logger = LoggerFactory.getLogger(ProcessUtils.class); /** * Initialization regularization, solve the problem of pre-compilation performance, * avoid the thread safety problem of multi-thread operation */ private static final Pattern MACPATTERN = Pattern.compile("-[+|-]-\\s(\\d+)"); /** * Expression of PID recognition in Windows scene */ private static final Pattern WINDOWSATTERN = Pattern.compile("\\w+\\((\\d+)\\)"); private static final String LOCAL_PROCESS_EXEC = "jdk.lang.Process.allowAmbiguousCommands"; /** * build command line characters. * * @param commandList command list * @return command */ public static String buildCommandStr(List<String> commandList) { String cmdstr; String[] cmd = commandList.toArray(new String[0]); SecurityManager security = System.getSecurityManager(); boolean allowAmbiguousCommands = isAllowAmbiguousCommands(security); if (allowAmbiguousCommands) { String executablePath = new File(cmd[0]).getPath(); if (needsEscaping(VERIFICATION_LEGACY, executablePath)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
executablePath = quoteString(executablePath); } cmdstr = createCommandLine( VERIFICATION_LEGACY, executablePath, cmd); } else { String executablePath; try { executablePath = getExecutablePath(cmd[0]); } catch (IllegalArgumentException e) { StringBuilder join = new StringBuilder(); for (String s : cmd) { join.append(s).append(' '); } cmd = getTokensFromCommand(join.toString()); executablePath = getExecutablePath(cmd[0]); if (security != null) { security.checkExec(executablePath); } } cmdstr = createCommandLine( isShellFile(executablePath) ? VERIFICATION_CMD_BAT : VERIFICATION_WIN32, quoteString(executablePath), cmd); } return cmdstr; } /** * check is allow ambiguous commands * * @param security security manager * @return allow ambiguous command flag
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
*/ private static boolean isAllowAmbiguousCommands(SecurityManager security) { boolean allowAmbiguousCommands = false; if (security == null) { allowAmbiguousCommands = true; String value = System.getProperty(LOCAL_PROCESS_EXEC); if (value != null) { allowAmbiguousCommands = !Constants.STRING_FALSE.equalsIgnoreCase(value); } } return allowAmbiguousCommands; } /** * get executable path. * * @param path path * @return executable path */ private static String getExecutablePath(String path) { boolean pathIsQuoted = isQuoted(true, path, "Executable name has embedded quote, split the arguments"); File fileToRun = new File(pathIsQuoted ? path.substring(1, path.length() - 1) : path); return fileToRun.getPath(); } /** * whether is shell file. * * @param executablePath executable path * @return true if endsWith .CMD or .BAT */ private static boolean isShellFile(String executablePath) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
String upPath = executablePath.toUpperCase(); return (upPath.endsWith(".CMD") || upPath.endsWith(".BAT")); } /** * quote string. * * @param arg argument * @return format arg */ private static String quoteString(String arg) { return '"' + arg + '"'; } /** * get tokens from command. * * @param command command * @return token string array */ private static String[] getTokensFromCommand(String command) { ArrayList<String> matchList = new ArrayList<>(8); Matcher regexMatcher = LazyPattern.PATTERN.matcher(command); while (regexMatcher.find()) { matchList.add(regexMatcher.group()); } return matchList.toArray(new String[0]); } /** * Lazy Pattern. */ private static class LazyPattern {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
/** * Escape-support version: * "(\")((?:\\\\\\1|.)+?)\\1|([^\\s\"]+)"; */ private static final Pattern PATTERN = Pattern.compile("[^\\s\"]+|\"[^\"]*\""); } /** * verification cmd bat. */ private static final int VERIFICATION_CMD_BAT = 0; /** * verification win32. */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
private static final int VERIFICATION_WIN32 = 1; /** * verification legacy. */ private static final int VERIFICATION_LEGACY = 2; /** * escape verification. */ private static final char[][] ESCAPE_VERIFICATION = {{' ', '\t', '<', '>', '&', '|', '^'}, {' ', '\t', '<', '>'}, {' ', '\t'}}; /** * create command line. * * @param verificationType verification type * @param executablePath executable path * @param cmd cmd * @return command line */ private static String createCommandLine(int verificationType, final String executablePath, final String[] cmd) { StringBuilder cmdbuf = new StringBuilder(80); cmdbuf.append(executablePath); for (int i = 1; i < cmd.length; ++i) { cmdbuf.append(' '); String s = cmd[i]; if (needsEscaping(verificationType, s)) { cmdbuf.append('"').append(s); if ((verificationType != VERIFICATION_CMD_BAT) && s.endsWith("\\")) { cmdbuf.append('\\'); } cmdbuf.append('"');
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
} else { cmdbuf.append(s); } } return cmdbuf.toString(); } /** * whether is quoted. * * @param noQuotesInside no quotes inside * @param arg arg * @param errorMessage error message * @return boolean */ private static boolean isQuoted(boolean noQuotesInside, String arg, String errorMessage) { int lastPos = arg.length() - 1; if (lastPos >= 1 && arg.charAt(0) == '"' && arg.charAt(lastPos) == '"') { if (noQuotesInside && arg.indexOf('"', 1) != lastPos) { throw new IllegalArgumentException(errorMessage); } return true; } if (noQuotesInside && arg.indexOf('"') >= 0) { throw new IllegalArgumentException(errorMessage); } return false; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
/** * whether needs escaping. * * @param verificationType verification type * @param arg arg * @return boolean */ private static boolean needsEscaping(int verificationType, String arg) { boolean argIsQuoted = isQuoted((verificationType == VERIFICATION_CMD_BAT), arg, "Argument has embedded quote, use the explicit CMD.EXE call."); if (!argIsQuoted) { char[] testEscape = ESCAPE_VERIFICATION[verificationType]; for (char c : testEscape) { if (arg.indexOf(c) >= 0) { return true; } } } return false; } /** * kill yarn application. * * @param appIds app id list * @param logger logger * @param tenantCode tenant code * @param executePath execute path */ public static void cancelApplication(List<String> appIds, Logger logger, String tenantCode, String executePath) { if (CollectionUtils.isNotEmpty(appIds)) { for (String appId : appIds) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
try { ExecutionStatus applicationStatus = HadoopUtils.getInstance().getApplicationStatus(appId); if (!applicationStatus.typeIsFinished()) { String commandFile = String .format("%s/%s.kill", executePath, appId); String cmd = getKerberosInitCommand() + "yarn application -kill " + appId; execYarnKillCommand(logger, tenantCode, appId, commandFile, cmd); } } catch (Exception e) { logger.error(String.format("Get yarn application app id [%s] status failed: [%s]", appId, e.getMessage())); } } } } /** * get kerberos init command */ public static String getKerberosInitCommand() { logger.info("get kerberos init command"); StringBuilder kerberosCommandBuilder = new StringBuilder(); boolean hadoopKerberosState = PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE,false); if (hadoopKerberosState) { kerberosCommandBuilder.append("export KRB5_CONFIG=") .append(PropertyUtils.getString(Constants.JAVA_SECURITY_KRB5_CONF_PATH)) .append("\n\n") .append(String.format("kinit -k -t %s %s || true",PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_PATH),PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_USERNAME))) .append("\n\n"); logger.info("kerberos init command: {}", kerberosCommandBuilder); } return kerberosCommandBuilder.toString();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
} /** * build kill command for yarn application * * @param logger logger * @param tenantCode tenant code * @param appId app id * @param commandFile command file * @param cmd cmd */ private static void execYarnKillCommand(Logger logger, String tenantCode, String appId, String commandFile, String cmd) { try { StringBuilder sb = new StringBuilder(); sb.append("#!/bin/sh\n"); sb.append("BASEDIR=$(cd `dirname $0`; pwd)\n"); sb.append("cd $BASEDIR\n"); if (CommonUtils.getSystemEnvPath() != null) { sb.append("source ").append(CommonUtils.getSystemEnvPath()).append("\n"); } sb.append("\n\n"); sb.append(cmd); File f = new File(commandFile); if (!f.exists()) { FileUtils.writeStringToFile(new File(commandFile), sb.toString(), StandardCharsets.UTF_8); } String runCmd = String.format("%s %s", Constants.SH, commandFile); runCmd = OSUtils.getSudoCmd(tenantCode, runCmd); logger.info("kill cmd:{}", runCmd); OSUtils.exeCmd(runCmd); } catch (Exception e) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
logger.error(String.format("Kill yarn application app id [%s] failed: [%s]", appId, e.getMessage())); } } /** * kill tasks according to different task types. * * @param taskExecutionContext taskExecutionContext */ public static void kill(TaskExecutionContext taskExecutionContext) { try { int processId = taskExecutionContext.getProcessId(); if (processId == 0) { logger.error("process kill failed, process id :{}, task id:{}", processId, taskExecutionContext.getTaskInstanceId()); return; } String cmd = String.format("kill -9 %s", getPidsStr(processId)); cmd = OSUtils.getSudoCmd(taskExecutionContext.getTenantCode(), cmd); logger.info("process id:{}, cmd:{}", processId, cmd); OSUtils.exeCmd(cmd); } catch (Exception e) { logger.error("kill task failed", e); } killYarnJob(taskExecutionContext); } /** * get pids str. * * @param processId process id
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
* @return pids pid String * @throws Exception exception */ public static String getPidsStr(int processId) throws Exception { StringBuilder sb = new StringBuilder(); Matcher mat = null; if (OSUtils.isMacOS()) { String pids = OSUtils.exeCmd(String.format("%s -sp %d", Constants.PSTREE, processId)); if (null != pids) { mat = MACPATTERN.matcher(pids); } } else { String pids = OSUtils.exeCmd(String.format("%s -p %d", Constants.PSTREE, processId)); mat = WINDOWSATTERN.matcher(pids); } if (null != mat) { while (mat.find()) { sb.append(mat.group(1)).append(" "); } } return sb.toString().trim(); } /** * find logs and kill yarn tasks. * * @param taskExecutionContext taskExecutionContext */ public static void killYarnJob(TaskExecutionContext taskExecutionContext) { try {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
Thread.sleep(Constants.SLEEP_TIME_MILLIS); LogClientService logClient = null; String log; try { logClient = new LogClientService(); log = logClient.viewLog(Host.of(taskExecutionContext.getHost()).getIp(), Constants.RPC_PORT, taskExecutionContext.getLogPath()); } finally { if (logClient != null) { logClient.close(); } } if (StringUtils.isNotEmpty(log)) { List<String> appIds = LoggerUtils.getAppIds(log, logger); String workerDir = taskExecutionContext.getExecutePath(); if (StringUtils.isEmpty(workerDir)) { logger.error("task instance work dir is empty"); throw new RuntimeException("task instance work dir is empty"); } if (CollectionUtils.isNotEmpty(appIds)) { cancelApplication(appIds, logger, taskExecutionContext.getTenantCode(), taskExecutionContext.getExecutePath()); } } } catch (Exception e) { logger.error("kill yarn job failure", e); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessor.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.worker.processor; import org.apache.dolphinscheduler.common.Constants;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessor.java
import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.LoggerUtils; import org.apache.dolphinscheduler.common.utils.OSUtils; import org.apache.dolphinscheduler.common.utils.Preconditions; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.remote.command.Command; import org.apache.dolphinscheduler.remote.command.CommandType; import org.apache.dolphinscheduler.remote.command.TaskKillRequestCommand; import org.apache.dolphinscheduler.remote.command.TaskKillResponseCommand; import org.apache.dolphinscheduler.remote.processor.NettyRequestProcessor; import org.apache.dolphinscheduler.remote.utils.Host; import org.apache.dolphinscheduler.remote.utils.Pair; import org.apache.dolphinscheduler.server.entity.TaskExecutionContext; import org.apache.dolphinscheduler.server.utils.ProcessUtils; import org.apache.dolphinscheduler.server.worker.cache.TaskExecutionContextCacheManager; import org.apache.dolphinscheduler.server.worker.cache.impl.TaskExecutionContextCacheManagerImpl; import org.apache.dolphinscheduler.server.worker.config.WorkerConfig; import org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread; import org.apache.dolphinscheduler.service.bean.SpringApplicationContext; import org.apache.dolphinscheduler.service.log.LogClientService; import java.util.Collections; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import io.netty.channel.Channel; /** * task kill processor */ public class TaskKillProcessor implements NettyRequestProcessor {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessor.java
private final Logger logger = LoggerFactory.getLogger(TaskKillProcessor.class); /** * worker config */ private final WorkerConfig workerConfig; /** * task callback service */ private final TaskCallbackService taskCallbackService; /** * taskExecutionContextCacheManager */ private TaskExecutionContextCacheManager taskExecutionContextCacheManager;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessor.java
/* * task execute manager */ private final WorkerManagerThread workerManager; public TaskKillProcessor() { this.taskCallbackService = SpringApplicationContext.getBean(TaskCallbackService.class); this.workerConfig = SpringApplicationContext.getBean(WorkerConfig.class); this.taskExecutionContextCacheManager = SpringApplicationContext.getBean(TaskExecutionContextCacheManagerImpl.class); this.workerManager = SpringApplicationContext.getBean(WorkerManagerThread.class); } /** * task kill process * * @param channel channel channel * @param command command command */ @Override public void process(Channel channel, Command command) { Preconditions.checkArgument(CommandType.TASK_KILL_REQUEST == command.getType(), String.format("invalid command type : %s", command.getType())); TaskKillRequestCommand killCommand = JSONUtils.parseObject(command.getBody(), TaskKillRequestCommand.class); logger.info("received kill command : {}", killCommand); Pair<Boolean, List<String>> result = doKill(killCommand); taskCallbackService.addRemoteChannel(killCommand.getTaskInstanceId(), new NettyRemoteChannel(channel, command.getOpaque())); TaskKillResponseCommand taskKillResponseCommand = buildKillTaskResponseCommand(killCommand, result); taskCallbackService.sendResult(taskKillResponseCommand.getTaskInstanceId(), taskKillResponseCommand.convert2Command()); taskExecutionContextCacheManager.removeByTaskInstanceId(taskKillResponseCommand.getTaskInstanceId()); } /** * do kill
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessor.java
* * @param killCommand * @return kill result */ private Pair<Boolean, List<String>> doKill(TaskKillRequestCommand killCommand) { boolean processFlag = true; List<String> appIds = Collections.emptyList(); int taskInstanceId = killCommand.getTaskInstanceId(); TaskExecutionContext taskExecutionContext = taskExecutionContextCacheManager.getByTaskInstanceId(taskInstanceId); try { Integer processId = taskExecutionContext.getProcessId(); if (processId.equals(0)) { workerManager.killTaskBeforeExecuteByInstanceId(taskInstanceId); taskExecutionContextCacheManager.removeByTaskInstanceId(taskInstanceId); logger.info("the task has not been executed and has been cancelled, task id:{}", taskInstanceId); return Pair.of(true, appIds); } String cmd = String.format("kill -9 %s", ProcessUtils.getPidsStr(taskExecutionContext.getProcessId())); cmd = OSUtils.getSudoCmd(taskExecutionContext.getTenantCode(), cmd); logger.info("process id:{}, cmd:{}", taskExecutionContext.getProcessId(), cmd); OSUtils.exeCmd(cmd); } catch (Exception e) { processFlag = false; logger.error("kill task error", e); } Pair<Boolean, List<String>> yarnResult = killYarnJob(Host.of(taskExecutionContext.getHost()).getIp(), taskExecutionContext.getLogPath(), taskExecutionContext.getExecutePath(), taskExecutionContext.getTenantCode());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessor.java
return Pair.of(processFlag && yarnResult.getLeft(), yarnResult.getRight()); } /** * build TaskKillResponseCommand * * @param killCommand kill command * @param result exe result * @return build TaskKillResponseCommand */ private TaskKillResponseCommand buildKillTaskResponseCommand(TaskKillRequestCommand killCommand, Pair<Boolean, List<String>> result) { TaskKillResponseCommand taskKillResponseCommand = new TaskKillResponseCommand(); taskKillResponseCommand.setStatus(result.getLeft() ? ExecutionStatus.SUCCESS.getCode() : ExecutionStatus.FAILURE.getCode()); taskKillResponseCommand.setAppIds(result.getRight()); TaskExecutionContext taskExecutionContext = taskExecutionContextCacheManager.getByTaskInstanceId(killCommand.getTaskInstanceId()); if (taskExecutionContext != null) { taskKillResponseCommand.setTaskInstanceId(taskExecutionContext.getTaskInstanceId()); taskKillResponseCommand.setHost(taskExecutionContext.getHost()); taskKillResponseCommand.setProcessId(taskExecutionContext.getProcessId()); } return taskKillResponseCommand; } /** * kill yarn job * * @param host host * @param logPath logPath * @param executePath executePath * @param tenantCode tenantCode * @return Pair<Boolean, List<String>> yarn kill result
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessor.java
*/ private Pair<Boolean, List<String>> killYarnJob(String host, String logPath, String executePath, String tenantCode) { LogClientService logClient = null; try { logClient = new LogClientService(); logger.info("view log host : {},logPath : {}", host, logPath); String log = logClient.viewLog(host, Constants.RPC_PORT, logPath); List<String> appIds = Collections.emptyList(); if (StringUtils.isNotEmpty(log)) { appIds = LoggerUtils.getAppIds(log, logger); if (StringUtils.isEmpty(executePath)) { logger.error("task instance execute path is empty"); throw new RuntimeException("task instance execute path is empty"); } if (appIds.size() > 0) { ProcessUtils.cancelApplication(appIds, logger, tenantCode, executePath); } } return Pair.of(true, appIds); } catch (Exception e) { logger.error("kill yarn job error", e); } finally { if (logClient != null) { logClient.close(); } } return Pair.of(false, Collections.emptyList()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.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.worker.task; import static org.apache.dolphinscheduler.common.Constants.EXIT_CODE_FAILURE; import static org.apache.dolphinscheduler.common.Constants.EXIT_CODE_KILL; import static org.apache.dolphinscheduler.common.Constants.EXIT_CODE_SUCCESS; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.thread.Stopper; import org.apache.dolphinscheduler.common.thread.ThreadUtils; import org.apache.dolphinscheduler.common.utils.CommonUtils;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
import org.apache.dolphinscheduler.common.utils.HadoopUtils; import org.apache.dolphinscheduler.common.utils.LoggerUtils; import org.apache.dolphinscheduler.common.utils.OSUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.server.entity.TaskExecutionContext; import org.apache.dolphinscheduler.server.utils.ProcessUtils; import org.apache.dolphinscheduler.server.worker.cache.TaskExecutionContextCacheManager; import org.apache.dolphinscheduler.server.worker.cache.impl.TaskExecutionContextCacheManagerImpl; import org.apache.dolphinscheduler.service.bean.SpringApplicationContext; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Field; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.slf4j.Logger; /** * abstract command executor */ public abstract class AbstractCommandExecutor {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
/** * rules for extracting application ID */ protected static final Pattern APPLICATION_REGEX = Pattern.compile(Constants.APPLICATION_REGEX); protected StringBuilder varPool = new StringBuilder(); /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
* process */ private Process process; /** * log handler */ protected Consumer<List<String>> logHandler; /** * logger */ protected Logger logger; /** * log list */ protected final List<String> logBuffer; protected boolean logOutputIsScuccess = false; /** * SHELL result string */ protected String taskResultString; /** * taskExecutionContext */ protected TaskExecutionContext taskExecutionContext; /** * taskExecutionContextCacheManager */ private TaskExecutionContextCacheManager taskExecutionContextCacheManager; public AbstractCommandExecutor(Consumer<List<String>> logHandler, TaskExecutionContext taskExecutionContext,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
Logger logger) { this.logHandler = logHandler; this.taskExecutionContext = taskExecutionContext; this.logger = logger; this.logBuffer = Collections.synchronizedList(new ArrayList<>()); this.taskExecutionContextCacheManager = SpringApplicationContext.getBean(TaskExecutionContextCacheManagerImpl.class); } protected AbstractCommandExecutor(List<String> logBuffer) { this.logBuffer = logBuffer; } /** * build process * * @param commandFile command file * @throws IOException IO Exception */ private void buildProcess(String commandFile) throws IOException { List<String> command = new LinkedList<>(); ProcessBuilder processBuilder = new ProcessBuilder(); processBuilder.directory(new File(taskExecutionContext.getExecutePath())); processBuilder.redirectErrorStream(true); if (CommonUtils.isSudoEnable()) { command.add("sudo"); command.add("-u"); command.add(taskExecutionContext.getTenantCode());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
} command.add(commandInterpreter()); command.addAll(commandOptions()); command.add(commandFile); processBuilder.command(command); process = processBuilder.start(); printCommand(command); } /** * task specific execution logic * * @param execCommand execCommand * @return CommandExecuteResult * @throws Exception if error throws Exception */ public CommandExecuteResult run(String execCommand) throws Exception { CommandExecuteResult result = new CommandExecuteResult(); int taskInstanceId = taskExecutionContext.getTaskInstanceId(); if (null == taskExecutionContextCacheManager.getByTaskInstanceId(taskInstanceId)) { result.setExitStatusCode(EXIT_CODE_KILL); return result; } if (StringUtils.isEmpty(execCommand)) { taskExecutionContextCacheManager.removeByTaskInstanceId(taskInstanceId); return result; } String commandFilePath = buildCommandFilePath();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
createCommandFileIfNotExists(execCommand, commandFilePath); buildProcess(commandFilePath); parseProcessOutput(process); Integer processId = getProcessId(process); result.setProcessId(processId); taskExecutionContext.setProcessId(processId); boolean updateTaskExecutionContextStatus = taskExecutionContextCacheManager.updateTaskExecutionContext(taskExecutionContext); if (Boolean.FALSE.equals(updateTaskExecutionContextStatus)) { ProcessUtils.kill(taskExecutionContext); result.setExitStatusCode(EXIT_CODE_KILL); return result; } logger.info("process start, process id is: {}", processId); long remainTime = getRemaintime(); boolean status = process.waitFor(remainTime, TimeUnit.SECONDS); logger.info("process has exited, execute path:{}, processId:{} ,exitStatusCode:{}", taskExecutionContext.getExecutePath(), processId , result.getExitStatusCode()); if (status) { List<String> appIds = getAppIds(taskExecutionContext.getLogPath());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
result.setAppIds(String.join(Constants.COMMA, appIds)); result.setExitStatusCode(process.exitValue()); if (process.exitValue() == 0) { result.setExitStatusCode(isSuccessOfYarnState(appIds) ? EXIT_CODE_SUCCESS : EXIT_CODE_FAILURE); } } else { logger.error("process has failure , exitStatusCode : {} , ready to kill ...", result.getExitStatusCode()); ProcessUtils.kill(taskExecutionContext); result.setExitStatusCode(EXIT_CODE_FAILURE); } return result; } public String getVarPool() { return varPool.toString(); } /** * cancel application * * @throws Exception exception */ public void cancelApplication() throws Exception { if (process == null) { return; } clear(); int processId = getProcessId(process); logger.info("cancel process: {}", processId);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
boolean killed = softKill(processId); if (!killed) { hardKill(processId); process.destroy(); process = null; } } /** * soft kill * * @param processId process id * @return process is alive * @throws InterruptedException interrupted exception */ private boolean softKill(int processId) { if (processId != 0 && process.isAlive()) { try { String cmd = String.format("kill %d", processId); cmd = OSUtils.getSudoCmd(taskExecutionContext.getTenantCode(), cmd); logger.info("soft kill task:{}, process id:{}, cmd:{}", taskExecutionContext.getTaskAppId(), processId, cmd); Runtime.getRuntime().exec(cmd); } catch (IOException e) { logger.info("kill attempt failed", e); } } return !process.isAlive();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
} /** * hard kill * * @param processId process id */ private void hardKill(int processId) { if (processId != 0 && process.isAlive()) { try { String cmd = String.format("kill -9 %d", processId); cmd = OSUtils.getSudoCmd(taskExecutionContext.getTenantCode(), cmd); logger.info("hard kill task:{}, process id:{}, cmd:{}", taskExecutionContext.getTaskAppId(), processId, cmd); Runtime.getRuntime().exec(cmd); } catch (IOException e) { logger.error("kill attempt failed ", e); } } } /** * print command * * @param commands process builder */ private void printCommand(List<String> commands) { String cmdStr; try { cmdStr = ProcessUtils.buildCommandStr(commands); logger.info("task run command:\n{}", cmdStr); } catch (Exception e) { logger.error(e.getMessage(), e);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
} } /** * clear */ private void clear() { List<String> markerList = new ArrayList<>(); markerList.add(ch.qos.logback.classic.ClassicConstants.FINALIZE_SESSION_MARKER.toString()); if (!logBuffer.isEmpty()) { logHandler.accept(logBuffer); logBuffer.clear(); } logHandler.accept(markerList); } /** * get the standard output of the process * * @param process process */ private void parseProcessOutput(Process process) { String threadLoggerInfoName = String.format(LoggerUtils.TASK_LOGGER_THREAD_NAME + "-%s", taskExecutionContext.getTaskAppId()); ExecutorService getOutputLogService = ThreadUtils.newDaemonSingleThreadExecutor(threadLoggerInfoName + "-" + "getOutputLogService"); getOutputLogService.submit(() -> { BufferedReader inReader = null; try { inReader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; logBuffer.add("welcome to use bigdata scheduling system..."); while ((line = inReader.readLine()) != null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
if (line.startsWith("${setValue(")) { varPool.append(line.substring("${setValue(".length(), line.length() - 2)); varPool.append("$VarPool$"); } else { logBuffer.add(line); taskResultString = line; } } } catch (Exception e) { logger.error(e.getMessage(), e); } finally { logOutputIsScuccess = true; close(inReader); } }); getOutputLogService.shutdown(); ExecutorService parseProcessOutputExecutorService = ThreadUtils.newDaemonSingleThreadExecutor(threadLoggerInfoName); parseProcessOutputExecutorService.submit(() -> { try { long lastFlushTime = System.currentTimeMillis(); while (logBuffer.size() > 0 || !logOutputIsScuccess) { if (logBuffer.size() > 0) { lastFlushTime = flush(lastFlushTime); } else { Thread.sleep(Constants.DEFAULT_LOG_FLUSH_INTERVAL); } } } catch (Exception e) { logger.error(e.getMessage(), e); } finally {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
clear(); } }); parseProcessOutputExecutorService.shutdown(); } /** * check yarn state * * @param appIds application id list * @return is success of yarn task state */ public boolean isSuccessOfYarnState(List<String> appIds) { boolean result = true; try { for (String appId : appIds) { while (Stopper.isRunning()) { ExecutionStatus applicationStatus = HadoopUtils.getInstance().getApplicationStatus(appId); logger.info("appId:{}, final state:{}", appId, applicationStatus.name()); if (applicationStatus.equals(ExecutionStatus.FAILURE) || applicationStatus.equals(ExecutionStatus.KILL)) { return false; } if (applicationStatus.equals(ExecutionStatus.SUCCESS)) { break; } Thread.sleep(Constants.SLEEP_TIME_MILLIS); } } } catch (Exception e) { logger.error(String.format("yarn applications: %s status failed ", appIds.toString()), e);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
result = false; } return result; } public int getProcessId() { return getProcessId(process); } /** * get app links * * @param logPath log path * @return app id list */ private List<String> getAppIds(String logPath) { List<String> logs = convertFile2List(logPath); List<String> appIds = new ArrayList<>(); /** * analysis log?get submited yarn application id */ for (String log : logs) { String appId = findAppId(log); if (StringUtils.isNotEmpty(appId) && !appIds.contains(appId)) { logger.info("find app id: {}", appId); appIds.add(appId); } } return appIds; } /** * convert file to list
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
* * @param filename file name * @return line list */ private List<String> convertFile2List(String filename) { List lineList = new ArrayList<String>(100); File file = new File(filename); if (!file.exists()) { return lineList; } BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader(new FileInputStream(filename), StandardCharsets.UTF_8)); String line = null; while ((line = br.readLine()) != null) { lineList.add(line); } } catch (Exception e) { logger.error(String.format("read file: %s failed : ", filename), e); } finally { if (br != null) { try { br.close(); } catch (IOException e) { logger.error(e.getMessage(), e); } } } return lineList; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
/** * find app id * * @param line line * @return appid */ private String findAppId(String line) { Matcher matcher = APPLICATION_REGEX.matcher(line); if (matcher.find()) { return matcher.group(); } return null; } /** * get remain time(s) * * @return remain time */ private long getRemaintime() { long usedTime = (System.currentTimeMillis() - taskExecutionContext.getStartTime().getTime()) / 1000; long remainTime = taskExecutionContext.getTaskTimeout() - usedTime; if (remainTime < 0) { throw new RuntimeException("task execution time out"); } return remainTime; } /** * get process id * * @param process process
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
* @return process id */ private int getProcessId(Process process) { int processId = 0; try { Field f = process.getClass().getDeclaredField(Constants.PID); f.setAccessible(true); processId = f.getInt(process); } catch (Throwable e) { logger.error(e.getMessage(), e); } return processId; } /** * when log buffer siz or flush time reach condition , then flush * * @param lastFlushTime last flush time * @return last flush time */ private long flush(long lastFlushTime) { long now = System.currentTimeMillis(); /** * when log buffer siz or flush time reach condition , then flush */ if (logBuffer.size() >= Constants.DEFAULT_LOG_ROWS_NUM || now - lastFlushTime > Constants.DEFAULT_LOG_FLUSH_INTERVAL) { lastFlushTime = now; /** logHandler.accept(logBuffer); logBuffer.clear(); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,721
[Bug][worker] The shell background starts the YARN task scenario, and the kill function is abnormal
**Describe the bug** The shell background starts the YARN task scenario, and the kill function is abnormal **To Reproduce** 1.Create a new shell task to start the yarn task in the background 2.While the yarn task is running, the page clicks on this task kill function **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Which version of Dolphin Scheduler:** -[1.3.4-release,dev] --- **描述 bug** 在shell后台启动yarn任务场景,kill功能异常 **To Reproduce** 1.新建一个shell任务,用于后台启动yarn任务 2.在yarn任务正在运行时,页面点击此任务kill功能 异常: 页面点击kill后,工作流实例显示状态为准备停止 ![image](https://user-images.githubusercontent.com/37063904/107142822-606be400-696c-11eb-97a8-466dbdc1dd80.png) ![image](https://user-images.githubusercontent.com/37063904/107142827-6661c500-696c-11eb-99ed-2bcf204b3412.png) worker日志 任务正在运行日志 ![image](https://user-images.githubusercontent.com/37063904/107142955-2cdd8980-696d-11eb-96e9-300a28b5e156.png) 任务kill时日志 ![image](https://user-images.githubusercontent.com/37063904/107143000-86de4f00-696d-11eb-977a-e168b1b757c3.png)
https://github.com/apache/dolphinscheduler/issues/4721
https://github.com/apache/dolphinscheduler/pull/4722
9c3cec5bbdec2eea90e4525da9e4b915d4b5bb82
e53369318bdf61f169dcbf2644caf8521b3dd536
"2021-02-07T09:54:49Z"
java
"2021-03-30T14:33:49Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
return lastFlushTime; } /** * close buffer reader * * @param inReader in reader */ private void close(BufferedReader inReader) { if (inReader != null) { try { inReader.close(); } catch (IOException e) { logger.error(e.getMessage(), e); } } } protected List<String> commandOptions() { return Collections.emptyList(); } protected abstract String buildCommandFilePath(); protected abstract String commandInterpreter(); protected abstract void createCommandFileIfNotExists(String execCommand, String commandFile) throws IOException; public String getTaskResultString() { return taskResultString; } public void setTaskResultString(String taskResultString) { this.taskResultString = taskResultString; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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; import org.apache.dolphinscheduler.api.dto.resources.ResourceComponent;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
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.common.enums.ResourceType; import org.apache.dolphinscheduler.common.utils.BooleanUtils; import org.apache.dolphinscheduler.common.utils.CollectionUtils; 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.common.utils.StringUtils; 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;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
import org.apache.dolphinscheduler.dao.utils.ResourceProcessDefinitionUtils; import org.apache.commons.beanutils.BeanMap; 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; /** * resources service impl */ @Service public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesService {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
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, ResourceType type,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
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, 0, 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); } catch (DuplicateKeyException e) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
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, MultipartFile file,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
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, 0, 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()) { if (!"class".equalsIgnoreCase(entry.getKey().toString())) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
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 userId user id * @param type type * @return true if resource exists */ private boolean checkResourceExists(String fullName, int userId, int type) { Boolean existResource = resourcesMapper.existResource(fullName, userId, type); return BooleanUtils.isTrue(existResource); } /** * update resource
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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, 0, 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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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 = FileUtils.suffix(originFullName); String suffix = FileUtils.suffix(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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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.setFileName(file.getOriginalFilename()); 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)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
udfFuncs = udfFuncs.stream().map(t -> { 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) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
logger.error(Status.UPDATE_RESOURCE_ERROR.getMsg(), e); 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) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
logger.error(MessageFormat.format("hdfs copy {0} -> {1} fail", originHdfsFileName, destHdfsFileName), e); 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 = FileUtils.suffix(file.getOriginalFilename()); String nameSuffix = FileUtils.suffix(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);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
return result; } 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 Map<String, Object> queryResourceListPaging(User loginUser, int directoryId, ResourceType type, String searchVal, Integer pageNo, Integer pageSize) { HashMap<String, Object> result = new HashMap<>(); Page<Resource> page = new Page<>(pageNo, pageSize); int userId = loginUser.getId(); if (isAdmin(loginUser)) { userId = 0; } if (directoryId != -1) { Resource directory = resourcesMapper.selectById(directoryId);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
if (directory == null) { 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.setTotalCount((int)resourceIPage.getTotal()); pageInfo.setLists(resourceIPage.getRecords()); result.put(Constants.DATA_LIST, 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)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
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)); } } 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 = FileUtils.suffix(file.getOriginalFilename()); String nameSuffix = FileUtils.suffix(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());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
String hdfsFilename = HadoopUtils.getHdfsFileName(type,tenantCode,fullName); 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) { 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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
List<Map<String, Object>> list = processDefinitionMapper.listResources(); Map<Integer, Set<Integer>> 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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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, 0, 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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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.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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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 = FileUtils.suffix(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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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 = FileUtils.suffix(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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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.TENANT_NOT_EXIST); return null; } return tenant.getTenantCode(); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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
5,124
[Bug][API] do not set file name when reupload
**For better global communication, Please describe it in English. If you feel the description in English is not clear, then you can append description in Chinese(just for Mandarin(CN)), thx! ** **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** 1. upload file with name "ojdbc3.jar" 2. reupload file with name "ojdbc3.jar" and real file name is "ojdbc6jar" ![image](https://user-images.githubusercontent.com/11975398/111952083-88c83000-8b1f-11eb-8b76-70b72eb3372a.png) **Expected behavior** fileName is same with what we specify
https://github.com/apache/dolphinscheduler/issues/5124
https://github.com/apache/dolphinscheduler/pull/5125
f20bb54896a9ac7b65c20b0cc7b0a744d1741155
6b565f0aed07cd328702d9fc1bec99e682c7525f
"2021-03-22T07:14:07Z"
java
"2021-04-01T12:44:03Z"
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
5,199
[Bug][api] When sleep is included in a shell task, cannot kill the task
![image](https://user-images.githubusercontent.com/55787491/113400980-429f8600-93d5-11eb-8002-7684d36d6ed1.png) ![image](https://user-images.githubusercontent.com/55787491/113401140-81cdd700-93d5-11eb-89dd-a259284e5dae.png) **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5199
https://github.com/apache/dolphinscheduler/pull/5212
97fb08f0ced20a4b9563725ed9e9600e5ea5722b
4a1303b625f3425550636a522ad2e38bd8cae1b7
"2021-04-02T09:04:44Z"
java
"2021-04-06T02:47:53Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.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.
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,199
[Bug][api] When sleep is included in a shell task, cannot kill the task
![image](https://user-images.githubusercontent.com/55787491/113400980-429f8600-93d5-11eb-8002-7684d36d6ed1.png) ![image](https://user-images.githubusercontent.com/55787491/113401140-81cdd700-93d5-11eb-89dd-a259284e5dae.png) **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5199
https://github.com/apache/dolphinscheduler/pull/5212
97fb08f0ced20a4b9563725ed9e9600e5ea5722b
4a1303b625f3425550636a522ad2e38bd8cae1b7
"2021-04-02T09:04:44Z"
java
"2021-04-06T02:47:53Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
* See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.server.utils; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.utils.CollectionUtils; import org.apache.dolphinscheduler.common.utils.CommonUtils; import org.apache.dolphinscheduler.common.utils.FileUtils; import org.apache.dolphinscheduler.common.utils.HadoopUtils; import org.apache.dolphinscheduler.common.utils.LoggerUtils; import org.apache.dolphinscheduler.common.utils.OSUtils; import org.apache.dolphinscheduler.common.utils.PropertyUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.remote.utils.Host; import org.apache.dolphinscheduler.server.entity.TaskExecutionContext; import org.apache.dolphinscheduler.service.log.LogClientService; import java.io.File; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * mainly used to get the start command line of a process. */ public class ProcessUtils {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,199
[Bug][api] When sleep is included in a shell task, cannot kill the task
![image](https://user-images.githubusercontent.com/55787491/113400980-429f8600-93d5-11eb-8002-7684d36d6ed1.png) ![image](https://user-images.githubusercontent.com/55787491/113401140-81cdd700-93d5-11eb-89dd-a259284e5dae.png) **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5199
https://github.com/apache/dolphinscheduler/pull/5212
97fb08f0ced20a4b9563725ed9e9600e5ea5722b
4a1303b625f3425550636a522ad2e38bd8cae1b7
"2021-04-02T09:04:44Z"
java
"2021-04-06T02:47:53Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
/** * logger */ private static final Logger logger = LoggerFactory.getLogger(ProcessUtils.class); /** * Initialization regularization, solve the problem of pre-compilation performance, * avoid the thread safety problem of multi-thread operation */ private static final Pattern MACPATTERN = Pattern.compile("-[+|-]-\\s(\\d+)"); /** * Expression of PID recognition in Windows scene */ private static final Pattern WINDOWSATTERN = Pattern.compile("\\w+\\((\\d+)\\)"); private static final String LOCAL_PROCESS_EXEC = "jdk.lang.Process.allowAmbiguousCommands"; /** * build command line characters. * * @param commandList command list * @return command */ public static String buildCommandStr(List<String> commandList) { String cmdstr; String[] cmd = commandList.toArray(new String[0]); SecurityManager security = System.getSecurityManager(); boolean allowAmbiguousCommands = isAllowAmbiguousCommands(security); if (allowAmbiguousCommands) { String executablePath = new File(cmd[0]).getPath(); if (needsEscaping(VERIFICATION_LEGACY, executablePath)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,199
[Bug][api] When sleep is included in a shell task, cannot kill the task
![image](https://user-images.githubusercontent.com/55787491/113400980-429f8600-93d5-11eb-8002-7684d36d6ed1.png) ![image](https://user-images.githubusercontent.com/55787491/113401140-81cdd700-93d5-11eb-89dd-a259284e5dae.png) **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5199
https://github.com/apache/dolphinscheduler/pull/5212
97fb08f0ced20a4b9563725ed9e9600e5ea5722b
4a1303b625f3425550636a522ad2e38bd8cae1b7
"2021-04-02T09:04:44Z"
java
"2021-04-06T02:47:53Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
executablePath = quoteString(executablePath); } cmdstr = createCommandLine( VERIFICATION_LEGACY, executablePath, cmd); } else { String executablePath; try { executablePath = getExecutablePath(cmd[0]); } catch (IllegalArgumentException e) { StringBuilder join = new StringBuilder(); for (String s : cmd) { join.append(s).append(' '); } cmd = getTokensFromCommand(join.toString()); executablePath = getExecutablePath(cmd[0]); if (security != null) { security.checkExec(executablePath); } } cmdstr = createCommandLine( isShellFile(executablePath) ? VERIFICATION_CMD_BAT : VERIFICATION_WIN32, quoteString(executablePath), cmd); } return cmdstr; } /** * check is allow ambiguous commands * * @param security security manager * @return allow ambiguous command flag
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,199
[Bug][api] When sleep is included in a shell task, cannot kill the task
![image](https://user-images.githubusercontent.com/55787491/113400980-429f8600-93d5-11eb-8002-7684d36d6ed1.png) ![image](https://user-images.githubusercontent.com/55787491/113401140-81cdd700-93d5-11eb-89dd-a259284e5dae.png) **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5199
https://github.com/apache/dolphinscheduler/pull/5212
97fb08f0ced20a4b9563725ed9e9600e5ea5722b
4a1303b625f3425550636a522ad2e38bd8cae1b7
"2021-04-02T09:04:44Z"
java
"2021-04-06T02:47:53Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
*/ private static boolean isAllowAmbiguousCommands(SecurityManager security) { boolean allowAmbiguousCommands = false; if (security == null) { allowAmbiguousCommands = true; String value = System.getProperty(LOCAL_PROCESS_EXEC); if (value != null) { allowAmbiguousCommands = !Constants.STRING_FALSE.equalsIgnoreCase(value); } } return allowAmbiguousCommands; } /** * get executable path. * * @param path path * @return executable path */ private static String getExecutablePath(String path) { boolean pathIsQuoted = isQuoted(true, path, "Executable name has embedded quote, split the arguments"); File fileToRun = new File(pathIsQuoted ? path.substring(1, path.length() - 1) : path); return fileToRun.getPath(); } /** * whether is shell file. * * @param executablePath executable path * @return true if endsWith .CMD or .BAT */ private static boolean isShellFile(String executablePath) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,199
[Bug][api] When sleep is included in a shell task, cannot kill the task
![image](https://user-images.githubusercontent.com/55787491/113400980-429f8600-93d5-11eb-8002-7684d36d6ed1.png) ![image](https://user-images.githubusercontent.com/55787491/113401140-81cdd700-93d5-11eb-89dd-a259284e5dae.png) **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5199
https://github.com/apache/dolphinscheduler/pull/5212
97fb08f0ced20a4b9563725ed9e9600e5ea5722b
4a1303b625f3425550636a522ad2e38bd8cae1b7
"2021-04-02T09:04:44Z"
java
"2021-04-06T02:47:53Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
String upPath = executablePath.toUpperCase(); return (upPath.endsWith(".CMD") || upPath.endsWith(".BAT")); } /** * quote string. * * @param arg argument * @return format arg */ private static String quoteString(String arg) { return '"' + arg + '"'; } /** * get tokens from command. * * @param command command * @return token string array */ private static String[] getTokensFromCommand(String command) { ArrayList<String> matchList = new ArrayList<>(8); Matcher regexMatcher = LazyPattern.PATTERN.matcher(command); while (regexMatcher.find()) { matchList.add(regexMatcher.group()); } return matchList.toArray(new String[0]); } /** * Lazy Pattern. */ private static class LazyPattern {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,199
[Bug][api] When sleep is included in a shell task, cannot kill the task
![image](https://user-images.githubusercontent.com/55787491/113400980-429f8600-93d5-11eb-8002-7684d36d6ed1.png) ![image](https://user-images.githubusercontent.com/55787491/113401140-81cdd700-93d5-11eb-89dd-a259284e5dae.png) **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5199
https://github.com/apache/dolphinscheduler/pull/5212
97fb08f0ced20a4b9563725ed9e9600e5ea5722b
4a1303b625f3425550636a522ad2e38bd8cae1b7
"2021-04-02T09:04:44Z"
java
"2021-04-06T02:47:53Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
/** * Escape-support version: * "(\")((?:\\\\\\1|.)+?)\\1|([^\\s\"]+)"; */ private static final Pattern PATTERN = Pattern.compile("[^\\s\"]+|\"[^\"]*\""); } /** * verification cmd bat. */ private static final int VERIFICATION_CMD_BAT = 0; /** * verification win32. */ private static final int VERIFICATION_WIN32 = 1; /** * verification legacy. */ private static final int VERIFICATION_LEGACY = 2;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,199
[Bug][api] When sleep is included in a shell task, cannot kill the task
![image](https://user-images.githubusercontent.com/55787491/113400980-429f8600-93d5-11eb-8002-7684d36d6ed1.png) ![image](https://user-images.githubusercontent.com/55787491/113401140-81cdd700-93d5-11eb-89dd-a259284e5dae.png) **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5199
https://github.com/apache/dolphinscheduler/pull/5212
97fb08f0ced20a4b9563725ed9e9600e5ea5722b
4a1303b625f3425550636a522ad2e38bd8cae1b7
"2021-04-02T09:04:44Z"
java
"2021-04-06T02:47:53Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
/** * escape verification. */ private static final char[][] ESCAPE_VERIFICATION = {{' ', '\t', '<', '>', '&', '|', '^'}, {' ', '\t', '<', '>'}, {' ', '\t'}}; /** * create command line. * * @param verificationType verification type * @param executablePath executable path * @param cmd cmd * @return command line */ private static String createCommandLine(int verificationType, final String executablePath, final String[] cmd) { StringBuilder cmdbuf = new StringBuilder(80); cmdbuf.append(executablePath); for (int i = 1; i < cmd.length; ++i) { cmdbuf.append(' '); String s = cmd[i]; if (needsEscaping(verificationType, s)) { cmdbuf.append('"').append(s); if ((verificationType != VERIFICATION_CMD_BAT) && s.endsWith("\\")) { cmdbuf.append('\\'); } cmdbuf.append('"'); } else { cmdbuf.append(s); } } return cmdbuf.toString();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,199
[Bug][api] When sleep is included in a shell task, cannot kill the task
![image](https://user-images.githubusercontent.com/55787491/113400980-429f8600-93d5-11eb-8002-7684d36d6ed1.png) ![image](https://user-images.githubusercontent.com/55787491/113401140-81cdd700-93d5-11eb-89dd-a259284e5dae.png) **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5199
https://github.com/apache/dolphinscheduler/pull/5212
97fb08f0ced20a4b9563725ed9e9600e5ea5722b
4a1303b625f3425550636a522ad2e38bd8cae1b7
"2021-04-02T09:04:44Z"
java
"2021-04-06T02:47:53Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
} /** * whether is quoted. * * @param noQuotesInside no quotes inside * @param arg arg * @param errorMessage error message * @return boolean */ private static boolean isQuoted(boolean noQuotesInside, String arg, String errorMessage) { int lastPos = arg.length() - 1; if (lastPos >= 1 && arg.charAt(0) == '"' && arg.charAt(lastPos) == '"') { if (noQuotesInside && arg.indexOf('"', 1) != lastPos) { throw new IllegalArgumentException(errorMessage); } return true; } if (noQuotesInside && arg.indexOf('"') >= 0) { throw new IllegalArgumentException(errorMessage); } return false; } /** * whether needs escaping. * * @param verificationType verification type * @param arg arg
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,199
[Bug][api] When sleep is included in a shell task, cannot kill the task
![image](https://user-images.githubusercontent.com/55787491/113400980-429f8600-93d5-11eb-8002-7684d36d6ed1.png) ![image](https://user-images.githubusercontent.com/55787491/113401140-81cdd700-93d5-11eb-89dd-a259284e5dae.png) **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5199
https://github.com/apache/dolphinscheduler/pull/5212
97fb08f0ced20a4b9563725ed9e9600e5ea5722b
4a1303b625f3425550636a522ad2e38bd8cae1b7
"2021-04-02T09:04:44Z"
java
"2021-04-06T02:47:53Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
* @return boolean */ private static boolean needsEscaping(int verificationType, String arg) { boolean argIsQuoted = isQuoted((verificationType == VERIFICATION_CMD_BAT), arg, "Argument has embedded quote, use the explicit CMD.EXE call."); if (!argIsQuoted) { char[] testEscape = ESCAPE_VERIFICATION[verificationType]; for (char c : testEscape) { if (arg.indexOf(c) >= 0) { return true; } } } return false; } /** * kill yarn application. * * @param appIds app id list * @param logger logger * @param tenantCode tenant code * @param executePath execute path */ public static void cancelApplication(List<String> appIds, Logger logger, String tenantCode, String executePath) { if (CollectionUtils.isNotEmpty(appIds)) { for (String appId : appIds) { try { ExecutionStatus applicationStatus = HadoopUtils.getInstance().getApplicationStatus(appId); if (!applicationStatus.typeIsFinished()) { String commandFile = String .format("%s/%s.kill", executePath, appId);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,199
[Bug][api] When sleep is included in a shell task, cannot kill the task
![image](https://user-images.githubusercontent.com/55787491/113400980-429f8600-93d5-11eb-8002-7684d36d6ed1.png) ![image](https://user-images.githubusercontent.com/55787491/113401140-81cdd700-93d5-11eb-89dd-a259284e5dae.png) **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5199
https://github.com/apache/dolphinscheduler/pull/5212
97fb08f0ced20a4b9563725ed9e9600e5ea5722b
4a1303b625f3425550636a522ad2e38bd8cae1b7
"2021-04-02T09:04:44Z"
java
"2021-04-06T02:47:53Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
String cmd = getKerberosInitCommand() + "yarn application -kill " + appId; execYarnKillCommand(logger, tenantCode, appId, commandFile, cmd); } } catch (Exception e) { logger.error(String.format("Get yarn application app id [%s] status failed: [%s]", appId, e.getMessage())); } } } } /** * get kerberos init command */ public static String getKerberosInitCommand() { logger.info("get kerberos init command"); StringBuilder kerberosCommandBuilder = new StringBuilder(); boolean hadoopKerberosState = PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE,false); if (hadoopKerberosState) { kerberosCommandBuilder.append("export KRB5_CONFIG=") .append(PropertyUtils.getString(Constants.JAVA_SECURITY_KRB5_CONF_PATH)) .append("\n\n") .append(String.format("kinit -k -t %s %s || true",PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_PATH),PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_USERNAME))) .append("\n\n"); logger.info("kerberos init command: {}", kerberosCommandBuilder); } return kerberosCommandBuilder.toString(); } /** * build kill command for yarn application * * @param logger logger
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,199
[Bug][api] When sleep is included in a shell task, cannot kill the task
![image](https://user-images.githubusercontent.com/55787491/113400980-429f8600-93d5-11eb-8002-7684d36d6ed1.png) ![image](https://user-images.githubusercontent.com/55787491/113401140-81cdd700-93d5-11eb-89dd-a259284e5dae.png) **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5199
https://github.com/apache/dolphinscheduler/pull/5212
97fb08f0ced20a4b9563725ed9e9600e5ea5722b
4a1303b625f3425550636a522ad2e38bd8cae1b7
"2021-04-02T09:04:44Z"
java
"2021-04-06T02:47:53Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
* @param tenantCode tenant code * @param appId app id * @param commandFile command file * @param cmd cmd */ private static void execYarnKillCommand(Logger logger, String tenantCode, String appId, String commandFile, String cmd) { try { StringBuilder sb = new StringBuilder(); sb.append("#!/bin/sh\n"); sb.append("BASEDIR=$(cd `dirname $0`; pwd)\n"); sb.append("cd $BASEDIR\n"); if (CommonUtils.getSystemEnvPath() != null) { sb.append("source ").append(CommonUtils.getSystemEnvPath()).append("\n"); } sb.append("\n\n"); sb.append(cmd); File f = new File(commandFile); if (!f.exists()) { FileUtils.writeStringToFile(new File(commandFile), sb.toString(), StandardCharsets.UTF_8); } String runCmd = String.format("%s %s", Constants.SH, commandFile); runCmd = OSUtils.getSudoCmd(tenantCode, runCmd); logger.info("kill cmd:{}", runCmd); OSUtils.exeCmd(runCmd); } catch (Exception e) { logger.error(String.format("Kill yarn application app id [%s] failed: [%s]", appId, e.getMessage())); } } /** * kill tasks according to different task types.
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,199
[Bug][api] When sleep is included in a shell task, cannot kill the task
![image](https://user-images.githubusercontent.com/55787491/113400980-429f8600-93d5-11eb-8002-7684d36d6ed1.png) ![image](https://user-images.githubusercontent.com/55787491/113401140-81cdd700-93d5-11eb-89dd-a259284e5dae.png) **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5199
https://github.com/apache/dolphinscheduler/pull/5212
97fb08f0ced20a4b9563725ed9e9600e5ea5722b
4a1303b625f3425550636a522ad2e38bd8cae1b7
"2021-04-02T09:04:44Z"
java
"2021-04-06T02:47:53Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
* * @param taskExecutionContext taskExecutionContext */ public static void kill(TaskExecutionContext taskExecutionContext) { try { int processId = taskExecutionContext.getProcessId(); if (processId == 0) { logger.error("process kill failed, process id :{}, task id:{}", processId, taskExecutionContext.getTaskInstanceId()); return; } String pidsStr = getPidsStr(processId); if (StringUtils.isNotEmpty(pidsStr)) { String cmd = String.format("kill -9 %s", pidsStr); cmd = OSUtils.getSudoCmd(taskExecutionContext.getTenantCode(), cmd); logger.info("process id:{}, cmd:{}", processId, cmd); OSUtils.exeCmd(cmd); } } catch (Exception e) { logger.error("kill task failed", e); } killYarnJob(taskExecutionContext); } /** * get pids str. * * @param processId process id * @return pids pid String * @throws Exception exception
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,199
[Bug][api] When sleep is included in a shell task, cannot kill the task
![image](https://user-images.githubusercontent.com/55787491/113400980-429f8600-93d5-11eb-8002-7684d36d6ed1.png) ![image](https://user-images.githubusercontent.com/55787491/113401140-81cdd700-93d5-11eb-89dd-a259284e5dae.png) **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5199
https://github.com/apache/dolphinscheduler/pull/5212
97fb08f0ced20a4b9563725ed9e9600e5ea5722b
4a1303b625f3425550636a522ad2e38bd8cae1b7
"2021-04-02T09:04:44Z"
java
"2021-04-06T02:47:53Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
*/ public static String getPidsStr(int processId) throws Exception { StringBuilder sb = new StringBuilder(); Matcher mat = null; if (OSUtils.isMacOS()) { String pids = OSUtils.exeCmd(String.format("%s -sp %d", Constants.PSTREE, processId)); if (null != pids) { mat = MACPATTERN.matcher(pids); } } else { String pids = OSUtils.exeCmd(String.format("%s -p %d", Constants.PSTREE, processId)); mat = WINDOWSATTERN.matcher(pids); } if (null != mat) { while (mat.find()) { sb.append(mat.group(1)).append(" "); } } return sb.toString().trim(); } /** * find logs and kill yarn tasks. * @param taskExecutionContext taskExecutionContext * @return yarn application ids */ public static List<String> killYarnJob(TaskExecutionContext taskExecutionContext) { try { Thread.sleep(Constants.SLEEP_TIME_MILLIS); LogClientService logClient = null;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,199
[Bug][api] When sleep is included in a shell task, cannot kill the task
![image](https://user-images.githubusercontent.com/55787491/113400980-429f8600-93d5-11eb-8002-7684d36d6ed1.png) ![image](https://user-images.githubusercontent.com/55787491/113401140-81cdd700-93d5-11eb-89dd-a259284e5dae.png) **Which version of Dolphin Scheduler:** -[1.3.6-prepare]
https://github.com/apache/dolphinscheduler/issues/5199
https://github.com/apache/dolphinscheduler/pull/5212
97fb08f0ced20a4b9563725ed9e9600e5ea5722b
4a1303b625f3425550636a522ad2e38bd8cae1b7
"2021-04-02T09:04:44Z"
java
"2021-04-06T02:47:53Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
String log; try { logClient = new LogClientService(); log = logClient.viewLog(Host.of(taskExecutionContext.getHost()).getIp(), Constants.RPC_PORT, taskExecutionContext.getLogPath()); } finally { if (logClient != null) { logClient.close(); } } if (StringUtils.isNotEmpty(log)) { List<String> appIds = LoggerUtils.getAppIds(log, logger); String workerDir = taskExecutionContext.getExecutePath(); if (StringUtils.isEmpty(workerDir)) { logger.error("task instance work dir is empty"); throw new RuntimeException("task instance work dir is empty"); } if (CollectionUtils.isNotEmpty(appIds)) { cancelApplication(appIds, logger, taskExecutionContext.getTenantCode(), taskExecutionContext.getExecutePath()); return appIds; } } } catch (Exception e) { logger.error("kill yarn job failure", e); } return Collections.emptyList(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,233
[Bug]If commandMap doesn't contains StartParams,REPEAT RUNNING processInstance will throw exceprion
[Bug]if commandMap doesn't contains CMD_PARAM_START_PARAMS,REPEAT RUNNING processInstance will throw exceprion. The commandMap contains key ,except the key of StartParams ,when REPEAT RUNNING processInstance will throw exceprion .
https://github.com/apache/dolphinscheduler/issues/5233
https://github.com/apache/dolphinscheduler/pull/5234
2f1f193ba85abb7d4738f4f10ad05e6d510132c5
5c898e38ed62b0f8d034d1e910be4b45692dae8e
"2021-04-08T08:40:01Z"
java
"2021-04-08T10:58:43Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,233
[Bug]If commandMap doesn't contains StartParams,REPEAT RUNNING processInstance will throw exceprion
[Bug]if commandMap doesn't contains CMD_PARAM_START_PARAMS,REPEAT RUNNING processInstance will throw exceprion. The commandMap contains key ,except the key of StartParams ,when REPEAT RUNNING processInstance will throw exceprion .
https://github.com/apache/dolphinscheduler/issues/5233
https://github.com/apache/dolphinscheduler/pull/5234
2f1f193ba85abb7d4738f4f10ad05e6d510132c5
5c898e38ed62b0f8d034d1e910be4b45692dae8e
"2021-04-08T08:40:01Z"
java
"2021-04-08T10:58:43Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.service.impl; import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE; import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_START_DATE; import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_RECOVER_PROCESS_ID_STRING; import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_START_NODE_NAMES; import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_START_PARAMS; import static org.apache.dolphinscheduler.common.Constants.MAX_TASK_TIMEOUT; import org.apache.commons.collections.MapUtils; import org.apache.dolphinscheduler.api.enums.ExecuteType; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.ExecutorService; import org.apache.dolphinscheduler.api.service.MonitorService; import org.apache.dolphinscheduler.api.service.ProjectService; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.FailureStrategy; import org.apache.dolphinscheduler.common.enums.Priority; import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.common.enums.RunMode; import org.apache.dolphinscheduler.common.enums.TaskDependType; import org.apache.dolphinscheduler.common.enums.WarningType; import org.apache.dolphinscheduler.common.model.Server;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,233
[Bug]If commandMap doesn't contains StartParams,REPEAT RUNNING processInstance will throw exceprion
[Bug]if commandMap doesn't contains CMD_PARAM_START_PARAMS,REPEAT RUNNING processInstance will throw exceprion. The commandMap contains key ,except the key of StartParams ,when REPEAT RUNNING processInstance will throw exceprion .
https://github.com/apache/dolphinscheduler/issues/5233
https://github.com/apache/dolphinscheduler/pull/5234
2f1f193ba85abb7d4738f4f10ad05e6d510132c5
5c898e38ed62b0f8d034d1e910be4b45692dae8e
"2021-04-08T08:40:01Z"
java
"2021-04-08T10:58:43Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
import org.apache.dolphinscheduler.common.utils.CollectionUtils; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; 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.Project; import org.apache.dolphinscheduler.dao.entity.Schedule; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.service.quartz.cron.CronUtils; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * executor service impl */ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,233
[Bug]If commandMap doesn't contains StartParams,REPEAT RUNNING processInstance will throw exceprion
[Bug]if commandMap doesn't contains CMD_PARAM_START_PARAMS,REPEAT RUNNING processInstance will throw exceprion. The commandMap contains key ,except the key of StartParams ,when REPEAT RUNNING processInstance will throw exceprion .
https://github.com/apache/dolphinscheduler/issues/5233
https://github.com/apache/dolphinscheduler/pull/5234
2f1f193ba85abb7d4738f4f10ad05e6d510132c5
5c898e38ed62b0f8d034d1e910be4b45692dae8e
"2021-04-08T08:40:01Z"
java
"2021-04-08T10:58:43Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
public class ExecutorServiceImpl extends BaseServiceImpl implements ExecutorService { private static final Logger logger = LoggerFactory.getLogger(ExecutorServiceImpl.class); @Autowired private ProjectMapper projectMapper; @Autowired private ProjectService projectService; @Autowired private ProcessDefinitionMapper processDefinitionMapper; @Autowired private MonitorService monitorService; @Autowired private ProcessInstanceMapper processInstanceMapper; @Autowired private ProcessService processService; /** * execute process instance * * @param loginUser login user * @param projectName project name * @param processDefinitionId process Definition Id * @param cronTime cron time * @param commandType command type
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,233
[Bug]If commandMap doesn't contains StartParams,REPEAT RUNNING processInstance will throw exceprion
[Bug]if commandMap doesn't contains CMD_PARAM_START_PARAMS,REPEAT RUNNING processInstance will throw exceprion. The commandMap contains key ,except the key of StartParams ,when REPEAT RUNNING processInstance will throw exceprion .
https://github.com/apache/dolphinscheduler/issues/5233
https://github.com/apache/dolphinscheduler/pull/5234
2f1f193ba85abb7d4738f4f10ad05e6d510132c5
5c898e38ed62b0f8d034d1e910be4b45692dae8e
"2021-04-08T08:40:01Z"
java
"2021-04-08T10:58:43Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
* @param failureStrategy failuer strategy * @param startNodeList start nodelist * @param taskDependType node dependency type * @param warningType warning type * @param warningGroupId notify group id * @param processInstancePriority process instance priority * @param workerGroup worker group name * @param runMode run mode * @param timeout timeout * @param startParams the global param values which pass to new process instance * @return execute process instance code */ @Override public Map<String, Object> execProcessInstance(User loginUser, String projectName, int processDefinitionId, String cronTime, CommandType commandType, FailureStrategy failureStrategy, String startNodeList, TaskDependType taskDependType, WarningType warningType, int warningGroupId, RunMode runMode, Priority processInstancePriority, String workerGroup, Integer timeout, Map<String, String> startParams) { Map<String, Object> result = new HashMap<>(); if (timeout <= 0 || timeout > MAX_TASK_TIMEOUT) { putMsg(result, Status.TASK_TIMEOUT_PARAMS_ERROR); return result; } Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResultAndAuth = checkResultAndAuth(loginUser, projectName, project); if (checkResultAndAuth != null) { return checkResultAndAuth;