Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
DolphinScheduler
提交
fa4caf9b
DolphinScheduler
项目概览
xiphi1978
/
DolphinScheduler
与 Fork 源项目一致
Fork自
apache / DolphinScheduler
通知
2
Star
0
Fork
1
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
fa4caf9b
编写于
6月 08, 2019
作者:
leon-baoliang
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'upstream/branch-1.0.2' into 102
上级
963f28e3
fea3cce5
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
96 addition
and
14 deletion
+96
-14
README.md
README.md
+1
-1
escheduler-api/src/main/java/cn/escheduler/api/quartz/QuartzExecutors.java
...c/main/java/cn/escheduler/api/quartz/QuartzExecutors.java
+2
-0
escheduler-api/src/main/java/cn/escheduler/api/service/ResourcesService.java
...main/java/cn/escheduler/api/service/ResourcesService.java
+6
-0
escheduler-common/src/main/java/cn/escheduler/common/utils/DependentUtils.java
.../main/java/cn/escheduler/common/utils/DependentUtils.java
+6
-0
escheduler-common/src/main/java/cn/escheduler/common/utils/OSUtils.java
...mon/src/main/java/cn/escheduler/common/utils/OSUtils.java
+1
-1
escheduler-common/src/main/java/cn/escheduler/common/utils/dependent/DependentDateUtils.java
...escheduler/common/utils/dependent/DependentDateUtils.java
+20
-0
escheduler-common/src/test/java/cn/escheduler/common/utils/DependentUtilsTest.java
...t/java/cn/escheduler/common/utils/DependentUtilsTest.java
+20
-0
escheduler-dao/src/main/java/cn/escheduler/dao/mapper/ResourceMapperProvider.java
...java/cn/escheduler/dao/mapper/ResourceMapperProvider.java
+1
-0
escheduler-server/src/main/java/cn/escheduler/server/utils/ProcessUtils.java
...rc/main/java/cn/escheduler/server/utils/ProcessUtils.java
+23
-2
escheduler-server/src/main/java/cn/escheduler/server/worker/task/AbstractCommandExecutor.java
...scheduler/server/worker/task/AbstractCommandExecutor.java
+1
-7
escheduler-server/src/main/java/cn/escheduler/server/worker/task/sql/SqlTask.java
...in/java/cn/escheduler/server/worker/task/sql/SqlTask.java
+3
-3
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/commcon.js
...home/pages/dag/_source/formModel/tasks/_source/commcon.js
+8
-0
escheduler-ui/src/js/module/i18n/locale/en_US.js
escheduler-ui/src/js/module/i18n/locale/en_US.js
+2
-0
escheduler-ui/src/js/module/i18n/locale/zh_CN.js
escheduler-ui/src/js/module/i18n/locale/zh_CN.js
+2
-0
未找到文件。
README.md
浏览文件 @
fa4caf9b
Easy Scheduler
Easy Scheduler
============
[
![License
](
https://img.shields.io/badge/license-Apache%202-4EB1BA.svg
)
](https://www.apache.org/licenses/LICENSE-2.0.html)
...
...
escheduler-api/src/main/java/cn/escheduler/api/quartz/QuartzExecutors.java
浏览文件 @
fa4caf9b
...
...
@@ -230,6 +230,8 @@ public class QuartzExecutors {
if
(
scheduler
.
checkExists
(
jobKey
)){
logger
.
info
(
"try to delete job, job name: {}, job group name: {},"
,
jobName
,
jobGroupName
);
return
scheduler
.
deleteJob
(
jobKey
);
}
else
{
return
true
;
}
}
catch
(
SchedulerException
e
)
{
...
...
escheduler-api/src/main/java/cn/escheduler/api/service/ResourcesService.java
浏览文件 @
fa4caf9b
...
...
@@ -569,6 +569,7 @@ public class ResourcesService extends BaseService {
* @param resourceId
* @return
*/
@Transactional
(
value
=
"TransactionManager"
,
rollbackFor
=
Exception
.
class
)
public
Result
updateResourceContent
(
int
resourceId
,
String
content
)
{
Result
result
=
new
Result
();
...
...
@@ -597,6 +598,10 @@ public class ResourcesService extends BaseService {
}
}
resource
.
setSize
(
content
.
getBytes
().
length
);
resource
.
setUpdateTime
(
new
Date
());
resourcesMapper
.
update
(
resource
);
User
user
=
userMapper
.
queryDetailsById
(
resource
.
getUserId
());
String
tenantCode
=
tenantMapper
.
queryById
(
user
.
getTenantId
()).
getTenantCode
();
...
...
@@ -643,6 +648,7 @@ public class ResourcesService extends BaseService {
logger
.
error
(
"{} is not exist"
,
resourcePath
);
result
.
setCode
(
Status
.
HDFS_OPERATION_ERROR
.
getCode
());
result
.
setMsg
(
String
.
format
(
"%s is not exist"
,
resourcePath
));
return
result
;
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
...
...
escheduler-common/src/main/java/cn/escheduler/common/utils/DependentUtils.java
浏览文件 @
fa4caf9b
...
...
@@ -95,6 +95,9 @@ public class DependentUtils {
case
"last7Days"
:
result
=
DependentDateUtils
.
getLastDayInterval
(
businessDate
,
7
);
break
;
case
"thisWeek"
:
result
=
DependentDateUtils
.
getThisWeekInterval
(
businessDate
);
break
;
case
"lastWeek"
:
result
=
DependentDateUtils
.
getLastWeekInterval
(
businessDate
);
break
;
...
...
@@ -119,6 +122,9 @@ public class DependentUtils {
case
"lastSunday"
:
result
=
DependentDateUtils
.
getLastWeekOneDayInterval
(
businessDate
,
7
);
break
;
case
"thisMonth"
:
result
=
DependentDateUtils
.
getThisMonthInterval
(
businessDate
);
break
;
case
"lastMonth"
:
result
=
DependentDateUtils
.
getLastMonthInterval
(
businessDate
);
break
;
...
...
escheduler-common/src/main/java/cn/escheduler/common/utils/OSUtils.java
浏览文件 @
fa4caf9b
...
...
@@ -220,7 +220,7 @@ public class OSUtils {
* @throws IOException
*/
public
static
String
exeShell
(
String
command
)
throws
IOException
{
return
ShellExecutor
.
execCommand
(
"groups"
);
return
ShellExecutor
.
execCommand
(
command
);
}
/**
...
...
escheduler-common/src/main/java/cn/escheduler/common/utils/dependent/DependentDateUtils.java
浏览文件 @
fa4caf9b
...
...
@@ -76,6 +76,16 @@ public class DependentDateUtils {
return
dateIntervals
;
}
/**
* get interval between this month first day and businessDate
* @param businessDate
* @return
*/
public
static
List
<
DateInterval
>
getThisMonthInterval
(
Date
businessDate
)
{
Date
firstDay
=
DateUtils
.
getFirstDayOfMonth
(
businessDate
);
return
getDateIntervalListBetweenTwoDates
(
firstDay
,
businessDate
);
}
/**
* get interval between last month first day and last day
* @param businessDate
...
...
@@ -108,6 +118,16 @@ public class DependentDateUtils {
}
}
/**
* get interval between monday to businessDate of this week
* @param businessDate
* @return
*/
public
static
List
<
DateInterval
>
getThisWeekInterval
(
Date
businessDate
)
{
Date
mondayThisWeek
=
DateUtils
.
getMonday
(
businessDate
);
return
getDateIntervalListBetweenTwoDates
(
mondayThisWeek
,
businessDate
);
}
/**
* get interval between monday to sunday of last week
* default set monday the first day of week
...
...
escheduler-common/src/test/java/cn/escheduler/common/utils/DependentUtilsTest.java
浏览文件 @
fa4caf9b
...
...
@@ -80,6 +80,26 @@ public class DependentUtilsTest {
Assert
.
assertEquals
(
dateIntervals
.
get
(
0
),
diCur
);
dateValue
=
"thisWeek"
;
Date
firstWeekDay
=
DateUtils
.
getMonday
(
curDay
);
dateIntervals
=
DependentUtils
.
getDateIntervalList
(
curDay
,
dateValue
);
DateInterval
weekHead
=
new
DateInterval
(
DateUtils
.
getStartOfDay
(
firstWeekDay
),
DateUtils
.
getEndOfDay
(
firstWeekDay
));
DateInterval
weekThis
=
new
DateInterval
(
DateUtils
.
getStartOfDay
(
curDay
),
DateUtils
.
getEndOfDay
(
curDay
));
Assert
.
assertEquals
(
dateIntervals
.
get
(
0
),
weekHead
);
Assert
.
assertEquals
(
dateIntervals
.
get
(
dateIntervals
.
size
()
-
1
),
weekThis
);
dateValue
=
"thisMonth"
;
Date
firstMonthDay
=
DateUtils
.
getFirstDayOfMonth
(
curDay
);
dateIntervals
=
DependentUtils
.
getDateIntervalList
(
curDay
,
dateValue
);
DateInterval
monthHead
=
new
DateInterval
(
DateUtils
.
getStartOfDay
(
firstMonthDay
),
DateUtils
.
getEndOfDay
(
firstMonthDay
));
DateInterval
monthThis
=
new
DateInterval
(
DateUtils
.
getStartOfDay
(
curDay
),
DateUtils
.
getEndOfDay
(
curDay
));
Assert
.
assertEquals
(
dateIntervals
.
get
(
0
),
monthHead
);
Assert
.
assertEquals
(
dateIntervals
.
get
(
dateIntervals
.
size
()
-
1
),
monthThis
);
}
...
...
escheduler-dao/src/main/java/cn/escheduler/dao/mapper/ResourceMapperProvider.java
浏览文件 @
fa4caf9b
...
...
@@ -118,6 +118,7 @@ public class ResourceMapperProvider {
SET
(
"`alias` = #{resource.alias}"
);
SET
(
"`desc` = #{resource.desc}"
);
SET
(
"`update_time` = #{resource.updateTime}"
);
SET
(
"`size` = #{resource.size}"
);
WHERE
(
"`id` = #{resource.id}"
);
}}.
toString
();
}
...
...
escheduler-server/src/main/java/cn/escheduler/server/utils/ProcessUtils.java
浏览文件 @
fa4caf9b
...
...
@@ -18,6 +18,7 @@ package cn.escheduler.server.utils;
import
cn.escheduler.common.Constants
;
import
cn.escheduler.common.utils.CommonUtils
;
import
cn.escheduler.common.utils.OSUtils
;
import
cn.escheduler.dao.model.TaskInstance
;
import
cn.escheduler.server.rpc.LogClient
;
import
org.apache.commons.io.FileUtils
;
...
...
@@ -33,6 +34,7 @@ import java.util.List;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* mainly used to get the start command line of a process
*/
...
...
@@ -139,6 +141,8 @@ public class ProcessUtils {
{
' '
,
'\t'
,
'<'
,
'>'
},
{
' '
,
'\t'
}};
private
static
Matcher
matcher
;
private
static
String
createCommandLine
(
int
verificationType
,
final
String
executablePath
,
final
String
[]
cmd
)
{
StringBuilder
cmdbuf
=
new
StringBuilder
(
80
);
...
...
@@ -256,11 +260,11 @@ public class ProcessUtils {
return
;
}
String
cmd
=
String
.
format
(
"sudo kill -9 %
d"
,
processId
);
String
cmd
=
String
.
format
(
"sudo kill -9 %
s"
,
getPidsStr
(
processId
)
);
logger
.
info
(
"process id:{}, cmd:{}"
,
processId
,
cmd
);
Runtime
.
getRuntime
().
exec
(
cmd
);
OSUtils
.
exeCmd
(
cmd
);
// find log and kill yarn job
killYarnJob
(
taskInstance
);
...
...
@@ -270,6 +274,23 @@ public class ProcessUtils {
}
}
/**
* get pids str
* @param processId
* @return
* @throws Exception
*/
private
static
String
getPidsStr
(
int
processId
)
throws
Exception
{
StringBuilder
sb
=
new
StringBuilder
();
// pstree -p pid get sub pids
String
pids
=
OSUtils
.
exeCmd
(
"pstree -p "
+
processId
+
""
);
Matcher
mat
=
Pattern
.
compile
(
"(\\d+)"
).
matcher
(
pids
);
while
(
mat
.
find
()){
sb
.
append
(
mat
.
group
()+
" "
);
}
return
sb
.
toString
().
trim
();
}
/**
* find logs and kill yarn tasks
* @param taskInstance
...
...
escheduler-server/src/main/java/cn/escheduler/server/worker/task/AbstractCommandExecutor.java
浏览文件 @
fa4caf9b
...
...
@@ -213,7 +213,7 @@ public abstract class AbstractCommandExecutor {
*/
private
int
updateState
(
ProcessDao
processDao
,
int
exitStatusCode
,
int
pid
,
int
taskInstId
)
{
//get yarn state by log
if
(
exitStatusCode
!=
-
1
)
{
if
(
exitStatusCode
!=
0
)
{
TaskInstance
taskInstance
=
processDao
.
findTaskInstanceById
(
taskInstId
);
logger
.
info
(
"process id is {}"
,
pid
);
...
...
@@ -556,10 +556,4 @@ public abstract class AbstractCommandExecutor {
protected
abstract
boolean
checkShowLog
(
String
line
);
protected
abstract
boolean
checkFindApp
(
String
line
);
protected
abstract
void
createCommandFileIfNotExists
(
String
execCommand
,
String
commandFile
)
throws
IOException
;
// if(line.contains(taskAppId) || !line.contains("cn.escheduler.server.worker.log.TaskLogger")){
// logs.add(line);
// }
}
escheduler-server/src/main/java/cn/escheduler/server/worker/task/sql/SqlTask.java
浏览文件 @
fa4caf9b
...
...
@@ -347,14 +347,14 @@ public class SqlTask extends AbstractTask {
// receiving group list
List
<
String
>
receviersList
=
new
ArrayList
<
String
>();
for
(
User
user:
users
){
receviersList
.
add
(
user
.
getEmail
());
receviersList
.
add
(
user
.
getEmail
()
.
trim
()
);
}
// custom receiver
String
receivers
=
sqlParameters
.
getReceivers
();
if
(
StringUtils
.
isNotEmpty
(
receivers
)){
String
[]
splits
=
receivers
.
split
(
Constants
.
COMMA
);
for
(
String
receiver
:
splits
){
receviersList
.
add
(
receiver
);
receviersList
.
add
(
receiver
.
trim
()
);
}
}
...
...
@@ -365,7 +365,7 @@ public class SqlTask extends AbstractTask {
if
(
StringUtils
.
isNotEmpty
(
receiversCc
)){
String
[]
splits
=
receiversCc
.
split
(
Constants
.
COMMA
);
for
(
String
receiverCc
:
splits
){
receviersCcList
.
add
(
receiverCc
);
receviersCcList
.
add
(
receiverCc
.
trim
()
);
}
}
...
...
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/commcon.js
浏览文件 @
fa4caf9b
...
...
@@ -64,6 +64,10 @@ const dateValueList = {
}
],
'
week
'
:
[
{
value
:
'
thisWeek
'
,
label
:
`
${
i18n
.
$t
(
'
ThisWeek
'
)}
`
},
{
value
:
'
lastWeek
'
,
label
:
`
${
i18n
.
$t
(
'
LastWeek
'
)}
`
...
...
@@ -98,6 +102,10 @@ const dateValueList = {
}
],
'
month
'
:
[
{
value
:
'
thisMonth
'
,
label
:
`
${
i18n
.
$t
(
'
ThisMonth
'
)}
`
},
{
value
:
'
lastMonth
'
,
label
:
`
${
i18n
.
$t
(
'
LastMonth
'
)}
`
...
...
escheduler-ui/src/js/module/i18n/locale/en_US.js
浏览文件 @
fa4caf9b
...
...
@@ -395,6 +395,7 @@ export default {
'
Last2Days
'
:
'
Last2Days
'
,
'
Last3Days
'
:
'
Last3Days
'
,
'
Last7Days
'
:
'
Last7Days
'
,
'
ThisWeek
'
:
'
ThisWeek
'
,
'
LastWeek
'
:
'
LastWeek
'
,
'
LastMonday
'
:
'
LastMonday
'
,
'
LastTuesday
'
:
'
LastTuesday
'
,
...
...
@@ -403,6 +404,7 @@ export default {
'
LastFriday
'
:
'
LastFriday
'
,
'
LastSaturday
'
:
'
LastSaturday
'
,
'
LastSunday
'
:
'
LastSunday
'
,
'
ThisMonth
'
:
'
ThisMonth
'
,
'
LastMonth
'
:
'
LastMonth
'
,
'
LastMonthBegin
'
:
'
LastMonthBegin
'
,
'
LastMonthEnd
'
:
'
LastMonthEnd
'
,
...
...
escheduler-ui/src/js/module/i18n/locale/zh_CN.js
浏览文件 @
fa4caf9b
...
...
@@ -395,6 +395,7 @@ export default {
'
Last2Days
'
:
'
前两天
'
,
'
Last3Days
'
:
'
前三天
'
,
'
Last7Days
'
:
'
前七天
'
,
'
ThisWeek
'
:
'
本周
'
,
'
LastWeek
'
:
'
上周
'
,
'
LastMonday
'
:
'
上周一
'
,
'
LastTuesday
'
:
'
上周二
'
,
...
...
@@ -403,6 +404,7 @@ export default {
'
LastFriday
'
:
'
上周五
'
,
'
LastSaturday
'
:
'
上周六
'
,
'
LastSunday
'
:
'
上周日
'
,
'
ThisMonth
'
:
'
本月
'
,
'
LastMonth
'
:
'
上月
'
,
'
LastMonthBegin
'
:
'
上月初
'
,
'
LastMonthEnd
'
:
'
上月末
'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录