You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/10/31 18:50:24 UTC

[GitHub] [spark] squito commented on a change in pull request #26284: [SPARK-29415][Core]Stage Level Sched: Add base ResourceProfile and Request classes

squito commented on a change in pull request #26284: [SPARK-29415][Core]Stage Level Sched: Add base ResourceProfile and Request classes
URL: https://github.com/apache/spark/pull/26284#discussion_r341308773
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/resource/ResourceProfile.scala
 ##########
 @@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.resource
+
+import java.util.{Map => JMap}
+import java.util.concurrent.atomic.{AtomicInteger, AtomicReference}
+
+import scala.collection.JavaConverters._
+import scala.collection.immutable.HashMap
+import scala.collection.mutable
+
+import org.apache.spark.SparkConf
+import org.apache.spark.annotation.Evolving
+import org.apache.spark.internal.Logging
+import org.apache.spark.internal.config._
+import org.apache.spark.resource.ResourceUtils.{RESOURCE_DOT, RESOURCE_PREFIX}
+
+/**
+ * Resource profile to associate with an RDD. A ResourceProfile allows the user to
+ * specify executor and task requirements for an RDD that will get applied during a
+ * stage. This allows the user to change the resource requirements between stages.
+ *
+ * Only support a subset of the resources for now. The config names supported correspond to the
+ * regular Spark configs with the prefix removed. For instance overhead memory in this api
+ * is memoryOverhead, which is spark.executor.memoryOverhead with spark.executor removed.
+ * Resources like GPUs are resource.gpu (spark configs spark.executor.resource.gpu.*)
+ *
+ * Executor:
+ *   memory - heap
+ *   memoryOverhead
+ *   pyspark.memory
+ *   cores
+ *   resource.[resourceName] - GPU, FPGA, etc
+ *
+ * Task requirements:
+ *   cpus
+ *   resource.[resourceName] - GPU, FPGA, etc
+ *
+ * This class is private now for initial development, once we have the feature in place
+ * this will become public.
+ */
+@Evolving
+private[spark] class ResourceProfile() extends Serializable {
+
+  private val _id = ResourceProfile.getNextProfileId
+  private val _taskResources = new mutable.HashMap[String, TaskResourceRequest]()
+  private val _executorResources = new mutable.HashMap[String, ExecutorResourceRequest]()
+
+  private val allowedExecutorResources = HashMap[String, Boolean](
+    (ResourceProfile.MEMORY -> true),
+    (ResourceProfile.OVERHEAD_MEM -> true),
+    (ResourceProfile.PYSPARK_MEM -> true),
+    (ResourceProfile.CORES -> true))
+
+  private val allowedTaskResources = HashMap[String, Boolean]((
 
 Review comment:
   should `allowedExecutorResources` and `allowedTaskResources` just be a `HashSet`?  Meaning of the value isn't clear, you only check for existence of the key.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org