|
|
@ -18,6 +18,7 @@ package cn.escheduler.server.worker.task; |
|
|
|
|
|
|
|
|
|
|
|
import cn.escheduler.common.Constants; |
|
|
|
import cn.escheduler.common.Constants; |
|
|
|
import cn.escheduler.common.utils.FileUtils; |
|
|
|
import cn.escheduler.common.utils.FileUtils; |
|
|
|
|
|
|
|
import cn.escheduler.common.utils.PropertyUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
@ -71,11 +72,11 @@ public class PythonCommandExecutor extends AbstractCommandExecutor { |
|
|
|
if (!Files.exists(Paths.get(commandFile))) { |
|
|
|
if (!Files.exists(Paths.get(commandFile))) { |
|
|
|
logger.info("generate command file:{}", commandFile); |
|
|
|
logger.info("generate command file:{}", commandFile); |
|
|
|
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder(200); |
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
sb.append("#-*- encoding=utf8 -*-\n"); |
|
|
|
sb.append("#-*- encoding=utf8 -*-\n"); |
|
|
|
|
|
|
|
|
|
|
|
sb.append("\n\n"); |
|
|
|
sb.append("\n\n"); |
|
|
|
sb.append(String.format("import py_%s_node\n",taskAppId)); |
|
|
|
sb.append(execCommand); |
|
|
|
logger.info(sb.toString()); |
|
|
|
logger.info(sb.toString()); |
|
|
|
|
|
|
|
|
|
|
|
// write data to file
|
|
|
|
// write data to file
|
|
|
@ -86,8 +87,8 @@ public class PythonCommandExecutor extends AbstractCommandExecutor { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected String commandType() { |
|
|
|
protected String commandType() { |
|
|
|
|
|
|
|
|
|
|
|
String envPath = System.getProperty("user.dir") + Constants.SINGLE_SLASH + "conf"+ |
|
|
|
String envPath = PropertyUtils.getString(Constants.ESCHEDULER_ENV_PATH); |
|
|
|
Constants.SINGLE_SLASH +"env" + Constants.SINGLE_SLASH + Constants.ESCHEDULER_ENV_SH; |
|
|
|
|
|
|
|
String pythonHome = getPythonHome(envPath); |
|
|
|
String pythonHome = getPythonHome(envPath); |
|
|
|
if (StringUtils.isEmpty(pythonHome)){ |
|
|
|
if (StringUtils.isEmpty(pythonHome)){ |
|
|
|
return PYTHON; |
|
|
|
return PYTHON; |
|
|
|