Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
DolphinScheduler
提交
00bb86f7
DolphinScheduler
项目概览
apache
/
DolphinScheduler
上一次同步 1 年多
通知
707
Star
9572
Fork
3514
代码
文件
提交
分支
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,发现更多精彩内容 >>
未验证
提交
00bb86f7
编写于
8月 22, 2022
作者:
W
Wenjun Ruan
提交者:
GitHub
8月 22, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #67 from WhaleOps/dispatch-failed-queue
[Bug-Fix] Task dispatch failed queue fix.
上级
e9dda042
b300ee68
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
16 addition
and
19 deletion
+16
-19
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskDispatchFailedQueueConsumer.java
...rver/master/consumer/TaskDispatchFailedQueueConsumer.java
+16
-19
未找到文件。
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskDispatchFailedQueueConsumer.java
浏览文件 @
00bb86f7
...
@@ -23,7 +23,6 @@ import org.apache.dolphinscheduler.common.thread.Stopper;
...
@@ -23,7 +23,6 @@ import org.apache.dolphinscheduler.common.thread.Stopper;
import
org.apache.dolphinscheduler.common.thread.ThreadUtils
;
import
org.apache.dolphinscheduler.common.thread.ThreadUtils
;
import
org.apache.dolphinscheduler.server.master.config.MasterConfig
;
import
org.apache.dolphinscheduler.server.master.config.MasterConfig
;
import
org.apache.dolphinscheduler.server.master.metrics.TaskMetrics
;
import
org.apache.dolphinscheduler.server.master.metrics.TaskMetrics
;
import
org.apache.dolphinscheduler.service.exceptions.TaskPriorityQueueException
;
import
org.apache.dolphinscheduler.service.queue.TaskPriority
;
import
org.apache.dolphinscheduler.service.queue.TaskPriority
;
import
org.apache.dolphinscheduler.service.queue.TaskPriorityQueue
;
import
org.apache.dolphinscheduler.service.queue.TaskPriorityQueue
;
...
@@ -49,14 +48,14 @@ public class TaskDispatchFailedQueueConsumer extends BaseDaemonThread {
...
@@ -49,14 +48,14 @@ public class TaskDispatchFailedQueueConsumer extends BaseDaemonThread {
*/
*/
@Autowired
@Autowired
@Qualifier
(
Constants
.
TASK_PRIORITY_QUEUE
)
@Qualifier
(
Constants
.
TASK_PRIORITY_QUEUE
)
private
TaskPriorityQueue
<
TaskPriority
>
taskPriorityQueue
;
private
TaskPriorityQueue
<
TaskPriority
>
taskPriorityQueue
Impl
;
/**
/**
* taskDispatchFailedQueue
* taskDispatchFailedQueue
*/
*/
@Autowired
@Autowired
@Qualifier
(
Constants
.
TASK_DISPATCH_FAILED_QUEUE
)
@Qualifier
(
Constants
.
TASK_DISPATCH_FAILED_QUEUE
)
private
TaskPriorityQueue
<
TaskPriority
>
taskDispatchFailedQueue
;
private
TaskPriorityQueue
<
TaskPriority
>
taskDispatchFailedQueue
Impl
;
@Autowired
@Autowired
private
MasterConfig
masterConfig
;
private
MasterConfig
masterConfig
;
...
@@ -74,8 +73,8 @@ public class TaskDispatchFailedQueueConsumer extends BaseDaemonThread {
...
@@ -74,8 +73,8 @@ public class TaskDispatchFailedQueueConsumer extends BaseDaemonThread {
static
{
static
{
TIME_DELAY
=
new
Long
[
Constants
.
DEFAULT_MAX_RETRY_COUNT
];
TIME_DELAY
=
new
Long
[
Constants
.
DEFAULT_MAX_RETRY_COUNT
];
for
(
int
i
=
0
;
i
<
Constants
.
DEFAULT_MAX_RETRY_COUNT
;
i
++)
{
for
(
int
i
=
0
;
i
<
Constants
.
DEFAULT_MAX_RETRY_COUNT
;
i
++)
{
int
delayTime
=
(
i
+
1
)
*
1000
;
long
delayTime
=
(
i
+
1
)
*
Constants
.
SLEEP_TIME_MILLIS
;
TIME_DELAY
[
i
]
=
(
long
)
delayTime
;
TIME_DELAY
[
i
]
=
delayTime
;
}
}
}
}
...
@@ -94,7 +93,7 @@ public class TaskDispatchFailedQueueConsumer extends BaseDaemonThread {
...
@@ -94,7 +93,7 @@ public class TaskDispatchFailedQueueConsumer extends BaseDaemonThread {
public
void
run
()
{
public
void
run
()
{
while
(
Stopper
.
isRunning
())
{
while
(
Stopper
.
isRunning
())
{
try
{
try
{
failedRetry
(
);
dispatchFailedBackToTaskPriorityQueue
(
masterConfig
.
getDispatchTaskNumber
()
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
TaskMetrics
.
incTaskDispatchError
();
TaskMetrics
.
incTaskDispatchError
();
logger
.
error
(
"failed task retry error"
,
e
);
logger
.
error
(
"failed task retry error"
,
e
);
...
@@ -102,33 +101,31 @@ public class TaskDispatchFailedQueueConsumer extends BaseDaemonThread {
...
@@ -102,33 +101,31 @@ public class TaskDispatchFailedQueueConsumer extends BaseDaemonThread {
}
}
}
}
public
void
failedRetry
()
throws
TaskPriorityQueueException
{
if
(
taskDispatchFailedQueue
.
size
()
>
0
)
{
retryConsumerThreadPoolExecutor
.
submit
(()
->
dispatchFailedBackToTaskPriorityQueue
(
masterConfig
.
getDispatchTaskNumber
()));
}
}
/**
/**
* put the failed dispatch task into the dispatch queue again
* put the failed dispatch task into the dispatch queue again
*/
*/
private
void
dispatchFailedBackToTaskPriorityQueue
(
int
fetchTaskNum
)
{
private
void
dispatchFailedBackToTaskPriorityQueue
(
int
fetchTaskNum
)
{
for
(
int
i
=
0
;
i
<
fetchTaskNum
;
i
++)
{
for
(
int
i
=
0
;
i
<
fetchTaskNum
;
i
++)
{
try
{
try
{
TaskPriority
dispatchFailedTaskPriority
=
taskDispatchFailedQueue
.
poll
(
Constants
.
SLEEP_TIME_MILLIS
,
TimeUnit
.
MILLISECONDS
);
TaskPriority
dispatchFailedTaskPriority
=
taskDispatchFailedQueue
Impl
.
poll
(
Constants
.
SLEEP_TIME_MILLIS
,
TimeUnit
.
MILLISECONDS
);
if
(
Objects
.
isNull
(
dispatchFailedTaskPriority
))
{
if
(
Objects
.
isNull
(
dispatchFailedTaskPriority
))
{
continue
;
continue
;
}
}
retryConsumerThreadPoolExecutor
.
submit
(()
->
{
if
(
canRetry
(
dispatchFailedTaskPriority
))
{
if
(
canRetry
(
dispatchFailedTaskPriority
))
{
dispatchFailedTaskPriority
.
setDispatchFailedRetryTimes
(
dispatchFailedTaskPriority
.
getDispatchFailedRetryTimes
()
+
1
);
dispatchFailedTaskPriority
.
setDispatchFailedRetryTimes
(
dispatchFailedTaskPriority
.
getDispatchFailedRetryTimes
()
+
1
);
taskPriorityQueue
.
put
(
dispatchFailedTaskPriority
);
taskPriorityQueueImpl
.
put
(
dispatchFailedTaskPriority
);
}
else
{
}
else
{
taskDispatchFailedQueue
.
put
(
dispatchFailedTaskPriority
);
taskDispatchFailedQueueImpl
.
put
(
dispatchFailedTaskPriority
);
}
}
});
}
catch
(
InterruptedException
exception
)
{
}
catch
(
InterruptedException
exception
)
{
logger
.
error
(
"dispatch failed queue poll error"
,
exception
);
logger
.
error
(
"dispatch failed queue poll error"
,
exception
);
Thread
.
currentThread
().
interrupt
();
Thread
.
currentThread
().
interrupt
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"dispatch failed back to task priority queue error"
,
e
);
logger
.
error
(
"dispatch failed back to task priority queue error"
,
e
);
}
finally
{
ThreadUtils
.
sleep
(
Constants
.
SLEEP_TIME_MILLIS
);
}
}
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录