tgravescs commented on a change in pull request #26682: [SPARK-29306][CORE]
Stage Level Sched: Executors need to track what ResourceProfile they are
created with
URL: https://github.com/apache/spark/pull/26682#discussion_r364761914
##########
File path:
core/src/main/scala/org/apache/spark/scheduler/dynalloc/ExecutorMonitor.scala
##########
@@ -392,8 +414,27 @@ private[spark] class ExecutorMonitor(
* which the `SparkListenerTaskStart` event is posted before the
`SparkListenerBlockManagerAdded`
* event, which is possible because these events are posted in different
threads. (see SPARK-4951)
*/
- private def ensureExecutorIsTracked(id: String): Tracker = {
- executors.computeIfAbsent(id, _ => new Tracker())
+ private def ensureExecutorIsTracked(id: String, resourceProfileId: Int):
Tracker = {
+ val numExecsWithRpId =
execResourceProfileCount.computeIfAbsent(resourceProfileId, _ => 0)
+ val execTracker = executors.computeIfAbsent(id, _ => {
+ val newcount = numExecsWithRpId + 1
+ execResourceProfileCount.put(resourceProfileId, newcount)
+ logDebug(s"Executor added with ResourceProfile id: $resourceProfileId
" +
+ s"count is now $newcount")
+ new Tracker(resourceProfileId)
+ })
+ // if we had added executor before without knowing the resource profile
id, fix it up
+ if (execTracker.resourceProfileId == UNKNOWN_RESOURCE_PROFILE_ID &&
+ resourceProfileId != UNKNOWN_RESOURCE_PROFILE_ID) {
+ logDebug(s"Executor: $id, resource profile id was unknown, setting " +
+ s"it to $resourceProfileId")
+ execTracker.resourceProfileId = resourceProfileId
+ // fix up the counts for each resource profile id
+ execResourceProfileCount.put(resourceProfileId, numExecsWithRpId + 1)
+ val unknownCount =
execResourceProfileCount.get(UNKNOWN_RESOURCE_PROFILE_ID)
+ execResourceProfileCount.put(UNKNOWN_RESOURCE_PROFILE_ID, unknownCount -
1)
Review comment:
yep I'll add
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]