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
fe76fb6b
Commit
fe76fb6b
authored
Apr 01, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
4fa01369
ff7c5543
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
200 additions
and
7 deletions
+200
-7
ApiFlowServiceImpl.java
...c/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
+11
-1
application-local.yml
byit-myth-admin/src/main/resources/application-local.yml
+1
-1
ExecuteStatusEnum.java
...-core/src/main/java/com/byit/enums/ExecuteStatusEnum.java
+32
-0
ScheduleStatusEnum.java
...core/src/main/java/com/byit/enums/ScheduleStatusEnum.java
+30
-0
RunRecordingMapper.java
...ore/src/main/java/com/byit/mapper/RunRecordingMapper.java
+5
-1
JobTaskRunLogMapper.xml
...in-core/src/main/resources/mapper/JobTaskRunLogMapper.xml
+3
-2
RunRecordingMapper.xml
...min-core/src/main/resources/mapper/RunRecordingMapper.xml
+16
-1
ResponseResult.java
...o-core/src/main/java/com/byit/dto/web/ResponseResult.java
+14
-0
JobUtils.java
...xecutor-plugin/src/main/java/com/byit/utils/JobUtils.java
+86
-0
IndexController.java
...java/com/byit/demo/client/controller/IndexController.java
+2
-1
No files found.
byit-myth-admin/src/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
View file @
fe76fb6b
...
...
@@ -661,7 +661,17 @@ public class ApiFlowServiceImpl implements ApiFlowService {
}
}
List
<
RunRecording
>
runRecordList
=
runRecordingMapper
.
findByStartAndEndTime
(
startDate
.
getTime
(),
endDate
.
getTime
(),
flowIds
);
String
scheduleStatus
=
jsonObject
.
getString
(
"scheduleStatus"
);
List
<
String
>
scheduleStatusList
=
new
ArrayList
<>();
if
(
StringUtils
.
isNotEmpty
(
scheduleStatus
)){
scheduleStatusList
=
Arrays
.
asList
(
scheduleStatus
.
split
(
","
));
}
String
executeStatus
=
jsonObject
.
getString
(
"executeStatus"
);
List
<
String
>
executeStatusList
=
new
ArrayList
<>();
if
(
StringUtils
.
isNotEmpty
(
executeStatus
)){
executeStatusList
=
Arrays
.
asList
(
executeStatus
.
split
(
","
));
}
List
<
RunRecording
>
runRecordList
=
runRecordingMapper
.
findByStartAndEndTime
(
startDate
.
getTime
(),
endDate
.
getTime
(),
flowIds
,
scheduleStatusList
,
executeStatusList
);
return
runRecordList
;
}
...
...
byit-myth-admin/src/main/resources/application-local.yml
View file @
fe76fb6b
...
...
@@ -16,7 +16,7 @@ spring:
redis
:
database
:
0
host
:
10.0.120.2
1
8
host
:
10.0.120.2
0
8
port
:
6379
password
:
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/enums/ExecuteStatusEnum.java
0 → 100644
View file @
fe76fb6b
package
com
.
byit
.
enums
;
/**
* @Description
* @Author guo_m
* @Date 2020-03-31
*/
public
enum
ExecuteStatusEnum
{
UN_START
(
1
,
"未运行"
),
STARTING
(
2
,
"运行中"
),
FINISH
(
3
,
"暂停"
),
STOP
(
4
,
"完成"
),
;
private
Integer
code
;
private
String
msg
;
private
ExecuteStatusEnum
(
Integer
code
,
String
msg
){
this
.
code
=
code
;
this
.
msg
=
msg
;
}
public
Integer
getCode
(){
return
this
.
code
;
}
public
String
getMsg
(){
return
this
.
msg
;
}
}
byit-myth-core/myth-admin-core/src/main/java/com/byit/enums/ScheduleStatusEnum.java
0 → 100644
View file @
fe76fb6b
package
com
.
byit
.
enums
;
/**
* @Description 调度状态
* @Author guo_m
* @Date 2020-03-31
*/
public
enum
ScheduleStatusEnum
{
SUCCESS
(
1
,
"成功"
),
FAIL
(
2
,
"失败"
),
REPAIR_SUCCESS
(
3
,
"补批成功"
),
REPAIR_FAIL
(
4
,
"补批失败"
),
KILL
(
5
,
"杀死"
)
;
private
Integer
code
;
private
String
msg
;
private
ScheduleStatusEnum
(
Integer
code
,
String
msg
){
this
.
code
=
code
;
this
.
msg
=
msg
;
}
public
Integer
getCode
(){
return
this
.
code
;
}
public
String
getMsg
(){
return
this
.
msg
;
}
}
byit-myth-core/myth-admin-core/src/main/java/com/byit/mapper/RunRecordingMapper.java
View file @
fe76fb6b
...
...
@@ -137,7 +137,11 @@ public interface RunRecordingMapper {
*/
List
<
RunRecording
>
findUnFinishByRunId
(
String
runId
);
List
<
RunRecording
>
findByStartAndEndTime
(
@Param
(
"startDate"
)
long
startDate
,
@Param
(
"endDate"
)
long
endDate
,
@Param
(
"flowIds"
)
List
<
Integer
>
flowIds
);
List
<
RunRecording
>
findByStartAndEndTime
(
@Param
(
"startDate"
)
long
startDate
,
@Param
(
"endDate"
)
long
endDate
,
@Param
(
"flowIds"
)
List
<
Integer
>
flowIds
,
@Param
(
"scheduleStatusList"
)
List
<
String
>
scheduleStatusList
,
@Param
(
"executeStatusList"
)
List
<
String
>
executeStatusList
);
/**
* 获取运行实例
...
...
byit-myth-core/myth-admin-core/src/main/resources/mapper/JobTaskRunLogMapper.xml
View file @
fe76fb6b
...
...
@@ -76,20 +76,21 @@
<select
id=
"findByRunIdAndFlowAndNode"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from job_task_run_log
where
node_id = #{node
Id} and flow_name = #{flowName}
where
run_id = #{run
Id} and flow_name = #{flowName}
and node_name = #{nodeName}
</select>
<select
id=
"findByRunIdAndFlowName"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from job_task_run_log
where
node_id = #{node
Id} and flow_name = #{flowName}
where
run_id = #{run
Id} and flow_name = #{flowName}
</select>
<select
id=
"findByRunId"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from job_task_run_log
where run_id = #{runId}
order by trigger_time desc
</select>
<select
id=
"findJobTaskRunLogWithBLOBsByFlowIdAndRunId"
resultMap=
"ResultMapWithBLOBs"
>
...
...
byit-myth-core/myth-admin-core/src/main/resources/mapper/RunRecordingMapper.xml
View file @
fe76fb6b
...
...
@@ -113,10 +113,25 @@
<if
test=
"flowIds != null"
>
and flow_id in (
<foreach
collection=
"flowIds"
item=
"flowId"
separator=
","
>
flowId
#{flowId}
</foreach>
)
</if>
<if
test=
"scheduleStatusList != null"
>
and flow_status in (
<foreach
collection=
"scheduleStatusList"
item=
"scheduleStatus"
separator=
","
>
${scheduleStatus}
</foreach>
)
</if>
<if
test=
"executeStatusList != null"
>
and flow_run_result in (
<foreach
collection=
"executeStatusList"
item=
"executeStatus"
separator=
","
>
${executeStatus}
</foreach>
)
</if>
order by start_time desc
</select>
...
...
byit-myth-core/myth-dto-core/src/main/java/com/byit/dto/web/ResponseResult.java
View file @
fe76fb6b
...
...
@@ -87,4 +87,17 @@ public class ResponseResult<T> implements Serializable {
tResponseResult
.
setCode
(
code
);
return
tResponseResult
;
}
/**
* 判断是否成功
* @return
*/
public
boolean
isSuccess
(){
//成功
if
(
"0000000"
.
equals
(
this
.
code
)){
return
true
;
}
//失败
return
false
;
}
}
\ No newline at end of file
byit-myth-executor/myth-executor-plugin/src/main/java/com/byit/utils/JobUtils.java
View file @
fe76fb6b
...
...
@@ -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,65 @@ public class JobUtils {
}
/**
* 获取运行实例接口
* @param startTime 开始时间 yyyyMMdd 格式
* @param endTime 结束时间 yyyyMMdd 格式
* @param workspaceName 工作空间名称
* @param flowName 工作流名称
* @param scheduleStatus 调度状态 1 未开始 2运行中 3暂停 4完成 多个以“,”隔开
* @param executeStatus 执行结果 1 成功 2 失败 3 补批成功 4 补批失败 5.kill 多个以“,”隔开
* @return
*/
public
static
ResponseResult
loadScheduleResult
(
String
startTime
,
String
endTime
,
String
workspaceName
,
String
flowName
,
String
scheduleStatus
,
String
executeStatus
){
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"startTime"
,
startTime
);
param
.
put
(
"endTime"
,
endTime
);
param
.
put
(
"workspaceName"
,
workspaceName
);
param
.
put
(
"flowName"
,
flowName
);
param
.
put
(
"scheduleStatus"
,
scheduleStatus
);
param
.
put
(
"executeStatus"
,
executeStatus
);
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 +433,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
);
}
}
demo-client/byit-demo-client/src/main/java/com/byit/demo/client/controller/IndexController.java
View file @
fe76fb6b
...
...
@@ -27,7 +27,8 @@ public class IndexController {
@RequestMapping
(
"/demo"
)
@ResponseBody
public
UserDTO
say
(
String
name
){
return
demoService
.
hello
(
name
);
System
.
out
.
println
(
name
);
return
null
;
}
@RequestMapping
(
"/demo1"
)
@ResponseBody
...
...
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