Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
byit-myth-job
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyuan
byit-myth-job
Commits
719c5022
Commit
719c5022
authored
Mar 31, 2020
by
guo_minglei@163.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加api接口工具
parent
55d0b450
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
0 deletions
+82
-0
JobUtils.java
...xecutor-plugin/src/main/java/com/byit/utils/JobUtils.java
+82
-0
No files found.
byit-myth-executor/myth-executor-plugin/src/main/java/com/byit/utils/JobUtils.java
View file @
719c5022
...
...
@@ -82,6 +82,21 @@ public class JobUtils {
*/
private
static
final
String
REQUEST_FLOW_MAKESUCCESS
=
"/api/flow/madeSuccess"
;
/**
* 获取运行实例
*/
public
static
final
String
REQUEST_LOADSCHEDULE
=
"/api/flow/loadScheduleResult"
;
/**
* 获取运行实例日志
*/
public
static
final
String
REQUEST_LOADSCHEDULELOG
=
"/api/flow/loadScheduleLog"
;
/**
* 补批工作流
*/
public
static
final
String
REQUEST_REPAIRFLOW
=
"/api/flow/repairFlow"
;
private
static
final
String
REQUEST_REAL_EXECT
=
"/api/node/runNode"
;
private
static
final
String
REQUEST_RUN_HISTORY
=
"/api/node/runHistory"
;
...
...
@@ -290,6 +305,61 @@ public class JobUtils {
}
/**
* 获取运行实例接口
* @param startTime 开始时间 yyyyMMdd 格式
* @param endTime 结束时间 yyyyMMdd 格式
* @param workspaceName 工作空间名称
* @param flowName 工作流名称
* @return
*/
public
static
ResponseResult
loadScheduleResult
(
String
startTime
,
String
endTime
,
String
workspaceName
,
String
flowName
){
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"startTime"
,
startTime
);
param
.
put
(
"endTime"
,
endTime
);
param
.
put
(
"workspaceName"
,
workspaceName
);
param
.
put
(
"flowName"
,
flowName
);
String
response
=
createHttpRequest
(
REQUEST_LOADSCHEDULE
,
"param="
+
JSON
.
toJSONString
(
param
));
log
.
info
(
"--------------------获取运行实例接口调用成功,结果为:{}------------------------"
,
response
);
return
JSON
.
parseObject
(
response
,
ResponseResult
.
class
);
}
/**
* 获取工作流运行实例的节点日志
* @param runId
* @param flowName
* @return
*/
public
static
ResponseResult
loadScheduleLog
(
String
runId
,
String
flowName
){
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"runId"
,
runId
);
param
.
put
(
"flowName"
,
flowName
);
String
response
=
createHttpRequest
(
REQUEST_LOADSCHEDULELOG
,
"param="
+
JSON
.
toJSONString
(
param
));
log
.
info
(
"--------------------获取工作流运行实例的节点日志接口调用成功,结果为:{}------------------------"
,
response
);
return
JSON
.
parseObject
(
response
,
ResponseResult
.
class
);
}
/**
* 补批工作流
* @param workspaceName 工作空间名称
* @param flowName 工作流名称
* @param nodeNames 节点名称 多个节点以","隔开
* @param repairTimes 补批日期 多个日期以","隔开
* @return
*/
public
static
ResponseResult
repairFlow
(
String
workspaceName
,
String
flowName
,
String
nodeNames
,
String
repairTimes
){
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"workspaceName"
,
workspaceName
);
param
.
put
(
"flowName"
,
flowName
);
param
.
put
(
"nodeNames"
,
nodeNames
);
param
.
put
(
"repairTimes"
,
repairTimes
);
String
response
=
createHttpRequest
(
REQUEST_REPAIRFLOW
,
"param="
+
JSON
.
toJSONString
(
param
));
log
.
info
(
"--------------------补批工作流接口调用成功,结果为:{}------------------------"
,
response
);
return
JSON
.
parseObject
(
response
,
ResponseResult
.
class
);
}
/**
* 创建工作空间
* @param workspaceName
* @return
...
...
@@ -359,4 +429,16 @@ public class JobUtils {
return
path
;
}
public
static
void
main
(
String
[]
args
)
{
RunNode
runNode
=
new
RunNode
();
runNode
.
setScriptUrl
(
"ddmp/M00/00/00/CgB4Al5wa36AaUJ7AAAAiYy1k-k9801.py"
);
runNode
.
setJobType
(
"PYTHON"
);
runNode
.
setNodeId
(
"2"
);
runNode
.
setNodeName
(
"lijkki"
);
runNode
.
setRunCmd
(
"python ${biz_file}"
);
JobUtils
.
setRequestUrl
(
"http://127.0.0.1:8998/myth-job-admin"
);
JobUtils
.
setTOKEN
(
"test"
);
JobUtils
.
realExectNode
(
runNode
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment