Skip to content
Snippets Groups Projects
Commit 62c55760 authored by Thomas Graves's avatar Thomas Graves
Browse files

[SPARK-3375] spark on yarn container allocation issues

If yarn doesn't get the containers immediately it stops asking for them and the yarn application hangs with never getting any executors.

The issue here is that we are sending the number of containers as 0 after we send the original one of X. on the yarn side this clears out the original request.

For a ping we should just send empty asks.

Author: Thomas Graves <tgraves@apache.org>

Closes #2275 from tgravescs/SPARK-3375 and squashes the following commits:

74b6820 [Thomas Graves] send empty resource requests when we aren't asking for containers
parent 51b53a75
No related branches found
No related tags found
No related merge requests found
...@@ -51,12 +51,13 @@ private[yarn] class YarnAllocationHandler( ...@@ -51,12 +51,13 @@ private[yarn] class YarnAllocationHandler(
override protected def allocateContainers(count: Int): YarnAllocateResponse = { override protected def allocateContainers(count: Int): YarnAllocateResponse = {
var resourceRequests: List[ResourceRequest] = null var resourceRequests: List[ResourceRequest] = null
// default. logDebug("numExecutors: " + count)
if (count <= 0 || preferredHostToCount.isEmpty) { if (count <= 0) {
logDebug("numExecutors: " + count + ", host preferences: " + resourceRequests = List()
preferredHostToCount.isEmpty) } else if (preferredHostToCount.isEmpty) {
resourceRequests = List(createResourceRequest( logDebug("host preferences is empty")
AllocationType.ANY, null, count, YarnSparkHadoopUtil.RM_REQUEST_PRIORITY)) resourceRequests = List(createResourceRequest(
AllocationType.ANY, null, count, YarnSparkHadoopUtil.RM_REQUEST_PRIORITY))
} else { } else {
// request for all hosts in preferred nodes and for numExecutors - // request for all hosts in preferred nodes and for numExecutors -
// candidates.size, request by default allocation policy. // candidates.size, request by default allocation policy.
......
...@@ -88,9 +88,11 @@ private[yarn] class YarnAllocationHandler( ...@@ -88,9 +88,11 @@ private[yarn] class YarnAllocationHandler(
private def addResourceRequests(numExecutors: Int) { private def addResourceRequests(numExecutors: Int) {
val containerRequests: List[ContainerRequest] = val containerRequests: List[ContainerRequest] =
if (numExecutors <= 0 || preferredHostToCount.isEmpty) { if (numExecutors <= 0) {
logDebug("numExecutors: " + numExecutors + ", host preferences: " + logDebug("numExecutors: " + numExecutors)
preferredHostToCount.isEmpty) List()
} else if (preferredHostToCount.isEmpty) {
logDebug("host preferences is empty")
createResourceRequests( createResourceRequests(
AllocationType.ANY, AllocationType.ANY,
resource = null, resource = null,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment