This is an automated email from the ASF dual-hosted git repository.
wuyi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 20de5e7f2bdb [SPARK-54884][CORE][TESTS] Remove private function
`totalRunningTasksPerResourceProfile` from `ExecutorAllocationManager`
20de5e7f2bdb is described below
commit 20de5e7f2bdb10f4ea89d02399b21d1138ebf97a
Author: yangjie01 <[email protected]>
AuthorDate: Mon Jan 5 11:57:26 2026 +0800
[SPARK-54884][CORE][TESTS] Remove private function
`totalRunningTasksPerResourceProfile` from `ExecutorAllocationManager`
### What changes were proposed in this pull request?
This pr removes the private function `totalRunningTasksPerResourceProfile`
from `ExecutorAllocationManager` and refactors `ExecutorAllocationManagerSuite`
so that it no longer relies on this private function, which was solely used for
testing purposes.
### Why are the changes needed?
Code cleanup.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Pass Github Actions
### Was this patch authored or co-authored using generative AI tooling?
No
Closes #53662 from LuciferYang/remove-totalRunningTasksPerResourceProfile.
Authored-by: yangjie01 <[email protected]>
Signed-off-by: Yi Wu <[email protected]>
---
.../main/scala/org/apache/spark/ExecutorAllocationManager.scala | 6 ------
.../scala/org/apache/spark/ExecutorAllocationManagerSuite.scala | 9 ++++-----
2 files changed, 4 insertions(+), 11 deletions(-)
diff --git
a/core/src/main/scala/org/apache/spark/ExecutorAllocationManager.scala
b/core/src/main/scala/org/apache/spark/ExecutorAllocationManager.scala
index 16ec7689d526..57f2d21bc7b7 100644
--- a/core/src/main/scala/org/apache/spark/ExecutorAllocationManager.scala
+++ b/core/src/main/scala/org/apache/spark/ExecutorAllocationManager.scala
@@ -329,12 +329,6 @@ private[spark] class ExecutorAllocationManager(
}
}
- // Please do not delete this function, the tests in
`ExecutorAllocationManagerSuite`
- // need to access `listener.totalRunningTasksPerResourceProfile` with
`synchronized`.
- private def totalRunningTasksPerResourceProfile(id: Int): Int = synchronized
{
- listener.totalRunningTasksPerResourceProfile(id)
- }
-
/**
* This is called at a fixed interval to regulate the number of pending
executor requests
* and number of executors running.
diff --git
a/core/src/test/scala/org/apache/spark/ExecutorAllocationManagerSuite.scala
b/core/src/test/scala/org/apache/spark/ExecutorAllocationManagerSuite.scala
index 8644608edee3..0872d39df535 100644
--- a/core/src/test/scala/org/apache/spark/ExecutorAllocationManagerSuite.scala
+++ b/core/src/test/scala/org/apache/spark/ExecutorAllocationManagerSuite.scala
@@ -1924,8 +1924,6 @@ private object ExecutorAllocationManagerSuite extends
PrivateMethodTester {
PrivateMethod[mutable.HashMap[Int,
Int]](Symbol("numLocalityAwareTasksPerResourceProfileId"))
private val _rpIdToHostToLocalTaskCount =
PrivateMethod[Map[Int, Map[String,
Int]]](Symbol("rpIdToHostToLocalTaskCount"))
- private val _totalRunningTasksPerResourceProfile =
- PrivateMethod[Int](Symbol("totalRunningTasksPerResourceProfile"))
private val defaultProfile = ResourceProfile.getOrCreateDefaultProfile(new
SparkConf)
@@ -2022,9 +2020,10 @@ private object ExecutorAllocationManagerSuite extends
PrivateMethodTester {
localMap(defaultProfile.id)
}
- private def totalRunningTasksPerResourceProfile(manager:
ExecutorAllocationManager): Int = {
- manager invokePrivate
_totalRunningTasksPerResourceProfile(defaultProfile.id)
- }
+ private def totalRunningTasksPerResourceProfile(manager:
ExecutorAllocationManager): Int =
+ manager.synchronized {
+ manager.listener.totalRunningTasksPerResourceProfile(defaultProfile.id)
+ }
private def hostToLocalTaskCount(
manager: ExecutorAllocationManager): Map[String, Int] = {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]