Github user rdblue commented on a diff in the pull request:
https://github.com/apache/spark/pull/13482#discussion_r66713080
--- Diff:
yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala ---
@@ -462,10 +464,23 @@ private[spark] class ApplicationMaster(
nextAllocationInterval = initialAllocationInterval
heartbeatInterval
}
- logDebug(s"Number of pending allocations is
$numPendingAllocate. " +
- s"Sleeping for $sleepInterval.")
+ sleepStart = System.currentTimeMillis()
allocatorLock.wait(sleepInterval)
}
+ val sleepDuration = System.currentTimeMillis() - sleepStart
+ if (sleepDuration < sleepInterval - 5) {
--- End diff --
If the sleep would be for less than 5ms, then I thought that was close
enough to not go back to sleep and have a context switch. I'm fine without it,
but I think it's reasonable to to have a minimum time to go back to sleep for.
The problem with using `allocatorLock.wait` is that the thread can be
signalled and interrupt sleep. That's a good idea if the `sleepInterval` is
3000 ms, but if we want to ensure a minimum amount of time, then the second
sleep should not be interrupted by signalling the `allocatorLock`, which is why
`Thread.sleep` is used instead.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]