sarutak commented on a change in pull request #33121:
URL: https://github.com/apache/spark/pull/33121#discussion_r660273233



##########
File path: project/SparkBuild.scala
##########
@@ -413,6 +413,9 @@ object SparkBuild extends PomBuild {
 
   enable(KubernetesIntegrationTests.settings)(kubernetesIntegrationTests)
 
+  if (profiles.contains("hadoop-provided")) {
+    sys.props("spark.yarn.isHadoopProvided") = "true"
+  }

Review comment:
       `profiles` cannot be referred from `YARN` but I found another better way.

##########
File path: project/SparkBuild.scala
##########
@@ -802,11 +805,29 @@ object Hive {
 }
 
 object YARN {
+  val genConfigProperties = TaskKey[Unit]("gen-config-properties",
+    "Generate config.properties which contains a setting whether Hadoop is 
provided or not")
+  val propFileName = "config.properties"
+
   lazy val settings = Seq(
     excludeDependencies --= Seq(
       ExclusionRule(organization = "com.sun.jersey"),
       ExclusionRule("javax.servlet", "javax.servlet-api"),
-      ExclusionRule("javax.ws.rs", "jsr311-api"))
+      ExclusionRule("javax.ws.rs", "jsr311-api")),
+      Compile / unmanagedResources :=
+        (Compile / 
unmanagedResources).value.filter(!_.getName.endsWith(s"$propFileName")),
+      genConfigProperties := {
+        val file = (Compile / classDirectory).value / 
s"org/apache/spark/deploy/yarn/$propFileName"
+        val isHadoopProvided = 
sys.props.getOrElse("spark.yarn.isHadoopProvided", "false")
+        IO.write(file, s"spark.yarn.isHadoopProvided = $isHadoopProvided")
+      },
+      (Compile / copyResources) := (Def.taskDyn {
+        val c = (Compile / copyResources).value
+          Def.task {

Review comment:
       Oh, I was confused because `Seq` is nested... Thanks.

##########
File path: project/SparkBuild.scala
##########
@@ -802,11 +805,29 @@ object Hive {
 }
 
 object YARN {
+  val genConfigProperties = TaskKey[Unit]("gen-config-properties",
+    "Generate config.properties which contains a setting whether Hadoop is 
provided or not")
+  val propFileName = "config.properties"
+
   lazy val settings = Seq(
     excludeDependencies --= Seq(
       ExclusionRule(organization = "com.sun.jersey"),
       ExclusionRule("javax.servlet", "javax.servlet-api"),
-      ExclusionRule("javax.ws.rs", "jsr311-api"))
+      ExclusionRule("javax.ws.rs", "jsr311-api")),
+      Compile / unmanagedResources :=

Review comment:
       Oh, I was confused because `Seq` is nested... Thanks.

##########
File path: project/SparkBuild.scala
##########
@@ -413,6 +413,9 @@ object SparkBuild extends PomBuild {
 
   enable(KubernetesIntegrationTests.settings)(kubernetesIntegrationTests)
 
+  if (profiles.contains("hadoop-provided")) {
+    sys.props("spark.yarn.isHadoopProvided") = "true"
+  }

Review comment:
       Thanks, I found another better way rather than manually do 
`sys.props("spark.yarn.isHadoopProvided") = "true"`.

##########
File path: project/SparkBuild.scala
##########
@@ -802,11 +802,30 @@ object Hive {
 }
 
 object YARN {
+  val genConfigProperties = TaskKey[Unit]("gen-config-properties",
+    "Generate config.properties which contains a setting whether Hadoop is 
provided or not")
+  val propFileName = "config.properties"
+  val hadoopProvidedProp = "spark.yarn.isHadoopProvided"
+
   lazy val settings = Seq(
     excludeDependencies --= Seq(
       ExclusionRule(organization = "com.sun.jersey"),
       ExclusionRule("javax.servlet", "javax.servlet-api"),
-      ExclusionRule("javax.ws.rs", "jsr311-api"))
+      ExclusionRule("javax.ws.rs", "jsr311-api")),
+    Compile / unmanagedResources :=
+      (Compile / 
unmanagedResources).value.filter(!_.getName.endsWith(s"$propFileName")),
+    genConfigProperties := {
+      val file = (Compile / classDirectory).value / 
s"org/apache/spark/deploy/yarn/$propFileName"
+      val isHadoopProvided = 
SbtPomKeys.effectivePom.value.getProperties.get(hadoopProvidedProp)
+      IO.write(file, s"$hadoopProvidedProp = $isHadoopProvided")
+    },
+    (Compile / copyResources) := (Def.taskDyn {
+      val c = (Compile / copyResources).value
+        Def.task {

Review comment:
       Ah, still mis-intended. I'll fix it.

##########
File path: project/SparkBuild.scala
##########
@@ -802,11 +805,29 @@ object Hive {
 }
 
 object YARN {
+  val genConfigProperties = TaskKey[Unit]("gen-config-properties",
+    "Generate config.properties which contains a setting whether Hadoop is 
provided or not")
+  val propFileName = "config.properties"
+
   lazy val settings = Seq(
     excludeDependencies --= Seq(
       ExclusionRule(organization = "com.sun.jersey"),
       ExclusionRule("javax.servlet", "javax.servlet-api"),
-      ExclusionRule("javax.ws.rs", "jsr311-api"))
+      ExclusionRule("javax.ws.rs", "jsr311-api")),
+      Compile / unmanagedResources :=
+        (Compile / 
unmanagedResources).value.filter(!_.getName.endsWith(s"$propFileName")),
+      genConfigProperties := {
+        val file = (Compile / classDirectory).value / 
s"org/apache/spark/deploy/yarn/$propFileName"
+        val isHadoopProvided = 
sys.props.getOrElse("spark.yarn.isHadoopProvided", "false")
+        IO.write(file, s"spark.yarn.isHadoopProvided = $isHadoopProvided")
+      },
+      (Compile / copyResources) := (Def.taskDyn {
+        val c = (Compile / copyResources).value
+          Def.task {

Review comment:
       Oh, I was confused because `Seq` is nested... Thanks.




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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

Reply via email to