Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ private[spark] class ResourceProfileManager(sparkConf: SparkConf,
(lock.readLock(), lock.writeLock())
}

private val defaultProfile = ResourceProfile.getOrCreateDefaultProfile(sparkConf)
addResourceProfile(defaultProfile)

def defaultResourceProfile: ResourceProfile = defaultProfile

private val dynamicEnabled = Utils.isDynamicAllocationEnabled(sparkConf)
private val master = sparkConf.getOption("spark.master")
private val isYarn = master.isDefined && master.get.equals("yarn")
Expand All @@ -60,12 +55,18 @@ private[spark] class ResourceProfileManager(sparkConf: SparkConf,
private val notRunningUnitTests = !isTesting
private val testExceptionThrown = sparkConf.get(RESOURCE_PROFILE_MANAGER_TESTING)

private val defaultProfile = ResourceProfile.getOrCreateDefaultProfile(sparkConf)
addResourceProfile(defaultProfile)

def defaultResourceProfile: ResourceProfile = defaultProfile

/**
* If we use anything except the default profile, it's supported on YARN, Kubernetes and
* Standalone with dynamic allocation enabled, and task resource profile with dynamic allocation
* disabled on Standalone. Throw an exception if not supported.
*/
private[spark] def isSupported(rp: ResourceProfile): Boolean = {
assert(master != null)
if (rp.isInstanceOf[TaskResourceProfile] && !dynamicEnabled) {
if ((notRunningUnitTests || testExceptionThrown) &&
!(isStandaloneOrLocalCluster || isYarn || isK8s)) {
Expand Down