On task failure catch some CUDA exceptions and kill executor [databricks] #5118
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to #5029. This is shorter term solution to just parse the exception message to catch certain types of unrecoverable CUDA errors. It may not be bullet proof as the messages could change.
Here if we find an exception that we think is unrecoverable we system.exit to kill the executor.
Generally you would want to use this with the Spark excludeOnFailure functionality so it doesn't start the executor back up using the same GPU.
I've manually tested this by faking the exception occurring since we can't reproduce it. It properly kills the executor when it sees the exception.
Sample code used to cause failures:
this generates exceptions like:
This new executor plugin code catches and logs the following and then exits:
22/03/31 22:46:57 ERROR RapidsExecutorPlugin: Stopping the Executor based on exception being a fatal CUDA error: java.lang.RuntimeException: CUDA error encountered: cudaErrorHardwareStackError
In standalone mode with the excludeOnFailure spark configs set to 1 for the node exclusion, it when the task fails and this kills the executor, the node with be excluded and the worker will not be able to restart an executor on that node. Also note keep in mind the spark config spark.excludeOnFailure.timeout which will try spark to retry that node after the timeout value.
Without excludeonFailure, the executors just get restarted on the same nodes for standalone mode. I tested on yarn as well and there it will restart executors but it could be on different nodes depending on the size of the cluster.