Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_44739061
DolphinScheduler
提交
682fd7be
DolphinScheduler
项目概览
weixin_44739061
/
DolphinScheduler
与 Fork 源项目一致
Fork自
apache / DolphinScheduler
通知
1
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,发现更多精彩内容 >>
未验证
提交
682fd7be
编写于
4月 29, 2020
作者:
D
dailidong
提交者:
GitHub
4月 29, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' into dev
上级
5caa6e5d
22d4ee94
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
51 addition
and
8 deletion
+51
-8
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
.../apache/dolphinscheduler/api/service/ExecutorService.java
+10
-1
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/SchedulerService.java
...apache/dolphinscheduler/api/service/SchedulerService.java
+1
-0
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorService2Test.java
...he/dolphinscheduler/api/service/ExecutorService2Test.java
+38
-5
script/env/dolphinscheduler_env.sh
script/env/dolphinscheduler_env.sh
+2
-2
未找到文件。
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java
浏览文件 @
682fd7be
...
...
@@ -21,6 +21,7 @@ import org.apache.dolphinscheduler.api.enums.ExecuteType;
import
org.apache.dolphinscheduler.api.enums.Status
;
import
org.apache.dolphinscheduler.common.Constants
;
import
org.apache.dolphinscheduler.common.enums.*
;
import
org.apache.dolphinscheduler.common.model.Server
;
import
org.apache.dolphinscheduler.common.utils.CollectionUtils
;
import
org.apache.dolphinscheduler.common.utils.DateUtils
;
import
org.apache.dolphinscheduler.common.utils.JSONUtils
;
...
...
@@ -59,7 +60,7 @@ public class ExecutorService extends BaseService{
private
ProcessDefinitionMapper
processDefinitionMapper
;
@Autowired
private
ProcessDefinitionService
processDefinition
Service
;
private
MonitorService
monitor
Service
;
@Autowired
...
...
@@ -123,6 +124,14 @@ public class ExecutorService extends BaseService{
return
result
;
}
// check master server exists
List
<
Server
>
masterServers
=
monitorService
.
getServerListFromZK
(
true
);
if
(
masterServers
.
size
()
==
0
)
{
putMsg
(
result
,
Status
.
MASTER_NOT_EXISTS
);
return
result
;
}
/**
* create command
*/
...
...
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/SchedulerService.java
浏览文件 @
682fd7be
...
...
@@ -365,6 +365,7 @@ public class SchedulerService extends BaseService {
if
(
masterServers
.
size
()
==
0
)
{
putMsg
(
result
,
Status
.
MASTER_NOT_EXISTS
);
return
result
;
}
// set status
...
...
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorService2Test.java
浏览文件 @
682fd7be
...
...
@@ -22,6 +22,7 @@ import org.apache.dolphinscheduler.common.enums.CommandType;
import
org.apache.dolphinscheduler.common.enums.Priority
;
import
org.apache.dolphinscheduler.common.enums.ReleaseState
;
import
org.apache.dolphinscheduler.common.enums.RunMode
;
import
org.apache.dolphinscheduler.common.model.Server
;
import
org.apache.dolphinscheduler.dao.entity.*
;
import
org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper
;
import
org.apache.dolphinscheduler.dao.mapper.ProjectMapper
;
...
...
@@ -63,6 +64,9 @@ public class ExecutorService2Test {
@Mock
private
ProjectService
projectService
;
@Mock
private
MonitorService
monitorService
;
private
int
processDefinitionId
=
1
;
private
int
tenantId
=
1
;
...
...
@@ -102,6 +106,7 @@ public class ExecutorService2Test {
Mockito
.
when
(
processDefinitionMapper
.
selectById
(
processDefinitionId
)).
thenReturn
(
processDefinition
);
Mockito
.
when
(
processService
.
getTenantForProcess
(
tenantId
,
userId
)).
thenReturn
(
new
Tenant
());
Mockito
.
when
(
processService
.
createCommand
(
any
(
Command
.
class
))).
thenReturn
(
1
);
Mockito
.
when
(
monitorService
.
getServerListFromZK
(
true
)).
thenReturn
(
getMasterServersList
());
}
/**
...
...
@@ -121,7 +126,6 @@ public class ExecutorService2Test {
Assert
.
assertEquals
(
Status
.
SUCCESS
,
result
.
get
(
Constants
.
STATUS
));
verify
(
processService
,
times
(
1
)).
createCommand
(
any
(
Command
.
class
));
}
catch
(
Exception
e
){
Assert
.
assertTrue
(
false
);
}
}
...
...
@@ -142,7 +146,6 @@ public class ExecutorService2Test {
Assert
.
assertEquals
(
Status
.
START_PROCESS_INSTANCE_ERROR
,
result
.
get
(
Constants
.
STATUS
));
verify
(
processService
,
times
(
0
)).
createCommand
(
any
(
Command
.
class
));
}
catch
(
Exception
e
){
Assert
.
assertTrue
(
false
);
}
}
...
...
@@ -163,7 +166,6 @@ public class ExecutorService2Test {
Assert
.
assertEquals
(
Status
.
SUCCESS
,
result
.
get
(
Constants
.
STATUS
));
verify
(
processService
,
times
(
1
)).
createCommand
(
any
(
Command
.
class
));
}
catch
(
Exception
e
){
Assert
.
assertTrue
(
false
);
}
}
...
...
@@ -184,7 +186,6 @@ public class ExecutorService2Test {
Assert
.
assertEquals
(
Status
.
SUCCESS
,
result
.
get
(
Constants
.
STATUS
));
verify
(
processService
,
times
(
31
)).
createCommand
(
any
(
Command
.
class
));
}
catch
(
Exception
e
){
Assert
.
assertTrue
(
false
);
}
}
...
...
@@ -205,10 +206,42 @@ public class ExecutorService2Test {
Assert
.
assertEquals
(
Status
.
SUCCESS
,
result
.
get
(
Constants
.
STATUS
));
verify
(
processService
,
times
(
15
)).
createCommand
(
any
(
Command
.
class
));
}
catch
(
Exception
e
){
Assert
.
assertTrue
(
false
);
}
}
@Test
public
void
testNoMsterServers
()
throws
ParseException
{
Mockito
.
when
(
monitorService
.
getServerListFromZK
(
true
)).
thenReturn
(
new
ArrayList
<
Server
>());
Map
<
String
,
Object
>
result
=
executorService
.
execProcessInstance
(
loginUser
,
projectName
,
processDefinitionId
,
cronTime
,
CommandType
.
COMPLEMENT_DATA
,
null
,
null
,
null
,
null
,
0
,
""
,
""
,
RunMode
.
RUN_MODE_PARALLEL
,
Priority
.
LOW
,
Constants
.
DEFAULT_WORKER_GROUP
,
110
);
Assert
.
assertEquals
(
result
.
get
(
Constants
.
STATUS
),
Status
.
MASTER_NOT_EXISTS
);
}
private
List
<
Server
>
getMasterServersList
(){
List
<
Server
>
masterServerList
=
new
ArrayList
<>();
Server
masterServer1
=
new
Server
();
masterServer1
.
setId
(
1
);
masterServer1
.
setHost
(
"192.168.220.188"
);
masterServer1
.
setPort
(
1121
);
masterServerList
.
add
(
masterServer1
);
Server
masterServer2
=
new
Server
();
masterServer2
.
setId
(
2
);
masterServer2
.
setHost
(
"192.168.220.189"
);
masterServer2
.
setPort
(
1122
);
masterServerList
.
add
(
masterServer2
);
return
masterServerList
;
}
private
List
<
Schedule
>
zeroSchedulerList
(){
return
Collections
.
EMPTY_LIST
;
}
...
...
script/env/dolphinscheduler_env.sh
浏览文件 @
682fd7be
...
...
@@ -23,6 +23,6 @@ export PYTHON_HOME=/opt/soft/python
export
JAVA_HOME
=
/opt/soft/java
export
HIVE_HOME
=
/opt/soft/hive
export
FLINK_HOME
=
/opt/soft/flink
export
DATAX_HOME
=
/opt/soft/data
X
export
DATAX_HOME
=
/opt/soft/data
x/bin/datax.py
export
PATH
=
$HADOOP_HOME
/bin:
$SPARK_HOME1
/bin:
$SPARK_HOME2
/bin:
$PYTHON_HOME
:
$JAVA_HOME
/bin:
$HIVE_HOME
/bin:
$PATH
:
$FLINK_HOME
/bin:
$DATAX_HOME
/bin
:
$PATH
export
PATH
=
$HADOOP_HOME
/bin:
$SPARK_HOME1
/bin:
$SPARK_HOME2
/bin:
$PYTHON_HOME
:
$JAVA_HOME
/bin:
$HIVE_HOME
/bin:
$PATH
:
$FLINK_HOME
/bin:
$DATAX_HOME
:
$PATH
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录