Skip to content

Commit a98bd20

Browse files
committed
Andrew's comments
1 parent cdaab7f commit a98bd20

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

yarn/src/main/scala/org/apache/spark/deploy/yarn/YarnAllocator.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,18 @@ private[yarn] class YarnAllocator(
213213
amClient.addContainerRequest(request)
214214
val nodes = request.getNodes
215215
val hostStr = if (nodes == null || nodes.isEmpty) "Any" else nodes.last
216-
logInfo("Container request (host: %s, capability: %s)".format(hostStr, resource))
216+
logInfo(s"Container request (host: $hostStr, capability: $resource)")
217217
}
218218
} else if (missing < 0) {
219219
val numToCancel = math.min(numPendingAllocate, -missing)
220-
logInfo(s"Canceling requests for ${numToCancel} executor containers")
220+
logInfo(s"Canceling requests for $numToCancel executor containers")
221221

222222
val matchingRequests = amClient.getMatchingRequests(RM_REQUEST_PRIORITY, ANY_HOST, resource)
223-
matchingRequests.head.take(numToCancel).foreach(amClient.removeContainerRequest(_))
223+
if (!matchingRequests.isEmpty) {
224+
matchingRequests.head.take(numToCancel).foreach(amClient.removeContainerRequest)
225+
} else {
226+
logWarning("Expected to find pending requests, but found none.")
227+
}
224228
}
225229
}
226230

0 commit comments

Comments
 (0)