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
8993bc0b
Commit
8993bc0b
authored
Mar 23, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改日志级别
parent
2b9a24fb
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
129 additions
and
11 deletions
+129
-11
EndAndNotWarningThreadRunHelper.java
...m/byit/thread/helper/EndAndNotWarningThreadRunHelper.java
+4
-4
ScheduleThreadRunHelper.java
.../java/com/byit/thread/helper/ScheduleThreadRunHelper.java
+6
-6
TaskThreadRunHelper.java
...main/java/com/byit/thread/helper/TaskThreadRunHelper.java
+1
-1
AddComplexPy1.java
...demo-client/src/main/java/com/byit/job/AddComplexPy1.java
+118
-0
No files found.
byit-myth-core/myth-admin-core/src/main/java/com/byit/thread/helper/EndAndNotWarningThreadRunHelper.java
View file @
8993bc0b
...
...
@@ -61,14 +61,14 @@ public class EndAndNotWarningThreadRunHelper extends BaseThreadRunHelper {
switch
(
runRecording
.
getAlarmlAction
())
{
//设置为完成时告警
case
WHEN_DONE:
log
.
info
(
"------工作流{},被设置为完成时告警-----"
,
runRecording
);
log
.
debug
(
"------工作流{},被设置为完成时告警-----"
,
runRecording
);
if
(
RunRecordingEnum
.
FLOW_STATUS_IS_END
.
getCode
().
equals
(
runRecording
.
getFlowStatus
()))
{
runRecordingAndEmailService
.
saveEmailAndRunRecording
(
runRecording
);
}
break
;
//失败时告警
case
FAILURE_DONE:
log
.
info
(
"------工作流{},被设置为失败时告警-----"
,
runRecording
);
log
.
debug
(
"------工作流{},被设置为失败时告警-----"
,
runRecording
);
if
(
RunRecordingEnum
.
RUN_FLOW_FAILURE
.
getCode
().
equals
(
runRecording
.
getFlowRunResult
())
||
RunRecordingEnum
.
RUN_FLOW_RE_FAILURE
.
getCode
().
equals
(
runRecording
.
getFlowRunResult
()))
{
runRecordingAndEmailService
.
saveEmailAndRunRecording
(
runRecording
);
...
...
@@ -76,14 +76,14 @@ public class EndAndNotWarningThreadRunHelper extends BaseThreadRunHelper {
break
;
//成功时告警
case
SUCCESS_DONE:
log
.
info
(
"------工作流{},被设置为成功时告警-----"
,
runRecording
);
log
.
debug
(
"------工作流{},被设置为成功时告警-----"
,
runRecording
);
if
(
RunRecordingEnum
.
RUN_FLOW_SUCCESS
.
getCode
().
equals
(
runRecording
.
getFlowRunResult
())
||
RunRecordingEnum
.
RUN_FLOW_RE_SUCCESS
.
getCode
().
equals
(
runRecording
.
getFlowRunResult
()))
{
runRecordingAndEmailService
.
saveEmailAndRunRecording
(
runRecording
);
}
break
;
default
:
log
.
info
(
"------工作流{},告警类别未知-----"
,
runRecording
);
log
.
debug
(
"------工作流{},告警类别未知-----"
,
runRecording
);
break
;
}
});
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/thread/helper/ScheduleThreadRunHelper.java
View file @
8993bc0b
...
...
@@ -46,32 +46,32 @@ public class ScheduleThreadRunHelper extends BaseThreadRunHelper {
//查询所有符合条件的任务节点
List
<
JobTaskSchedule
>
jobTaskSchedules
=
jobTaskScheduleService
.
findJobTaskScheduleByTriggerNextTimeLessThanEqual
(
nowTime
+
SCHEDULE_READ_MS
);
if
(
CollectionUtil
.
isNotEmpty
(
jobTaskSchedules
)){
log
.
info
(
"------排期表查询到有需要存在的节点--------"
);
log
.
debug
(
"------排期表查询到有需要存在的节点--------"
);
//循环遍历添加任务
jobTaskSchedules
.
forEach
(
mythJobTaskSchedule
->{
mythJobTaskSchedule
.
setRunParam
(
PlaceholderUtils
.
formatParam
(
mythJobTaskSchedule
.
getRunParam
()));
//如果是重跑就有logId
Integer
logId
=
mythJobTaskSchedule
.
getLogId
();
if
(
logId
==
null
){
log
.
info
(
"-------------发现节点{}不是重跑,执行日志节点数据初始化-----------"
,
mythJobTaskSchedule
);
log
.
debug
(
"-------------发现节点{}不是重跑,执行日志节点数据初始化-----------"
,
mythJobTaskSchedule
);
logId
=
saveLog
(
mythJobTaskSchedule
);
log
.
info
(
"------------{}节点的日志保存成功,日志ID为{}---------------"
,
mythJobTaskSchedule
,
logId
);
log
.
debug
(
"------------{}节点的日志保存成功,日志ID为{}---------------"
,
mythJobTaskSchedule
,
logId
);
}
mythJobTaskSchedule
.
setLogId
(
logId
);
Long
triggerTime
=
mythJobTaskSchedule
.
getTriggerTime
();
TimerTask
timerTask
=
null
;
if
(
NodeTypeEnum
.
JAVA
.
getType
().
equals
(
mythJobTaskSchedule
.
getJobType
()))
{
log
.
info
(
"------节点{},开始构建java执行器-------"
,
mythJobTaskSchedule
);
log
.
debug
(
"------节点{},开始构建java执行器-------"
,
mythJobTaskSchedule
);
//构建调度执行器
timerTask
=
new
JavaBeanJobTask
(
mythJobTaskSchedule
);
}
else
if
(
NodeTypeEnum
.
SCRIPT
.
getType
().
equals
(
mythJobTaskSchedule
.
getJobType
())){
log
.
info
(
"------节点{},开始构建脚本执行器-------"
,
mythJobTaskSchedule
);
log
.
debug
(
"------节点{},开始构建脚本执行器-------"
,
mythJobTaskSchedule
);
//构建脚本调度执行器
timerTask
=
new
ScriptExecutorJobTask
(
mythJobTaskSchedule
);
}
//TODO 有个坑 如果这个类型不存在的话 这个节点就不会被执行和删除 有没有办法能够强制必须有类型呢?
if
(
timerTask
!=
null
){
log
.
info
(
"------节点{}的执行器{}执行添加到任务调度轮的操作-------"
,
mythJobTaskSchedule
,
timerTask
);
log
.
debug
(
"------节点{}的执行器{}执行添加到任务调度轮的操作-------"
,
mythJobTaskSchedule
,
timerTask
);
WorkRoulette
.
addJob
(
timerTask
,
triggerTime
);
jobTaskScheduleService
.
delete
(
mythJobTaskSchedule
.
getId
());
}
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/thread/helper/TaskThreadRunHelper.java
View file @
8993bc0b
...
...
@@ -158,7 +158,7 @@ public class TaskThreadRunHelper extends BaseThreadRunHelper {
log
.
debug
(
"--------------【{}的上级节点的失败节点已经全部重试完毕】------------------"
,
thisJobTask
);
//该节点如果为弱引用
if
(
NodePropertyEnum
.
WEAK_NODE
.
getCode
().
equals
(
thisJobTask
.
getSuperSuccessRun
()))
{
log
.
info
(
"-------------【查询到有弱引用节点】-----------------"
);
log
.
debug
(
"-------------【查询到有弱引用节点】-----------------"
);
//执行代码
runJobTask
(
thisJobTask
,
jobTaskSchedules
);
}
else
{
...
...
demo-client/byit-demo-client/src/main/java/com/byit/job/AddComplexPy1.java
0 → 100644
View file @
8993bc0b
package
com
.
byit
.
job
;
import
com.alibaba.fastjson.JSON
;
import
com.byit.dto.executor.ScriptParamAndPlaceholderDto
;
import
com.byit.dto.plugin.*
;
import
com.byit.utils.JobUtils
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
/**
* @author huanfgu
*/
public
class
AddComplexPy1
{
public
static
void
main
(
String
[]
args
)
{
PluginPackage
pluginPackage
=
new
PluginPackage
();
pluginPackage
.
setWorkspaceName
(
"test"
);
pluginPackage
.
setFlow
(
createFlow
());
JobUtils
.
setRequestUrl
(
"http://127.0.0.1:8081"
);
JobUtils
.
setTOKEN
(
"test"
);
JobUtils
.
publish
(
pluginPackage
);
}
public
static
PluginFlow
createFlow
(){
PluginFlow
pluginFlow
=
new
PluginFlow
();
//构建工作流信息
PluginFlowConfig
build
=
PluginFlowConfig
.
builder
().
alarmEmail
(
"huangfukexing@byitgroup.com"
)
.
alarmlAction
(
"1"
)
.
execType
(
"1"
)
.
flowCron
(
"0 0/1 * * * ? *"
)
.
flowTimeout
(
TimeUnit
.
MINUTES
.
toMillis
(
30
))
.
priority
(
"2"
)
.
repeatCount
(
1
)
.
scheduleFollow
(
"1"
)
.
build
();
pluginFlow
.
setName
(
"复杂工作流"
);
pluginFlow
.
setDesc
(
"测试多脚本复杂工作流创建"
);
pluginFlow
.
setConfig
(
build
);
pluginFlow
.
setPrincipal
(
"皇甫科星"
);
pluginFlow
.
setRePublish
(
false
);
pluginFlow
.
setAuthor
(
"huangfukexing"
);
pluginFlow
.
setNodeList
(
createNodes
());
return
pluginFlow
;
}
/**
* 创建节点
* @return
*/
public
static
List
<
PluginBaseNode
>
createNodes
(){
//构建开始节点
PluginNode
startNode
=
new
PluginNode
();
PluginNodeConfig
startConf
=
new
PluginNodeConfig
();
nodeSet
(
startNode
,
false
);
startNode
.
setName
(
"start"
);
startNode
.
setDesc
(
"开始节点"
);
startNode
.
setScriptUrls
(
"ddmp/M00/00/01/CgB4Al5wa6WAfhQ9AAAAN9Xm1mU1221.py"
);
confSet
(
startConf
);
startNode
.
setConfig
(
startConf
);
System
.
out
.
println
(
"-----------------start 节点构建成功,开始构建node1节点,依赖start节点--------------------"
);
PluginNode
node1
=
new
PluginNode
();
PluginNodeConfig
node1Conf
=
new
PluginNodeConfig
();
nodeSet
(
node1
,
true
);
node1
.
setName
(
"node1"
);
node1
.
setDesc
(
"node1节点"
);
node1
.
setScriptUrls
(
"ddmp/M00/00/00/CgB4Al5wa36AaUJ7AAAAiYy1k-k9801.py"
);
confSet
(
node1Conf
);
node1
.
setConfig
(
node1Conf
);
node1
.
setDependNodeNameList
(
Collections
.
singletonList
(
"start"
));
System
.
out
.
println
(
"-----------------node1 节点构建成功,开始构建 end,node1--------------------"
);
PluginNode
endNode
=
new
PluginNode
();
PluginNodeConfig
endNodeConf
=
new
PluginNodeConfig
();
nodeSet
(
endNode
,
false
);
endNode
.
setName
(
"end"
);
endNode
.
setDesc
(
"end节点"
);
endNode
.
setScriptUrls
(
"ddmp/M00/00/01/CgB4Al5wa6WADyyrAAAANb42CIc7700.py"
);
confSet
(
endNodeConf
);
endNode
.
setConfig
(
endNodeConf
);
endNode
.
setDependNodeNameList
(
Collections
.
singletonList
(
"node1"
));
return
Arrays
.
asList
(
startNode
,
node1
,
endNode
);
}
/**
* 构建节点
* @param pluginNode
*/
private
static
void
nodeSet
(
PluginNode
pluginNode
,
boolean
flag
){
pluginNode
.
setAuthor
(
"皇甫"
);
pluginNode
.
setJobType
(
"SCRIPT"
);
pluginNode
.
setType
(
"node"
);
pluginNode
.
setRunCommand
(
"python ${biz_file}"
);
if
(
flag
){
ScriptParamAndPlaceholderDto
scriptParamAndPlaceholderDto
=
new
ScriptParamAndPlaceholderDto
();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"name"
,
"皇甫科星"
);
scriptParamAndPlaceholderDto
.
setPlaceholder
(
map
);
pluginNode
.
setRunParam
(
JSON
.
toJSONString
(
scriptParamAndPlaceholderDto
));
}
}
/**
* 构建配置
* @param conf
*/
private
static
void
confSet
(
PluginNodeConfig
conf
){
conf
.
setFailedRetryCount
(
2
);
conf
.
setFailedRetryInterval
(
TimeUnit
.
MINUTES
.
toSeconds
(
2
));
conf
.
setNodeTimeout
(-
1L
);
conf
.
setPriority
(
"1"
);
}
}
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