提交 34b59a53 authored 作者: 吕本才's avatar 吕本才

feat(core): upgrade python version and adjust logging

上级 5ccb8ad6
差异被折叠。
......@@ -16,7 +16,8 @@
<ruoshui.version>3.8.2</ruoshui.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<!--<java.version>1.8</java.version>-->
<java.version>11</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<druid.version>1.2.8</druid.version>
<bitwalker.version>1.21</bitwalker.version>
......@@ -70,8 +71,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.test.skip>false</maven.test.skip>
<downloadSources>true</downloadSources>
<java_source_version>1.8</java_source_version>
<java_target_version>1.8</java_target_version>
<!-- <java_source_version>1.8</java_source_version>-->
<!-- <java_target_version>1.8</java_target_version>-->
<file_encoding>UTF-8</file_encoding>
<flink_streaming_version>1.4.0.RELEASE</flink_streaming_version>
<flink.version>1.16.2</flink.version>
......
......@@ -10,9 +10,9 @@
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>ruoshui-admin</artifactId>
<properties>
<java.version>1.8</java.version>
</properties>
<!-- <properties>-->
<!-- <java.version>1.8</java.version>-->
<!-- </properties>-->
<description>
web服务入口
</description>
......
......@@ -10,7 +10,8 @@ public enum GlueTypeEnum {
BEAN("BEAN", false, null, null),
GLUE_GROOVY("GLUE(Java)", false, null, null),
GLUE_SHELL("GLUE(Shell)", true, "bash", ".sh"),
GLUE_PYTHON("GLUE(Python)", true, "python", ".py"),
// GLUE_PYTHON("GLUE(Python)", true, "python", ".py"),
GLUE_PYTHON("GLUE(Python)", true, "python3", ".py"),
GLUE_PHP("GLUE(PHP)", true, "php", ".php"),
GLUE_NODEJS("GLUE(Nodejs)", true, "node", ".js"),
GLUE_POWERSHELL("GLUE(PowerShell)", true, "powershell", ".ps1");
......
......@@ -5,6 +5,7 @@ import com.ruoshui.core.enums.biz.model.HandleProcessCallbackParam;
import com.ruoshui.core.enums.log.JobLogger;
import com.ruoshui.core.enums.thread.ProcessCallbackThread;
import com.ruoshui.core.util.ProcessUtil;
import lombok.extern.slf4j.Slf4j;
import java.io.FileOutputStream;
import java.io.IOException;
......@@ -21,6 +22,7 @@ import java.util.List;
* <p>
* Created by xuxueli on 17/2/25.
*/
@Slf4j
public class ScriptUtil {
/**
......@@ -71,13 +73,13 @@ public class ScriptUtil {
if (params != null && params.length > 0) {
for (String param : params) {
cmdarray.add(param);
log.info("1param:" + param);
}
}
String[] cmdarrayFinal = cmdarray.toArray(new String[cmdarray.size()]);
// process-exec
final Process process = Runtime.getRuntime().exec(cmdarrayFinal);
String prcsId = ProcessUtil.getProcessId(process);
JobLogger.log("------------------Process id: " + prcsId);
//update task process id
......
......@@ -12,7 +12,8 @@ public enum GlueTypeEnum {
BEAN("BEAN", false, null, null),
GLUE_GROOVY("GLUE(Java)", false, null, null),
GLUE_SHELL("GLUE(Shell)", true, "bash", ".sh"),
GLUE_PYTHON("GLUE(Python)", true, "python", ".py"),
// GLUE_PYTHON("GLUE(Python)", true, "python", ".py"),
GLUE_PYTHON("GLUE(Python)", true, "python3", ".py"),
GLUE_PHP("GLUE(PHP)", true, "php", ".php"),
GLUE_NODEJS("GLUE(Nodejs)", true, "node", ".js"),
GLUE_POWERSHELL("GLUE(PowerShell)", true, "powershell", ".ps1");
......
......@@ -45,7 +45,9 @@ public class ProcessUtil {
// field.setAccessible(true);
// pid = (Integer) field.get(process);
// 服务器上的jdk版本大于8 ,不兼容当前的模式
if (process.getClass().getName().equals("java.lang.UNIXProcess")) {
String processName = process.getClass().getName();
logger.info("processName: {}", processName);
if (processName.equals("java.lang.UNIXProcess")) {
try {
// 仅Java 8兼容:保留原逻辑(可选)
Field pidField = process.getClass().getDeclaredField("pid");
......
......@@ -4,6 +4,7 @@ package com.ruoshui.core.util;
import com.ruoshui.core.biz.model.HandleProcessCallbackParam;
import com.ruoshui.core.log.JobLogger;
import com.ruoshui.core.thread.ProcessCallbackThread;
import lombok.extern.slf4j.Slf4j;
import java.io.FileOutputStream;
import java.io.IOException;
......@@ -20,6 +21,7 @@ import java.util.List;
* <p>
* Created by xuxueli on 17/2/25.
*/
@Slf4j
public class ScriptUtil {
/**
......@@ -70,10 +72,12 @@ public class ScriptUtil {
if (params != null && params.length > 0) {
for (String param : params) {
cmdarray.add(param);
log.info("2param:" + param);
}
}
String[] cmdarrayFinal = cmdarray.toArray(new String[cmdarray.size()]);
// process-exec
final Process process = Runtime.getRuntime().exec(cmdarrayFinal);
......
......@@ -50,6 +50,8 @@ public class ExecutorJobHandler extends IJobHandler {
try {
String[] cmdarrayFinal = BuildCommand.buildDataXExecutorCmd(trigger, tmpFilePath,dataXPyPath);
JobLogger.log("------------------DataX command: " + StringUtils.join(cmdarrayFinal, " "));
final Process process = Runtime.getRuntime().exec(cmdarrayFinal);
String prcsId = ProcessUtil.getProcessId(process);
JobLogger.log("------------------DataX process id: " + prcsId);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论