dolphinscheduler icon indicating copy to clipboard operation
dolphinscheduler copied to clipboard

When the master&worker is deployed on the same machine, if the master&worker service is restarted, the previously scheduled tasks cannot be scheduled.(master&worker部署在同一台机器上时,如果重启master&worker服务,会导致之前调度的任务无法继续调度)

Open sunnyingit opened this issue 7 years ago • 10 comments

Problem recurrence: When the master&worker is deployed on the same machine, if the master&worker service is restarted, the tasks in the previously run workflow instance will not be rescheduled and the task status cannot be changed.

From the UI, although the task is still running, the task process has actually been hung, because the task state cannot be modified, so it is always in the state before the restart (running). This is very confusing.

Recommendation: Capture the kill signal before stopping the master&worker service. Make a snapshot of the current running state before stopping the service (probably related to the status of the task database and zk)

Then when the service is restarted, the snapshot is first checked, and if so, the tasks in the snapshot are restored.


问题重现: master&worker部署在同一台机器上时,如果重启master&worker服务,之前运行的工作流实例中的任务都不会被重新调度,且任务状态无法改变。

从UI上看,虽然任务还是处于运行状态,但实际上任务进程已经挂了,因为任务状态无法修改,所以一直处于重启之前的状态(运行中)。这点很有迷惑性。

建议:在停止master&worker服务前,捕获kill信号,在停止服务之前,给当前的运行状态做一个快照(可能是涉及到任务数据库和zk之类的状态保持)

然后在重启服务时,首先检查快照,如果有则恢复快照中的任务。

sunnyingit avatar May 29 '19 03:05 sunnyingit

very good issue, thanks for your advice!

we will fix it in next version 1.1.0!

davidzollo avatar May 29 '19 07:05 davidzollo

Excuse me, if, before restarting, set all the tasks in the execution state to failure, then after the restart, es will retry all the failed tasks, so that all the tasks before the restart in disguise, this solution can solve this problem?


请问下,如果,在重启之前,把所有正在执行的任务状态全部设置为失败, 那重启之后,es会重试所有失败的任务,这样变相重启之前所有的任务, 这个方案是可以解决这个问题?

sunnyingit avatar Jun 04 '19 04:06 sunnyingit

The master monitors the master service and the worker service, so as long as the master survives normally, the worker node can be missed.   But for the case where the single master does not survive normally:   1, the master is older than the worker   Master is only the monitoring of the process instance, after the worker is dropped, because the master has been lost, can not take the master to the staff fault-tolerant   So if the task is always in the running state after the worker is dropped, then the master restarts and the master is fault-tolerant, and the process is monitored.   However, the worker monitoring thread has been dropped and the task status is not updated. So the process is gone.   2, worker startup needs self-confidence (need to join)   When the worker starts, it needs to judge whether the running task on all the down worker nodes needs to be judged whether it has been run or not.   The required state is set to success. For the running (yarn) job, it needs to be killed, the modified state is fault tolerant, and the task is resubmitted.


master监控master服务和worker服务,所以只要master正常存活,worker节点掉是可以容错过来的。 但是对于单master不正常存活的情况下: 1,master掉的比worker早的情况 master掉只是流程实例的监控掉了,worker掉了之后,因为master已经掉了,不能走master对worker容错了 所以如果worker掉之后task一直处于running状态,那master重新启动之后走master自容错,流程被监控起来了, 但是worker监控线程已经掉了,task状态不会更新。所以流程也就废了 2,worker启动需要自容错(需要加入) worker启动的时候,需要把所有down的worker节点上正在运行的任务需要判断是否已经运行完,对已经运行完的 需要状态置成成功,对于正在运行的(yarn)作业需要kill掉,修改状态为容错,任务进行重新提交

qiaozhanwei avatar Jun 04 '19 05:06 qiaozhanwei

Under the premise that the worker startup has not been added to the fault, after the restart of the service (master, worker), is it possible to reschedule the unfinished tasks before the restart?


在worker启动还没有加入自容错的前提下,服务(master, worker)重启之后,是否可以做到把重启之前未完成的任务重新调度一遍?

sunnyingit avatar Jun 04 '19 05:06 sunnyingit

Similar to: 1 After the master restarts, scan the database, find an incomplete workflow instance, and then start scheduling again. 2 master assigns unfinished tasks to workers


类似于: 1 master重启后,扫描一下数据库,发现有未完成的工作流实例,然后重新开始调度 2 master把未完成的任务分配给worker

sunnyingit avatar Jun 04 '19 05:06 sunnyingit

Master self-fault can also be used to run the task task, but 1, when the master starts, there is already fault tolerance of the process, and it is in the zk distributed lock. If the worker task is fault-tolerant, it may be time consuming, and the startup of other masters is blocked. 2, our design philosophy is that the master does not modify the task state as much as possible, just monitor the task state, the worker changes the task state 3, the master does the task task startup task fault tolerance, if there is no worker state, in fact, still can not work


master自容错也是可以做容正在运行的task任务的,但是 1,master启动的时候已经有流程的容错,而且是在zk分布式锁中的,如果再加入worker task容错,可能会很耗时,对其他master的启动是阻塞的 2,我们的设计理念是master尽量不修改task状态,只是监控task状态,worker修改task状态 3,master做启动task running任务容错,如果没有一个worker的状态情况下,其实还是不能工作

qiaozhanwei avatar Jun 04 '19 05:06 qiaozhanwei

Still do not quite understand what you mean, I understand the task scheduling process like this:

  1. Create a workflow Click "Start" operation
  2. Master starts scheduling this task (do DAG division)
  3. master assigns the task to the worker and creates the task zk node
  4. The worker starts executing the task and updates the task status, then deletes the task zk node If you can use a script to trigger a failed task "start" operation, can you perform steps 1-4? This does not need to modify the master & worker code to achieve results?

还是不太明白你的意思,我理解任务的调度流程这样:

  1. 创建一个工作流 点击“启动”操作 2)master开始调度这个任务(做DAG划分) 3) master把任务分配给worker,同时创建任务zk节点 4) worker开始执行任务,并更新任务状态,然后删除任务zk节点 如果可以用脚本触发失败的任务“启动”操作,是否可以执行1-4步骤? 这样不需要修改 master & worker的代码就可以达到效果?

sunnyingit avatar Jun 04 '19 06:06 sunnyingit

If this is done, before the restart, we use the script to modify the database workflow state, set the workflow state to failure, after the service starts, use the script to traverse all the failed tasks, and then use the script to simulate the "start" operation, to achieve The effect of rescheduled tasks


如果这样做成立的话,在重启之前,我们用脚本修改数据库工作流状态,把工作流的状态设置为失败,服务启动后,在使用脚本遍历所有失败任务,然后用脚本 模拟“启动”操作,达到重新调度的任务的效果

sunnyingit avatar Jun 04 '19 06:06 sunnyingit

  1. Wait for the master to start before the worker starts.
  2. After the master starts, it executes the process and task fault tolerance mechanism.

image


  1. worker启动之前先等待master启动。
  2. master启动以后执行流程和任务容错机制。

image

lenboo avatar Jun 05 '19 02:06 lenboo

the final solution...

image

lenboo avatar Jul 01 '19 07:07 lenboo