dolphinscheduler icon indicating copy to clipboard operation
dolphinscheduler copied to clipboard

[Feature] [API] cannot kill task submitted on yarn with when I stop PySpark task with --deploy-mode cluster manually on Web UI

Open Meggie4 opened this issue 4 years ago • 5 comments

Search before asking

  • [X] I had searched in the issues and found no similar issues.

What happened

when I kill spark task with --deploy-mode client, I can see process instace stopped, and task submitted on yarn is also stopped; but when I kill spark task with --deploy-mode cluster , and I can see process instace stopped, but task submitted on yarn is still running;

What you expected to happen

task(with --deploy-mode cluster) submitted on yarn is killed

How to reproduce

create pyspark task and stop the process instance, and check application on hadoop web;

Anything else

No response

Version

2.0.1

Are you willing to submit PR?

  • [X] Yes I am willing to submit a PR!

Code of Conduct

Meggie4 avatar Feb 16 '22 08:02 Meggie4

Hi:

  • Thank you for your feedback, we have received your issue, Please wait patiently for a reply.
  • In order for us to understand your request as soon as possible, please provide detailed information、version or pictures.
  • If you haven't received a reply for a long time, you can subscribe to the developer's email,Mail subscription steps reference https://dolphinscheduler.apache.org/en-us/community/development/subscribe.html ,Then write the issue URL in the email content and send question to [email protected].

github-actions[bot] avatar Feb 16 '22 08:02 github-actions[bot]

I think is not a bug with dolphinscheduler. Is this spark task submitted using the shell script? Killing the shell process does not kill the spark task in cluster deploy mode. This is the working mechanism of spark itself

ronyang1985 avatar Feb 16 '22 15:02 ronyang1985

@Meggie4 FYI https://spark.apache.org/docs/latest/running-on-yarn.html image

ronyang1985 avatar Feb 17 '22 12:02 ronyang1985

@Meggie4 FYI https://spark.apache.org/docs/latest/running-on-yarn.html image

thanks for your reply! As I can see, DolphinScheduler start a pyspark task with shell script, and kill the task with kill the shell process;

I think DolphinScheduler should using command like "yarn application -kill application_1589533772041_777" to kill task submitted on yarn; image

Meggie4 avatar Feb 18 '22 03:02 Meggie4

@Meggie4 I studied the code of ds, when the task is stopped with Exception , or when stopped manual operation , it will try to kill the yarn job. The yarn appid is found through logs. yarn job will not be killed if yarn appid is not displayed normally in logs.The related implementations are in these two classes

https://github.com/apache/dolphinscheduler/blob/6974aa3d12501a6c8a47528da7d2d6a09a6fa4ae/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskExecuteThread.java#L194

https://github.com/apache/dolphinscheduler/blob/6974aa3d12501a6c8a47528da7d2d6a09a6fa4ae/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessor.java#L138

ronyang1985 avatar Feb 23 '22 12:02 ronyang1985