Browse Source

[Feature] AbstractCommandExecutor.commandType difficult to understand (#1833)

issue: https://github.com/apache/incubator-dolphinscheduler/issues/1831
pull/2/head
gabry.wu 5 years ago committed by qiaozhanwei
parent
commit
c531c88e7e
  1. 4
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
  2. 2
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/PythonCommandExecutor.java
  3. 2
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/ShellCommandExecutor.java

4
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java

@ -207,7 +207,7 @@ public abstract class AbstractCommandExecutor {
// merge error information to standard output stream // merge error information to standard output stream
processBuilder.redirectErrorStream(true); processBuilder.redirectErrorStream(true);
// setting up user to run commands // setting up user to run commands
processBuilder.command("sudo", "-u", tenantCode, commandType(), commandFile); processBuilder.command("sudo", "-u", tenantCode, commandInterpreter(), commandFile);
process = processBuilder.start(); process = processBuilder.start();
@ -561,7 +561,7 @@ public abstract class AbstractCommandExecutor {
protected abstract String buildCommandFilePath(); protected abstract String buildCommandFilePath();
protected abstract String commandType(); protected abstract String commandInterpreter();
protected abstract boolean checkFindApp(String line); protected abstract boolean checkFindApp(String line);
protected abstract void createCommandFileIfNotExists(String execCommand, String commandFile) throws IOException; protected abstract void createCommandFileIfNotExists(String execCommand, String commandFile) throws IOException;
} }

2
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/PythonCommandExecutor.java

@ -113,7 +113,7 @@ public class PythonCommandExecutor extends AbstractCommandExecutor {
* @return python home * @return python home
*/ */
@Override @Override
protected String commandType() { protected String commandInterpreter() {
String pythonHome = getPythonHome(envFile); String pythonHome = getPythonHome(envFile);
if (StringUtils.isEmpty(pythonHome)){ if (StringUtils.isEmpty(pythonHome)){
return PYTHON; return PYTHON;

2
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/ShellCommandExecutor.java

@ -74,7 +74,7 @@ public class ShellCommandExecutor extends AbstractCommandExecutor {
* @return command type * @return command type
*/ */
@Override @Override
protected String commandType() { protected String commandInterpreter() {
return SH; return SH;
} }

Loading…
Cancel
Save