
点击蓝字,关注我们
1
简述
Master主要负责是流程DAG的切分,最终通过RPC将任务分发到Worker节点上以及Worker上任务状态的处理 Worker主要负责是真正任务的执行,最后将任务状态汇报给Master,Master进行状态处理
Master掉了怎么办?它是负责流程实例的管理的。这样Worker就没有办法给它汇报任务状态,当然它也不能做状态处理了? Worker掉了又怎么办?要知道Worker是真正任务执行的载体,它如果掉了。Master要怎么处理?
2
容错

3
总结
private void killYarnTask(TaskInstance taskInstance, ProcessInstance processInstance) {
try {
if (!masterConfig.isKillApplicationWhenTaskFailover()) {
return;
}
if (StringUtils.isEmpty(taskInstance.getHost()) || StringUtils.isEmpty(taskInstance.getLogPath())) {
return;
}
TaskExecutionContext taskExecutionContext = TaskExecutionContextBuilder.get()
.buildWorkflowInstanceHost(masterConfig.getMasterAddress())
.buildTaskInstanceRelatedInfo(taskInstance)
.buildProcessInstanceRelatedInfo(processInstance)
.buildProcessDefinitionRelatedInfo(processInstance.getProcessDefinition())
.create();
only kill yarn/k8s job if exists , the local thread has exited
log.info("TaskInstance failover begin kill the task related yarn or k8s job");
ILogService iLogService =
SingletonJdkDynamicRpcClientProxyFactory.getProxyClient(taskInstance.getHost(), ILogService.class);
GetAppIdResponse getAppIdResponse =
iLogService.getAppId(new GetAppIdRequest(taskInstance.getId(), taskInstance.getLogPath()));
ProcessUtils.killApplication(getAppIdResponse.getAppIds(), taskExecutionContext);
} catch (Exception ex) {
log.error("Kill yarn task error", ex);
}
}
Master上kill,使用yarn rest api
curl -X PUT -d '{"state":"KILLED"}' \
-H "Content-Type: application/json" \
http://xx.xx.xx.xx:8088/ws/v1/cluster/apps/application_1694766249884_1098/state?user.name=hdfs
Worker上kill
这个是需要标识该任务是容错任务,然后在任务重试运行的时候,调度到指定的Worker上。需要先kill当前运行的applicationId,然后再任务重试。其实这里有一个优化点就是,是Worker掉了,但是任务还在,所以需要判断的是yarn上的状态,如果异常,再kill也不迟,而不是上来就kill。如果是RUNNING,等待就好,可以设置等待超时时间。
参与Apache DolphinScheduler 社区有非常多的参与贡献的方式,包括:

文章转载自海豚调度,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




