Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
etl-ruoshui-bigdata-server
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
etl-ruoshui
etl-ruoshui-bigdata-server
Commits
d5f654d0
提交
d5f654d0
authored
11月 24, 2025
作者:
吕本才
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加python3脚本
上级
d217e568
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
28 行增加
和
4 行删除
+28
-4
BuildCommand.java
.../src/main/java/executor/service/command/BuildCommand.java
+15
-4
SystemUtils.java
...tax-executor/src/main/java/executor/util/SystemUtils.java
+13
-0
没有找到文件。
ruoshui-datax-executor/src/main/java/executor/service/command/BuildCommand.java
浏览文件 @
d5f654d0
...
...
@@ -40,7 +40,12 @@ public class BuildCommand {
List
<
String
>
cmdArr
=
new
ArrayList
<>();
if
(
System
.
getProperty
(
"os.name"
).
toLowerCase
().
contains
(
"linux"
)
||
System
.
getProperty
(
"os.name"
).
toLowerCase
().
contains
(
"mac"
)){
cmdArr
.
add
(
"python"
);
// 检测是否有python3 优先使用python3
if
(
SystemUtils
.
isCommandAvailable
(
"python3"
))
{
cmdArr
.
add
(
"python3"
);
}
else
{
cmdArr
.
add
(
"python"
);
}
}
else
{
cmdArr
.
add
(
"C:\\Python27\\python.exe"
);
}
...
...
@@ -71,7 +76,9 @@ public class BuildCommand {
if
(
incrementType
!=
null
&&
replaceParam
!=
null
)
{
if
(
IncrementTypeEnum
.
TIME
.
getCode
()
==
incrementType
)
{
if
(
doc
.
length
()
>
0
)
doc
.
append
(
DataXConstant
.
SPLIT_SPACE
);
if
(
doc
.
length
()
>
0
)
{
doc
.
append
(
DataXConstant
.
SPLIT_SPACE
);
}
String
replaceParamType
=
tgParam
.
getReplaceParamType
();
if
(
StringUtils
.
isBlank
(
replaceParamType
)
||
replaceParamType
.
equals
(
"Timestamp"
))
{
...
...
@@ -90,7 +97,9 @@ public class BuildCommand {
}
else
if
(
IncrementTypeEnum
.
ID
.
getCode
()
==
incrementType
)
{
long
startId
=
tgParam
.
getStartId
();
long
endId
=
tgParam
.
getEndId
();
if
(
doc
.
length
()
>
0
)
doc
.
append
(
DataXConstant
.
SPLIT_SPACE
);
if
(
doc
.
length
()
>
0
){
doc
.
append
(
DataXConstant
.
SPLIT_SPACE
);
}
doc
.
append
(
DataXConstant
.
PARAMS_CM
).
append
(
DataXConstant
.
TRANSFORM_QUOTES
).
append
(
String
.
format
(
replaceParam
,
startId
,
endId
));
doc
.
append
(
DataXConstant
.
TRANSFORM_QUOTES
);
}
...
...
@@ -99,7 +108,9 @@ public class BuildCommand {
if
(
incrementType
!=
null
&&
IncrementTypeEnum
.
PARTITION
.
getCode
()
==
incrementType
)
{
if
(
StringUtils
.
isNotBlank
(
partitionStr
))
{
List
<
String
>
partitionInfo
=
Arrays
.
asList
(
partitionStr
.
split
(
SPLIT_COMMA
));
if
(
doc
.
length
()
>
0
)
doc
.
append
(
DataXConstant
.
SPLIT_SPACE
);
if
(
doc
.
length
()
>
0
)
{
doc
.
append
(
DataXConstant
.
SPLIT_SPACE
);
}
doc
.
append
(
DataXConstant
.
PARAMS_CM
).
append
(
DataXConstant
.
TRANSFORM_QUOTES
).
append
(
String
.
format
(
DataXConstant
.
PARAMS_CM_V_PT
,
buildPartition
(
partitionInfo
))).
append
(
DataXConstant
.
TRANSFORM_QUOTES
);
}
}
...
...
ruoshui-datax-executor/src/main/java/executor/util/SystemUtils.java
浏览文件 @
d5f654d0
...
...
@@ -6,6 +6,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
java.io.File
;
import
java.io.IOException
;
/**
* @author maokeluo
...
...
@@ -38,4 +39,16 @@ public class SystemUtils {
LOGGER
.
info
(
"DATAX_HOME:{}"
,
DATAX_HOME
);
return
DATAX_HOME
;
}
public
static
boolean
isCommandAvailable
(
String
python3
)
{
try
{
return
new
ProcessBuilder
(
python3
,
"-c"
,
"\"\"\"\""
)
.
redirectErrorStream
(
true
).
start
().
waitFor
()
==
0
;
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论