Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lhongjum2003
DolphinScheduler
提交
4d9d72fe
DolphinScheduler
项目概览
lhongjum2003
/
DolphinScheduler
与 Fork 源项目一致
Fork自
apache / DolphinScheduler
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
DolphinScheduler
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4d9d72fe
编写于
4月 16, 2019
作者:
G
gongzijian
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'upstream/dev-20190415' into dev-20190415
上级
914169ba
76e70131
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
99 addition
and
37 deletion
+99
-37
escheduler-api/src/main/java/cn/escheduler/api/controller/TaskRecordController.java
...va/cn/escheduler/api/controller/TaskRecordController.java
+33
-1
escheduler-api/src/main/java/cn/escheduler/api/service/TaskRecordService.java
...ain/java/cn/escheduler/api/service/TaskRecordService.java
+6
-3
escheduler-common/src/main/java/cn/escheduler/common/Constants.java
...-common/src/main/java/cn/escheduler/common/Constants.java
+9
-0
escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java
...duler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java
+45
-29
escheduler-dao/src/main/java/cn/escheduler/dao/TaskRecordDao.java
...er-dao/src/main/java/cn/escheduler/dao/TaskRecordDao.java
+6
-4
未找到文件。
escheduler-api/src/main/java/cn/escheduler/api/controller/TaskRecordController.java
浏览文件 @
4d9d72fe
...
...
@@ -68,7 +68,7 @@ public class TaskRecordController extends BaseController{
try
{
logger
.
info
(
"query task record list, task name:{}, state :{}, taskDate: {}, start:{}, end:{}"
,
taskName
,
state
,
taskDate
,
startTime
,
endTime
);
Map
<
String
,
Object
>
result
=
taskRecordService
.
queryTaskRecordListPaging
(
taskName
,
startTime
,
taskDate
,
sourceTable
,
destTable
,
endTime
,
state
,
pageNo
,
pageSize
);
Map
<
String
,
Object
>
result
=
taskRecordService
.
queryTaskRecordListPaging
(
false
,
taskName
,
startTime
,
taskDate
,
sourceTable
,
destTable
,
endTime
,
state
,
pageNo
,
pageSize
);
return
returnDataListPaging
(
result
);
}
catch
(
Exception
e
){
logger
.
error
(
QUERY_TASK_RECORD_LIST_PAGING_ERROR
.
getMsg
(),
e
);
...
...
@@ -77,4 +77,36 @@ public class TaskRecordController extends BaseController{
}
/**
* query history task record list paging
*
* @param loginUser
* @return
*/
@GetMapping
(
"/history-list-paging"
)
@ResponseStatus
(
HttpStatus
.
OK
)
public
Result
queryHistoryTaskRecordListPaging
(
@RequestAttribute
(
value
=
Constants
.
SESSION_USER
)
User
loginUser
,
@RequestParam
(
value
=
"taskName"
,
required
=
false
)
String
taskName
,
@RequestParam
(
value
=
"state"
,
required
=
false
)
String
state
,
@RequestParam
(
value
=
"sourceTable"
,
required
=
false
)
String
sourceTable
,
@RequestParam
(
value
=
"destTable"
,
required
=
false
)
String
destTable
,
@RequestParam
(
value
=
"taskDate"
,
required
=
false
)
String
taskDate
,
@RequestParam
(
value
=
"startDate"
,
required
=
false
)
String
startTime
,
@RequestParam
(
value
=
"endDate"
,
required
=
false
)
String
endTime
,
@RequestParam
(
"pageNo"
)
Integer
pageNo
,
@RequestParam
(
"pageSize"
)
Integer
pageSize
){
try
{
logger
.
info
(
"query hisotry task record list, task name:{}, state :{}, taskDate: {}, start:{}, end:{}"
,
taskName
,
state
,
taskDate
,
startTime
,
endTime
);
Map
<
String
,
Object
>
result
=
taskRecordService
.
queryTaskRecordListPaging
(
true
,
taskName
,
startTime
,
taskDate
,
sourceTable
,
destTable
,
endTime
,
state
,
pageNo
,
pageSize
);
return
returnDataListPaging
(
result
);
}
catch
(
Exception
e
){
logger
.
error
(
QUERY_TASK_RECORD_LIST_PAGING_ERROR
.
getMsg
(),
e
);
return
error
(
QUERY_TASK_RECORD_LIST_PAGING_ERROR
.
getCode
(),
QUERY_TASK_RECORD_LIST_PAGING_ERROR
.
getMsg
());
}
}
}
escheduler-api/src/main/java/cn/escheduler/api/service/TaskRecordService.java
浏览文件 @
4d9d72fe
...
...
@@ -29,6 +29,8 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
static
cn
.
escheduler
.
common
.
Constants
.*;
/**
* task record service
*/
...
...
@@ -51,7 +53,7 @@ public class TaskRecordService extends BaseService{
* @param pageSize
* @return
*/
public
Map
<
String
,
Object
>
queryTaskRecordListPaging
(
String
taskName
,
String
startDate
,
public
Map
<
String
,
Object
>
queryTaskRecordListPaging
(
boolean
isHistory
,
String
taskName
,
String
startDate
,
String
taskDate
,
String
sourceTable
,
String
destTable
,
String
endDate
,
String
state
,
Integer
pageNo
,
Integer
pageSize
)
{
...
...
@@ -69,8 +71,9 @@ public class TaskRecordService extends BaseService{
map
.
put
(
"offset"
,
pageInfo
.
getStart
().
toString
());
map
.
put
(
"pageSize"
,
pageInfo
.
getPageSize
().
toString
());
int
count
=
TaskRecordDao
.
countTaskRecord
(
map
);
List
<
TaskRecord
>
recordList
=
TaskRecordDao
.
queryAllTaskRecord
(
map
);
String
table
=
isHistory
?
TASK_RECORD_TABLE_HISTORY_HIVE_LOG
:
TASK_RECORD_TABLE_HIVE_LOG
;
int
count
=
TaskRecordDao
.
countTaskRecord
(
map
,
table
);
List
<
TaskRecord
>
recordList
=
TaskRecordDao
.
queryAllTaskRecord
(
map
,
table
);
pageInfo
.
setTotalCount
(
count
);
pageInfo
.
setLists
(
recordList
);
result
.
put
(
Constants
.
DATA_LIST
,
pageInfo
);
...
...
escheduler-common/src/main/java/cn/escheduler/common/Constants.java
浏览文件 @
4d9d72fe
...
...
@@ -463,6 +463,10 @@ public final class Constants {
public
static
final
String
TASK_RECORD_PWD
=
"task.record.datasource.password"
;
public
static
String
TASK_RECORD_TABLE_HIVE_LOG
=
"eamp_hive_log_hd"
;
public
static
String
TASK_RECORD_TABLE_HISTORY_HIVE_LOG
=
"eamp_hive_hist_log_hd"
;
public
static
final
String
STATUS
=
"status"
;
...
...
@@ -826,4 +830,9 @@ public final class Constants {
public
static
final
String
CONTENT
=
"content"
;
public
static
final
String
DEPENDENT_SPLIT
=
":||"
;
public
static
final
String
DEPENDENT_ALL
=
"ALL"
;
/**
*
*/
}
escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java
浏览文件 @
4d9d72fe
...
...
@@ -120,48 +120,64 @@ public class ProcessDao extends AbstractBaseDao {
* find one command from command queue, construct process instance
* @param logger
* @param host
* @param va
il
dThreadNum
* @param va
li
dThreadNum
* @return
*/
@Transactional
(
value
=
"TransactionManager"
,
rollbackFor
=
Exception
.
class
)
public
ProcessInstance
scanCommand
(
Logger
logger
,
String
host
,
int
va
il
dThreadNum
){
public
ProcessInstance
scanCommand
(
Logger
logger
,
String
host
,
int
va
li
dThreadNum
){
ProcessInstance
processInstance
=
null
;
Command
command
=
findOneCommand
();
if
(
command
==
null
)
{
return
null
;
}
logger
.
info
(
String
.
format
(
"find one command: id: %d, type: %s"
,
command
.
getId
(),
command
.
getCommandType
().
toString
()));
processInstance
=
constructProcessInstance
(
command
,
host
);
//cannot construct process instance, return null;
if
(
processInstance
==
null
){
logger
.
error
(
"scan command, command parameter is error: %s"
,
command
.
toString
());
}
else
{
// check thread number enough for this command, if not, change state to waiting thread.
int
commandThreadCount
=
this
.
workProcessThreadNumCount
(
command
.
getProcessDefinitionId
());
if
(
vaildThreadNum
<
commandThreadCount
){
logger
.
info
(
"there is not enough thread for this command: {}"
,
command
.
toString
()
);
processInstance
.
setState
(
ExecutionStatus
.
WAITTING_THREAD
);
if
(
command
.
getCommandType
()
!=
CommandType
.
RECOVER_WAITTING_THREAD
){
processInstance
.
addHistoryCmd
(
command
.
getCommandType
());
}
saveProcessInstance
(
processInstance
);
this
.
setSubProcessParam
(
processInstance
);
createRecoveryWaitingThreadCommand
(
command
,
processInstance
);
try
{
processInstance
=
constructProcessInstance
(
command
,
host
);
//cannot construct process instance, return null;
if
(
processInstance
==
null
){
logger
.
error
(
"scan command, command parameter is error: %s"
,
command
.
toString
());
delCommandByid
(
command
.
getId
());
return
null
;
}
else
if
(!
checkThreadNum
(
command
,
validThreadNum
)){
logger
.
info
(
"there is not enough thread for this command: {}"
,
command
.
toString
()
);
return
setWaitingThreadProcess
(
command
,
processInstance
);
}
else
{
processInstance
.
setCommandType
(
command
.
getCommandType
());
processInstance
.
addHistoryCmd
(
command
.
getCommandType
());
saveProcessInstance
(
processInstance
);
this
.
setSubProcessParam
(
processInstance
);
processInstance
.
setCommandType
(
command
.
getCommandType
());
processInstance
.
addHistoryCmd
(
command
.
getCommandType
());
saveProcessInstance
(
processInstance
);
this
.
setSubProcessParam
(
processInstance
);
delCommandByid
(
command
.
getId
());
return
processInstance
;
}
}
catch
(
Exception
e
){
logger
.
error
(
"scan command error "
,
e
);
delCommandByid
(
command
.
getId
());
}
// delete command
delCommandByid
(
command
.
getId
());
return
processInstance
;
return
null
;
}
/**
* set process waiting thread
* @param command
* @param processInstance
* @return
*/
private
ProcessInstance
setWaitingThreadProcess
(
Command
command
,
ProcessInstance
processInstance
)
{
processInstance
.
setState
(
ExecutionStatus
.
WAITTING_THREAD
);
if
(
command
.
getCommandType
()
!=
CommandType
.
RECOVER_WAITTING_THREAD
){
processInstance
.
addHistoryCmd
(
command
.
getCommandType
());
}
saveProcessInstance
(
processInstance
);
this
.
setSubProcessParam
(
processInstance
);
createRecoveryWaitingThreadCommand
(
command
,
processInstance
);
return
null
;
}
private
boolean
checkThreadNum
(
Command
command
,
int
validThreadNum
)
{
int
commandThreadCount
=
this
.
workProcessThreadNumCount
(
command
.
getProcessDefinitionId
());
return
validThreadNum
>=
commandThreadCount
;
}
/**
...
...
@@ -669,7 +685,7 @@ public class ProcessDao extends AbstractBaseDao {
paramMap
.
put
(
CMDPARAM_SUB_PROCESS
,
String
.
valueOf
(
processInstance
.
getId
()));
processInstance
.
setCommandParam
(
JSONUtils
.
toJson
(
paramMap
));
processInstance
.
setIsSubProcess
(
Flag
.
YES
);
this
.
updat
eProcessInstance
(
processInstance
);
this
.
sav
eProcessInstance
(
processInstance
);
}
// copy parent instance user def params to sub process..
String
parentInstanceId
=
paramMap
.
get
(
CMDPARAM_SUB_PROCESS_PARENT_INSTANCE_ID
);
...
...
@@ -677,7 +693,7 @@ public class ProcessDao extends AbstractBaseDao {
ProcessInstance
parentInstance
=
findProcessInstanceDetailById
(
Integer
.
parseInt
(
parentInstanceId
));
if
(
parentInstance
!=
null
){
processInstance
.
setGlobalParams
(
parentInstance
.
getGlobalParams
());
this
.
updat
eProcessInstance
(
processInstance
);
this
.
sav
eProcessInstance
(
processInstance
);
}
else
{
logger
.
error
(
"sub process command params error, cannot find parent instance: {} "
,
cmdParam
);
}
...
...
escheduler-dao/src/main/java/cn/escheduler/dao/TaskRecordDao.java
浏览文件 @
4d9d72fe
...
...
@@ -40,6 +40,8 @@ public class TaskRecordDao {
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
TaskRecordDao
.
class
.
getName
());
/**
* 加载配置文件
*/
...
...
@@ -134,7 +136,7 @@ public class TaskRecordDao {
* @param filterMap
* @return
*/
public
static
int
countTaskRecord
(
Map
<
String
,
String
>
filterMap
){
public
static
int
countTaskRecord
(
Map
<
String
,
String
>
filterMap
,
String
table
){
int
count
=
0
;
Connection
conn
=
null
;
...
...
@@ -143,7 +145,7 @@ public class TaskRecordDao {
if
(
conn
==
null
){
return
count
;
}
String
sql
=
"select count(1) as count from eamp_hive_log_hd"
;
String
sql
=
String
.
format
(
"select count(1) as count from %s"
,
table
)
;
sql
+=
getWhereString
(
filterMap
);
PreparedStatement
pstmt
;
pstmt
=
conn
.
prepareStatement
(
sql
);
...
...
@@ -171,9 +173,9 @@ public class TaskRecordDao {
* @param filterMap
* @return
*/
public
static
List
<
TaskRecord
>
queryAllTaskRecord
(
Map
<
String
,
String
>
filterMap
)
{
public
static
List
<
TaskRecord
>
queryAllTaskRecord
(
Map
<
String
,
String
>
filterMap
,
String
table
)
{
String
sql
=
"select * from eamp_hive_log_hd "
;
String
sql
=
String
.
format
(
"select * from %s"
,
table
)
;
sql
+=
getWhereString
(
filterMap
);
int
offset
=
Integer
.
parseInt
(
filterMap
.
get
(
"offset"
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录