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
d896cd3d
Commit
d896cd3d
authored
May 12, 2020
by
guominglei
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
0f3dd5c3
193f9214
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
57 additions
and
5 deletions
+57
-5
ScriptExecutorJobTask.java
...re/src/main/java/com/byit/task/ScriptExecutorJobTask.java
+3
-1
MythJobProcess.java
...server/src/main/java/com/byit/process/MythJobProcess.java
+3
-1
ScriptExecutorServiceImpl.java
...main/java/com/byit/service/ScriptExecutorServiceImpl.java
+2
-0
LogGobbler.java
...cutor-server/src/main/java/com/byit/utils/LogGobbler.java
+3
-1
pom.xml
byit-myth-gateway/pom.xml
+1
-2
ErrorHandlerController.java
...a/com/byit/gateway/controller/ErrorHandlerController.java
+42
-0
application-dev.yml
byit-myth-gateway/src/main/resources/application-dev.yml
+3
-0
No files found.
byit-myth-core/myth-admin-core/src/main/java/com/byit/task/ScriptExecutorJobTask.java
View file @
d896cd3d
...
...
@@ -110,7 +110,9 @@ public class ScriptExecutorJobTask implements TimerTask {
}
catch
(
Exception
e
){
StringRedisTemplate
stringRedisTemplate
=
(
StringRedisTemplate
)
SpringUtil
.
getBean
(
"stringRedisTemplate"
);
RunLog
runLog
=
RunLog
.
builder
().
isEnd
(
true
).
isSuccess
(
false
).
runLog
(
"执行资源异常"
+
e
.
getMessage
()).
build
();
stringRedisTemplate
.
convertAndSend
(
"REAL-EXEC-"
+
mythJobTaskSchedule
.
getLogId
()
,
JSON
.
toJSONString
(
runLog
,
WriteClassName
));
//stringRedisTemplate.convertAndSend("REAL-EXEC-" + mythJobTaskSchedule.getLogId() , JSON.toJSONString(runLog, WriteClassName));
//使用redis 想队尾push一个值
stringRedisTemplate
.
opsForList
().
rightPush
(
"REAL-EXEC-"
+
mythJobTaskSchedule
.
getLogId
()
,
JSON
.
toJSONString
(
runLog
,
WriteClassName
));
log
.
error
(
"------执行机异常{}-----"
,
e
.
getMessage
());
dispatchResponseDto
.
setMsg
(
e
.
getMessage
());
dispatchResponseDto
.
setCode
(
JobResultEnum
.
DISPATCH_FAIL
.
getCode
());
...
...
byit-myth-executor/myth-executor-server/src/main/java/com/byit/process/MythJobProcess.java
View file @
d896cd3d
...
...
@@ -154,7 +154,9 @@ public class MythJobProcess implements Callable<String>{
this
.
process
.
destroy
();
}
RunLog
runLog
=
RunLog
.
builder
().
isEnd
(
true
).
isSuccess
(
exitCode
==
0
?
true
:
false
).
build
();
stringRedisTemplate
.
convertAndSend
(
runKey
,
JSON
.
toJSONString
(
runLog
,
WriteClassName
));
//stringRedisTemplate.convertAndSend(runKey, JSON.toJSONString(runLog, WriteClassName))
//TODO 向队尾追加一个日志
stringRedisTemplate
.
opsForList
().
rightPush
(
runKey
,
JSON
.
toJSONString
(
runLog
,
WriteClassName
));
return
outputGobbler
.
getRecentLog
()
+
"\n"
+
errorGobbler
.
getRecentLog
();
}
}
...
...
byit-myth-executor/myth-executor-server/src/main/java/com/byit/service/ScriptExecutorServiceImpl.java
View file @
d896cd3d
...
...
@@ -163,10 +163,12 @@ public class ScriptExecutorServiceImpl implements ScriptExecutorService {
jobRunResultDto
.
setReturnResult
(
ReturnResult
.
FAIL
);
}
}
catch
(
Exception
e
){
log
.
error
(
"调度执行机出现异常:{}"
,
e
.
getMessage
());
ReturnResult
<
String
>
returnResult
=
new
ReturnResult
<>();
returnResult
.
setCode
(
ReturnResult
.
FAIL
.
getCode
());
returnResult
.
setMsg
(
e
.
getMessage
());
jobRunResultDto
.
setReturnResult
(
returnResult
);
}
//设置结束时间
jobRunResultDto
.
setEndTime
(
new
Date
());
...
...
byit-myth-executor/myth-executor-server/src/main/java/com/byit/utils/LogGobbler.java
View file @
d896cd3d
...
...
@@ -44,7 +44,9 @@ public class LogGobbler extends Thread {
}
this
.
buffer
.
append
(
line
+
"\n"
);
runLog
.
setRunLog
(
line
);
stringRedisTemplate
.
convertAndSend
(
runKey
,
JSON
.
toJSONString
(
runLog
,
WriteClassName
));
//stringRedisTemplate.convertAndSend(runKey, JSON.toJSONString(runLog, WriteClassName))
//TODO 向队列队尾插入一个值
stringRedisTemplate
.
opsForList
().
rightPush
(
runKey
,
JSON
.
toJSONString
(
runLog
,
WriteClassName
));
printLog
(
line
);
}
}
catch
(
final
IOException
e
)
{
...
...
byit-myth-gateway/pom.xml
View file @
d896cd3d
...
...
@@ -45,8 +45,7 @@
<dependency>
<groupId>
myth-job
</groupId>
<artifactId>
myth-web-core
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<artifactId>
myth-core-common
</artifactId>
</dependency>
...
...
byit-myth-gateway/src/main/java/com/byit/gateway/controller/ErrorHandlerController.java
0 → 100644
View file @
d896cd3d
package
com
.
byit
.
gateway
.
controller
;
import
com.byit.dto.web.ResponseResult
;
import
com.byit.enums.TransferResultEnum
;
import
com.netflix.zuul.context.RequestContext
;
import
com.netflix.zuul.exception.ZuulException
;
import
org.springframework.boot.autoconfigure.web.ErrorController
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletResponse
;
/**
* @author huangfu
*/
@RestController
public
class
ErrorHandlerController
implements
ErrorController
{
@Override
public
String
getErrorPath
()
{
return
"/error"
;
}
@RequestMapping
(
value
=
"/error"
,
produces
={
"application/json; charset=utf-8"
})
public
Object
error
(
HttpServletResponse
response
){
RequestContext
ctx
=
RequestContext
.
getCurrentContext
();
ZuulException
exception
=
(
ZuulException
)
ctx
.
getThrowable
();
String
msg
=
""
;
String
code
=
""
;
if
(
exception
==
null
)
{
code
=
TransferResultEnum
.
ERROR
.
getCode
();
msg
=
"网关异常:"
+
TransferResultEnum
.
ERROR
.
getMsg
();
}
else
{
msg
=
"网关异常:"
+
exception
.
getMessage
();
code
=
exception
.
nStatusCode
+
""
;
}
ResponseResult
responseResult
=
new
ResponseResult
();
responseResult
.
setMsg
(
msg
);
responseResult
.
setTimeCost
(
System
.
currentTimeMillis
());
responseResult
.
setCode
(
code
);
return
responseResult
;
}
}
byit-myth-gateway/src/main/resources/application-dev.yml
View file @
d896cd3d
...
...
@@ -34,3 +34,6 @@ spring:
zuul
:
ignored-services
:
'
*'
# sendErrorFilter:
# error:
# disable: true
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