ivoson commented on code in PR #37268:
URL: https://github.com/apache/spark/pull/37268#discussion_r964837569


##########
core/src/main/scala/org/apache/spark/resource/ResourceProfile.scala:
##########
@@ -253,6 +263,38 @@ class ResourceProfile(
   }
 }
 
+/**
+ * Resource profile which only contains task resources, can be used for stage 
level task schedule
+ * when dynamic allocation is disabled, tasks will be scheduled to executors 
with default resource
+ * profile based on task resources described by this task resource profile.
+ * And when dynamic allocation is enabled, will require new executors for this 
profile base on
+ * default build-in executor resources and assign tasks by resource profile id.
+ *
+ * @param taskResources Resource requests for tasks. Mapped from the resource
+ *                      name (e.g., cores, memory, CPU) to its specific 
request.
+ */
+@Evolving
+@Since("3.4.0")
+class TaskResourceProfile (
+    override val taskResources: Map[String, TaskResourceRequest])
+  extends ResourceProfile(Map.empty, taskResources) {
+
+  override protected[spark] def getCustomExecutorResources():
+      Map[String, ExecutorResourceRequest] = {
+    if (SparkEnv.get == null) {
+      throw new IllegalStateException("SparkEnv should not be empty.")
+    }
+    val sparkConf = SparkEnv.get.conf
+
+    if (!Utils.isDynamicAllocationEnabled(sparkConf)) {
+      ResourceProfile.getOrCreateDefaultProfile(sparkConf)
+        .getCustomExecutorResources()
+    } else {
+      super.getCustomExecutorResources()

Review Comment:
   Yes, it is. And that's for compatibility when dynamic allocation is enabled.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to