diff --git a/SYSTEM_PARAMS.md b/SYSTEM_PARAMS.md new file mode 100644 index 0000000000000000000000000000000000000000..e8c6716f499ac4b5cf68de973f2dc4ef0eec3444 --- /dev/null +++ b/SYSTEM_PARAMS.md @@ -0,0 +1,14 @@ +## System parameters +System parameters refer to the parameters obtained directly through System.getproperty() in the code + +Param|Examples|Description of Associated Value +---|:---|:--- +os.name|'Mac OS X'|Operating system name +user.name|'hdfs'|User's account name +user.home|'/Users/hdfs'|User's home directory +user.dir|'/Users/hdfs/gitee_space/deepexi-daas-dolphinscheduler'|User's current working directory +file.separator|'/'|File separator ("/" on UNIX) +line.separator|'\n'|Line separator ("\n" on UNIX) +jdk.lang.Process.allowAmbiguousCommands|true|allow ambiguous commands flag +netty.epoll.enable|true|Netty enable Linux epoll model flag +dolphin.scheduler.network.interface.preferred| |Preferred network interface for dolphin scheduler \ No newline at end of file diff --git a/SYSTEM_PARAMS_zh_CN.md b/SYSTEM_PARAMS_zh_CN.md new file mode 100644 index 0000000000000000000000000000000000000000..c08cd0168ae3250659d50835b89b9d7ab65fd54e --- /dev/null +++ b/SYSTEM_PARAMS_zh_CN.md @@ -0,0 +1,14 @@ +## 系统参数 +系统参数,指的是代码中直接通过System.getProperty()获取的参数 + +参数|示例|描述 +---|:---:|:---:|:--- +os.name|'Mac OS X'|操作系统名称 +user.name|'squid'|操作系统用户名 +user.home|'/Users/squid'|操纵系统家目录 +user.dir|'/Users/squid/gitee_space/deepexi-daas-dolphinscheduler'|用户当前工作目录 +file.separator|'/'、 '\'|文件分割符,在UNIX系统中为'/' +line.separator|'\n'|换行符,在UNIX系统中为'\n' +jdk.lang.Process.allowAmbiguousCommands|true|是否允许执行本地命令 +netty.epoll.enable|true|netty是否启用Linux Epoll模型 +dolphin.scheduler.network.interface.preferred||dolphin.scheduler首选网络接口 \ No newline at end of file diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/LoggerServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/LoggerServiceImpl.java index db46c5bdfb52e6d186f4400444897c15a74e36dc..2f94200cab78a19d34c5a14b837d4bf2f50dc6ef 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/LoggerServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/LoggerServiceImpl.java @@ -22,6 +22,7 @@ import org.apache.dolphinscheduler.api.exceptions.ServiceException; import org.apache.dolphinscheduler.api.service.LoggerService; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; +import org.apache.dolphinscheduler.common.utils.OSUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.remote.utils.Host; @@ -100,7 +101,7 @@ public class LoggerServiceImpl implements LoggerService { String head = String.format(LOG_HEAD_FORMAT, taskInstance.getLogPath(), host, - Constants.SYSTEM_LINE_SEPARATOR); + OSUtils.getLineSeparator()); log.append(head); } @@ -128,7 +129,7 @@ public class LoggerServiceImpl implements LoggerService { byte[] head = String.format(LOG_HEAD_FORMAT, taskInstance.getLogPath(), host, - Constants.SYSTEM_LINE_SEPARATOR).getBytes(StandardCharsets.UTF_8); + OSUtils.getLineSeparator()).getBytes(StandardCharsets.UTF_8); return ArrayUtils.addAll(head, logClient.getLogBytes(host, Constants.RPC_PORT, taskInstance.getLogPath())); } diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/utils/FileUtilsTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/utils/FileUtilsTest.java index 1b05eb0e99188e31fa4d1038e051d50763421e14..ad40ecb3326a1124441ffed61c4007ae82676ed2 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/utils/FileUtilsTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/utils/FileUtilsTest.java @@ -31,6 +31,8 @@ import java.io.*; import static org.junit.Assert.*; +import org.apache.dolphinscheduler.common.utils.OSUtils; + public class FileUtilsTest { private static final Logger logger = LoggerFactory.getLogger(FileUtilsTest.class); @@ -63,7 +65,7 @@ public class FileUtilsTest { public void testCopyFile() throws IOException { //Define dest file path - String destFilename = rootPath + System.getProperty("file.separator") + "data.txt"; + String destFilename = rootPath + OSUtils.getFileSeparator() + "data.txt"; logger.info("destFilename: "+destFilename); //Define InputStream for MultipartFile @@ -87,7 +89,7 @@ public class FileUtilsTest { public void testFile2Resource() throws IOException { //Define dest file path - String destFilename = rootPath + System.getProperty("file.separator") + "data.txt"; + String destFilename = rootPath + OSUtils.getFileSeparator() + "data.txt"; logger.info("destFilename: "+destFilename); //Define test resource diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java index 4320bd9710a9d59dd1055d1a5c3a62f60081f47b..a53929ac3dcc7d8964a8fca05b2f9e98c18cffab 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java @@ -862,8 +862,8 @@ public final class Constants { ExecutionStatus.READY_PAUSE.ordinal(), ExecutionStatus.READY_STOP.ordinal(), ExecutionStatus.NEED_FAULT_TOLERANCE.ordinal(), - ExecutionStatus.WAITTING_THREAD.ordinal(), - ExecutionStatus.WAITTING_DEPEND.ordinal() + ExecutionStatus.WAITING_THREAD.ordinal(), + ExecutionStatus.WAITING_DEPEND.ordinal() }; /** @@ -1024,11 +1024,6 @@ public final class Constants { public static final String END_TIME = "end time"; public static final String START_END_DATE = "startDate,endDate"; - /** - * system line separator - */ - public static final String SYSTEM_LINE_SEPARATOR = System.getProperty("line.separator"); - /** * net system properties */ diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/CommandType.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/CommandType.java index 9682016d6f386fc21a99cdb42fa7f354b345fc36..4f24977c5f549dde7f1274ddab87e55542ae11b5 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/CommandType.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/CommandType.java @@ -50,7 +50,7 @@ public enum CommandType { REPEAT_RUNNING(7, "repeat running a process"), PAUSE(8, "pause a process"), STOP(9, "stop a process"), - RECOVER_WAITTING_THREAD(10, "recover waiting thread"); + RECOVER_WAITING_THREAD(10, "recover waiting thread"); CommandType(int code, String descp){ this.code = code; diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/ExecutionStatus.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/ExecutionStatus.java index b933c09f313f66fd26e46497274dedb8e9455ca4..637eab2a4c1b94c08e6eec2d851d8b3cffe7f676 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/ExecutionStatus.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/ExecutionStatus.java @@ -53,8 +53,8 @@ public enum ExecutionStatus { SUCCESS(7, "success"), NEED_FAULT_TOLERANCE(8, "need fault tolerance"), KILL(9, "kill"), - WAITTING_THREAD(10, "waiting thread"), - WAITTING_DEPEND(11, "waiting depend node complete"), + WAITING_THREAD(10, "waiting thread"), + WAITING_DEPEND(11, "waiting depend node complete"), DELAY_EXECUTION(12, "delay execution"), FORCED_SUCCESS(13, "forced success"); @@ -109,7 +109,7 @@ public enum ExecutionStatus { * @return status */ public boolean typeIsWaitingThread() { - return this == WAITTING_THREAD; + return this == WAITING_THREAD; } /** @@ -136,7 +136,7 @@ public enum ExecutionStatus { * @return status */ public boolean typeIsRunning() { - return this == RUNNING_EXECUTION || this == WAITTING_DEPEND || this == DELAY_EXECUTION; + return this == RUNNING_EXECUTION || this == WAITING_DEPEND || this == DELAY_EXECUTION; } /** diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/TaskStateType.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/TaskStateType.java index 36766a7f4d0404958e4c43f05dd65bd0f4c1358b..bfebb912f90021b6c14f3f199f12433df0ccd968 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/TaskStateType.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/TaskStateType.java @@ -27,7 +27,7 @@ public enum TaskStateType { * 3 failed * 4 success */ - WAITTING, RUNNING, FINISH, FAILED, SUCCESS; + WAITING, RUNNING, FINISH, FAILED, SUCCESS; /** * convert task state to execute status integer array ; @@ -55,7 +55,7 @@ public enum TaskStateType { ExecutionStatus.DELAY_EXECUTION.ordinal(), ExecutionStatus.READY_PAUSE.ordinal(), ExecutionStatus.READY_STOP.ordinal()}; - case WAITTING: + case WAITING: return new int[]{ ExecutionStatus.SUBMITTED_SUCCESS.ordinal() }; diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/DolphinPluginManagerConfig.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/DolphinPluginManagerConfig.java index 7979868ef48f501eaabfd66d53dd75d202ff49ba..68e3da4f7b0ce59dfd99f65a96b27e7420885f06 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/DolphinPluginManagerConfig.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/DolphinPluginManagerConfig.java @@ -20,6 +20,8 @@ package org.apache.dolphinscheduler.common.plugin; import static java.lang.String.format; import static java.util.Objects.requireNonNull; +import org.apache.dolphinscheduler.common.utils.OSUtils; + import java.io.File; import java.util.List; @@ -46,7 +48,7 @@ public class DolphinPluginManagerConfig { /** * Development, When AlertServer is running on IDE, AlertPluginLoad can load Alert Plugin from local Repository. */ - private String mavenLocalRepository = System.getProperty("user.home") + "/.m2/repository"; + private String mavenLocalRepository = OSUtils.getUserHome() + "/.m2/repository"; private List mavenRemoteRepository = ImmutableList.of("http://repo1.maven.org/maven2/"); File getInstalledPluginsDir() { diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/shell/AbstractShell.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/shell/AbstractShell.java index 9a24fdb407930f043be31212470b24a599be51c6..ba01deb15fb46598df40354d3a3dc3147dfa213b 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/shell/AbstractShell.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/shell/AbstractShell.java @@ -16,6 +16,8 @@ */ package org.apache.dolphinscheduler.common.shell; +import org.apache.dolphinscheduler.common.utils.OSUtils; + import java.io.BufferedReader; import java.io.File; import java.io.IOException; @@ -169,7 +171,7 @@ public abstract class AbstractShell { String line = errReader.readLine(); while((line != null) && !isInterrupted()) { errMsg.append(line); - errMsg.append(System.getProperty("line.separator")); + errMsg.append(OSUtils.getLineSeparator()); line = errReader.readLine(); } } catch(IOException ioe) { diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java index 4f0953f82445e2a442b414faea9de771d29aaa94..c2777203bf518a3a480e953c28a57f3682e7de13 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java @@ -260,7 +260,7 @@ public class NetUtils { } private static boolean isSpecifyNetworkInterface(NetworkInterface networkInterface) { - String preferredNetworkInterface = System.getProperty(DOLPHIN_SCHEDULER_PREFERRED_NETWORK_INTERFACE); + String preferredNetworkInterface = PropertyUtils.getString(DOLPHIN_SCHEDULER_PREFERRED_NETWORK_INTERFACE); return Objects.equals(networkInterface.getDisplayName(), preferredNetworkInterface); } diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java index 3851f77e94717237789e85d4a9244f8135191bbf..c96ef9e25e64d5789e90a39840215cef3ed5279d 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java @@ -381,7 +381,7 @@ public class OSUtils { */ public static String getGroup() throws IOException { if (isWindows()) { - String currentProcUserName = System.getProperty("user.name"); + String currentProcUserName = getUserName(); String result = exeCmd(String.format("net user \"%s\"", currentProcUserName)); String line = result.split("\n")[22]; String group = PATTERN.split(line)[1]; @@ -479,6 +479,51 @@ public class OSUtils { return System.getProperty("os.name"); } + /** + * get current OS user name + * + * @return current OS user name + */ + public static String getUserName() { + return System.getProperty("user.name"); + } + + /** + * get current OS user home + * + * @return current OS user home + */ + public static String getUserHome() { + return System.getProperty("user.home"); + } + + /** + * get current User's working directory + * + * @return current User's working directory + */ + public static String getUserDir() { + return System.getProperty("user.dir"); + } + + /** + * get file separator + * + * @return file separator + */ + public static String getFileSeparator() { + return System.getProperty("file.separator"); + } + + /** + * get line separator + * + * @return line separator + */ + public static String getLineSeparator() { + return System.getProperty("line.separator"); + } + /** * check memory and cpu usage * diff --git a/dolphinscheduler-common/src/main/resources/common.properties b/dolphinscheduler-common/src/main/resources/common.properties index 726c799c72c375351b4783362a366a88ac8ad7fa..ab4e84d4378fb99f600e9cc190fb2e61ee676aba 100644 --- a/dolphinscheduler-common/src/main/resources/common.properties +++ b/dolphinscheduler-common/src/main/resources/common.properties @@ -86,3 +86,9 @@ sudo.enable=true # development state development.state=false + +# allow ambiguous commands flag +jdk.lang.Process.allowAmbiguousCommands = true + +# preferred network interface for dolphin scheduler, if not, keep this value empty +dolphin.scheduler.network.interface.preferred = diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/enums/ExecutionStatusTest.java b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/enums/ExecutionStatusTest.java index 6d4be78aefae593f21e9dd04b871c59d823b5dd9..d1b44b7069279416cc7691946c90a912a85418ae 100644 --- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/enums/ExecutionStatusTest.java +++ b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/enums/ExecutionStatusTest.java @@ -26,7 +26,7 @@ public class ExecutionStatusTest extends TestCase { public void testTypeIsRunning() { assertTrue(ExecutionStatus.RUNNING_EXECUTION.typeIsRunning()); - assertTrue(ExecutionStatus.WAITTING_DEPEND.typeIsRunning()); + assertTrue(ExecutionStatus.WAITING_DEPEND.typeIsRunning()); assertTrue(ExecutionStatus.DELAY_EXECUTION.typeIsRunning()); } } \ No newline at end of file diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/UpgradeDao.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/UpgradeDao.java index f0ffc52f68f23c87b617e7917716690301743999..5633ea4e2101531c78c215a2a541f98c8926086b 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/UpgradeDao.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/UpgradeDao.java @@ -43,7 +43,7 @@ public abstract class UpgradeDao extends AbstractBaseDao { public static final Logger logger = LoggerFactory.getLogger(UpgradeDao.class); private static final String T_VERSION_NAME = "t_escheduler_version"; private static final String T_NEW_VERSION_NAME = "t_ds_version"; - private static final String rootDir = System.getProperty("user.dir"); + private static final String rootDir = OSUtils.getUserDir(); protected static final DataSource dataSource = getDataSource(); private static final DbType dbType = getCurrentDbType(); diff --git a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/utils/Constants.java b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/utils/Constants.java index 9ac1a9a72f6cc4b15cef4be0c407da0564915999..c51d95e63182179c6b46721d766d9f145d6db0fd 100644 --- a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/utils/Constants.java +++ b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/utils/Constants.java @@ -57,11 +57,6 @@ public class Constants { */ public static final String NETTY_EPOLL_ENABLE = System.getProperty("netty.epoll.enable", "true"); - /** - * OS Name - */ - public static final String OS_NAME = System.getProperty("os.name"); - /** * warm up time */ diff --git a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/utils/NettyUtils.java b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/utils/NettyUtils.java index 89eb1f96079b0cb3226a614696c507f67e8fc423..06420eee109d3e7c5685e2aaa5d3566c0fcff63a 100644 --- a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/utils/NettyUtils.java +++ b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/utils/NettyUtils.java @@ -17,6 +17,8 @@ package org.apache.dolphinscheduler.remote.utils; +import org.apache.dolphinscheduler.common.utils.OSUtils; + import io.netty.channel.epoll.Epoll; import io.netty.channel.epoll.EpollServerSocketChannel; import io.netty.channel.epoll.EpollSocketChannel; @@ -34,7 +36,7 @@ public class NettyUtils { } public static boolean useEpoll() { - String osName = Constants.OS_NAME; + String osName = OSUtils.getOSName(); if (!osName.toLowerCase().contains("linux")) { return false; } diff --git a/dolphinscheduler-remote/src/test/java/org/apache/dolphinscheduler/remote/utils/NettyUtilTest.java b/dolphinscheduler-remote/src/test/java/org/apache/dolphinscheduler/remote/utils/NettyUtilTest.java index a3e13850ac636d517f39326dc650d8e0c2bd047d..879449eb8638e5b57d43b26751014f5e66563188 100644 --- a/dolphinscheduler-remote/src/test/java/org/apache/dolphinscheduler/remote/utils/NettyUtilTest.java +++ b/dolphinscheduler-remote/src/test/java/org/apache/dolphinscheduler/remote/utils/NettyUtilTest.java @@ -17,7 +17,7 @@ package org.apache.dolphinscheduler.remote.utils; -import static org.apache.dolphinscheduler.remote.utils.Constants.OS_NAME; +import org.apache.dolphinscheduler.common.utils.OSUtils; import org.junit.Assert; import org.junit.Test; @@ -31,7 +31,7 @@ public class NettyUtilTest { @Test public void testUserEpoll() { - if (OS_NAME.toLowerCase().contains("linux") && Epoll.isAvailable()) { + if (OSUtils.getOSName().toLowerCase().contains("linux") && Epoll.isAvailable()) { Assert.assertTrue(NettyUtils.useEpoll()); } else { Assert.assertFalse(NettyUtils.useEpoll()); diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java index 0720a9b77aaaf2962b7cbf4d6e147c940a069d1b..14dcfeeff9dc92e3a7d7e4b4907667655280119c 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java @@ -673,7 +673,7 @@ public class MasterExecThread implements Runnable { private ExecutionStatus runningState(ExecutionStatus state) { if (state == ExecutionStatus.READY_STOP || state == ExecutionStatus.READY_PAUSE - || state == ExecutionStatus.WAITTING_THREAD + || state == ExecutionStatus.WAITING_THREAD || state == ExecutionStatus.DELAY_EXECUTION) { // if the running task is not completed, the state remains unchanged return state; @@ -721,7 +721,7 @@ public class MasterExecThread implements Runnable { * @return Boolean whether has waiting thread task */ private boolean hasWaitingThreadTask() { - List waitingList = getCompleteTaskByState(ExecutionStatus.WAITTING_THREAD); + List waitingList = getCompleteTaskByState(ExecutionStatus.WAITING_THREAD); return CollectionUtils.isNotEmpty(waitingList); } @@ -768,7 +768,7 @@ public class MasterExecThread implements Runnable { // waiting thread if (hasWaitingThreadTask()) { - return ExecutionStatus.WAITTING_THREAD; + return ExecutionStatus.WAITING_THREAD; } // pause diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/DependentExecute.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/DependentExecute.java index a7eba1f53469143b040a538267702f62d784c520..c17b8fb6528564d0b7a23911ee9fcda4ef185496 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/DependentExecute.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/DependentExecute.java @@ -231,7 +231,7 @@ public class DependentExecute { if (state.typeIsRunning() || state == ExecutionStatus.SUBMITTED_SUCCESS - || state == ExecutionStatus.WAITTING_THREAD) { + || state == ExecutionStatus.WAITING_THREAD) { return DependResult.WAITING; } else { return DependResult.FAILED; diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java index 4d2ace663e9b6903857b4b2be518e9841b21f7bb..42ab37e7c4731cc75bd4453dd77ad4d4d19c0980 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java @@ -123,7 +123,7 @@ public class ProcessUtils { boolean allowAmbiguousCommands = false; if (security == null) { allowAmbiguousCommands = true; - String value = System.getProperty(LOCAL_PROCESS_EXEC); + String value = PropertyUtils.getString(LOCAL_PROCESS_EXEC); if (value != null) { allowAmbiguousCommands = !Constants.STRING_FALSE.equalsIgnoreCase(value); } diff --git a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/PythonCommandExecutorTest.java b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/PythonCommandExecutorTest.java index f4e9080a689f9df61f6db4c9db9ffc935dc19c99..5d95860e271c5daa5264937887b8dd03f94a3b88 100644 --- a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/PythonCommandExecutorTest.java +++ b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/PythonCommandExecutorTest.java @@ -17,6 +17,8 @@ package org.apache.dolphinscheduler.server.worker.task; +import org.apache.dolphinscheduler.common.utils.OSUtils; + import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; @@ -28,7 +30,7 @@ public class PythonCommandExecutorTest { @Test public void testGetPythonHome() { - String path = System.getProperty("user.dir") + "/script/env/dolphinscheduler_env.sh"; + String path = OSUtils.getUserDir() + "/script/env/dolphinscheduler_env.sh"; if (path.contains("dolphinscheduler-server/")) { path = path.replace("dolphinscheduler-server/", ""); } diff --git a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java index 8ee49bddc81dadbe2dbb503139f10c54370eca7f..93298f8eedbb3f755e9296946a2163407f73b874 100644 --- a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java +++ b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java @@ -258,8 +258,8 @@ public class ProcessService { * @return process instance */ private ProcessInstance setWaitingThreadProcess(Command command, ProcessInstance processInstance) { - processInstance.setState(ExecutionStatus.WAITTING_THREAD); - if (command.getCommandType() != CommandType.RECOVER_WAITTING_THREAD) { + processInstance.setState(ExecutionStatus.WAITING_THREAD); + if (command.getCommandType() != CommandType.RECOVER_WAITING_THREAD) { processInstance.addHistoryCmd(command.getCommandType()); } saveProcessInstance(processInstance); @@ -522,7 +522,7 @@ public class ProcessService { // process instance quit by "waiting thread" state if (originCommand == null) { Command command = new Command( - CommandType.RECOVER_WAITTING_THREAD, + CommandType.RECOVER_WAITING_THREAD, processInstance.getTaskDependType(), processInstance.getFailureStrategy(), processInstance.getExecutorId(), @@ -539,14 +539,14 @@ public class ProcessService { } // update the command time if current command if recover from waiting - if (originCommand.getCommandType() == CommandType.RECOVER_WAITTING_THREAD) { + if (originCommand.getCommandType() == CommandType.RECOVER_WAITING_THREAD) { originCommand.setUpdateTime(new Date()); saveCommand(originCommand); } else { // delete old command and create new waiting thread command commandMapper.deleteById(originCommand.getId()); originCommand.setId(0); - originCommand.setCommandType(CommandType.RECOVER_WAITTING_THREAD); + originCommand.setCommandType(CommandType.RECOVER_WAITING_THREAD); originCommand.setUpdateTime(new Date()); originCommand.setCommandParam(JSONUtils.toJsonString(cmdParam)); originCommand.setProcessInstancePriority(processInstance.getProcessInstancePriority()); @@ -809,7 +809,7 @@ public class ProcessService { break; case START_CURRENT_TASK_PROCESS: break; - case RECOVER_WAITTING_THREAD: + case RECOVER_WAITING_THREAD: break; case RECOVER_SUSPENDED_PROCESS: // find pause tasks and init task's state diff --git a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/ZKServer.java b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/ZKServer.java index 7ac23a3c4df1cc40802f3c61a0a8a3cf82df1c59..b73e774be3fae448c9203858a273390e14fe9f03 100644 --- a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/ZKServer.java +++ b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/ZKServer.java @@ -17,6 +17,7 @@ package org.apache.dolphinscheduler.service.zk; +import org.apache.dolphinscheduler.common.utils.OSUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.service.exceptions.ServiceException; @@ -117,7 +118,7 @@ public class ZKServer { * @param port The port to listen on */ public void startLocalZkServer(final int port) { - String zkDataDir = System.getProperty("user.dir") + (StringUtils.isEmpty(prefix) ? StringUtils.EMPTY : ("/" + prefix)) + "/zookeeper_data"; + String zkDataDir = OSUtils.getUserDir() + (StringUtils.isEmpty(prefix) ? StringUtils.EMPTY : ("/" + prefix)) + "/zookeeper_data"; File file = new File(zkDataDir); if (file.exists()) { logger.warn("The path of zk server exists"); diff --git a/dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java b/dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java index 79be9ec1aee160c21d88e0e6431f9d07ef160241..4f4144ecb5e208344929a684557dc9aa0956bad0 100644 --- a/dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java +++ b/dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java @@ -206,7 +206,7 @@ public class ProcessServiceTest { processService.createRecoveryWaitingThreadCommand(null, subProcessInstance); Command recoverCommand = new Command(); - recoverCommand.setCommandType(CommandType.RECOVER_WAITTING_THREAD); + recoverCommand.setCommandType(CommandType.RECOVER_WAITING_THREAD); processService.createRecoveryWaitingThreadCommand(recoverCommand, subProcessInstance); Command repeatRunningCommand = new Command(); diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/config.js b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/config.js index 1e95df71cebd66c673a0f8c7a11977197fcdf211..fb6c12308ac481393f0575800b1d18bb76f72b41 100755 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/config.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/config.js @@ -132,7 +132,7 @@ const runningType = [ }, { desc: `${i18n.$t('Recovery waiting thread')}`, - code: 'RECOVER_WAITTING_THREAD' + code: 'RECOVER_WAITING_THREAD' } ] @@ -216,14 +216,14 @@ const tasksState = { icoUnicode: 'el-icon-remove-outline', isSpin: false }, - WAITTING_THREAD: { + WAITING_THREAD: { id: 10, desc: `${i18n.$t('Waiting for thread')}`, color: '#912eed', icoUnicode: 'ri-time-line', isSpin: false }, - WAITTING_DEPEND: { + WAITING_DEPEND: { id: 11, desc: `${i18n.$t('Waiting for dependence')}`, color: '#5101be', diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/instanceDetails.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/instanceDetails.vue index f9561bd52c7917befd315eedda05c032b3dec5ba..7faa41e789dc68983f8cfe40af14ad82903c3c77 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/instanceDetails.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/instanceDetails.vue @@ -72,7 +72,7 @@ ]).then((data) => { let item = data[0] let flag = false - if (item.state !== 'WAITTING_THREAD' && item.state !== 'SUCCESS' && item.state !== 'PAUSE' && item.state !== 'FAILURE' && item.state !== 'STOP') { + if (item.state !== 'WAITING_THREAD' && item.state !== 'SUCCESS' && item.state !== 'PAUSE' && item.state !== 'FAILURE' && item.state !== 'STOP') { flag = true } else { flag = false @@ -93,7 +93,7 @@ this.getInstancedetail(this.$route.params.id).then(res => { let item = res let flag = false - if (item.state !== 'WAITTING_THREAD' && item.state !== 'SUCCESS' && item.state !== 'PAUSE' && item.state !== 'FAILURE' && item.state !== 'STOP') { + if (item.state !== 'WAITING_THREAD' && item.state !== 'SUCCESS' && item.state !== 'PAUSE' && item.state !== 'FAILURE' && item.state !== 'STOP') { flag = true } else { flag = false diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/_source/conditions/instance/common.js b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/_source/conditions/instance/common.js index 4d5afd609801f2044f601492214ab60e23ebd134..2ccca250aa8b515debf068e11870ffe5b08ee0e5 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/_source/conditions/instance/common.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/_source/conditions/instance/common.js @@ -55,10 +55,10 @@ const stateType = [ code: 'KILL', label: `${i18n.$t('Kill')}` }, { - code: 'WAITTING_THREAD', + code: 'WAITING_THREAD', label: `${i18n.$t('Waiting for thread')}` }, { - code: 'WAITTING_DEPEND', + code: 'WAITING_DEPEND', label: `${i18n.$t('Waiting for dependency to complete')}` }, { code: 'DELAY_EXECUTION',