dongjoon-hyun commented on a change in pull request #27367: [SPARK-30638][CORE] 
Add resources allocated to PluginContext
URL: https://github.com/apache/spark/pull/27367#discussion_r373289216
 
 

 ##########
 File path: 
core/src/main/scala/org/apache/spark/internal/plugin/PluginContainer.scala
 ##########
 @@ -133,17 +140,27 @@ object PluginContainer {
 
   val EXTRA_CONF_PREFIX = "spark.plugins.internal.conf."
 
-  def apply(sc: SparkContext): Option[PluginContainer] = 
PluginContainer(Left(sc))
+  def apply(
+      sc: SparkContext,
+      resources: java.util.Map[String, ResourceInformation]
+  ): Option[PluginContainer] = PluginContainer(Left(sc), resources)
 
-  def apply(env: SparkEnv): Option[PluginContainer] = 
PluginContainer(Right(env))
+  def apply(
+      env: SparkEnv,
+      resources: java.util.Map[String, ResourceInformation]
+  ): Option[PluginContainer] = PluginContainer(Right(env), resources)
 
-  private def apply(ctx: Either[SparkContext, SparkEnv]): 
Option[PluginContainer] = {
+  private def apply(
+      ctx: Either[SparkContext, SparkEnv],
+      resources: java.util.Map[String, ResourceInformation]
+  ): Option[PluginContainer] = {
     val conf = ctx.fold(_.conf, _.conf)
     val plugins = Utils.loadExtensions(classOf[SparkPlugin], 
conf.get(PLUGINS).distinct, conf)
     if (plugins.nonEmpty) {
       ctx match {
-        case Left(sc) => Some(new DriverPluginContainer(sc, plugins))
-        case Right(env) => Some(new ExecutorPluginContainer(env, plugins))
+        case Left(sc) => Some(new DriverPluginContainer(sc, resources, 
plugins))
+        case Right(env) =>
+          Some(new ExecutorPluginContainer(env, resources, plugins))
 
 Review comment:
   Shall we make this one-liner?
   ```scala
   case Right(env) => Some(new ExecutorPluginContainer(env, resources, plugins))
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

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

Reply via email to