You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by skonto <gi...@git.apache.org> on 2017/07/14 01:47:48 UTC

[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

GitHub user skonto opened a pull request:

    https://github.com/apache/spark/pull/18630

    [SPARK-12559][SPARK SUBMIT] fix --packages for standalone

    ## What changes were proposed in this pull request?
    
    Fixes --packages flag for the standalone mode.
    
    ## How was this patch tested?
    Manually by submitting a driver in cluster mode within a standalone cluster and checking if dependencies were resolved at the driver side.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/skonto/spark fix_packages_stand_alone_cluster

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/18630.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #18630
    
----
commit 81a5deeb2f8d152242f9248f8e5d5c0dd3e1f1ea
Author: Stavros Kontopoulos <st...@gmail.com>
Date:   2017-07-14T01:40:27Z

    fix --packages for standalone

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by jerryshao <gi...@git.apache.org>.
Github user jerryshao commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Are you trying to support `--packages` in standalone cluster? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    @vanzin I dont forgot I didnt see agreement. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132056579
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,97 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(
    +      packages, ivySettings, exclusions = exclusions)
    +
    +    resolvedMavenCoordinates
    +  }
    +
    +  def createTempDir(): File = {
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    +    Runtime.getRuntime.addShutdownHook(new Thread() {
    +      override def run(): Unit = {
    +        FileUtils.deleteQuietly(targetDir)
    +      }
    +    })
    +    targetDir
    +  }
    +
    +  def resolveAndDownloadJars(jarList: String, userJar: String): String = {
    +    val targetDir = DependencyUtils.createTempDir()
    +    val hadoopConf = new Configuration()
    +    val sparkProperties = new HashMap[String, String]()
    +    val securityProperties = List("spark.ssl.fs.trustStore", "spark.ssl.trustStore",
    +      "spark.ssl.fs.trustStorePassword", "spark.ssl.trustStorePassword",
    +      "spark.ssl.fs.protocol", "spark.ssl.protocol")
    +    var jars = jarList
    +
    +    securityProperties.foreach{pName =>
    +      sys.props.get(pName).foreach {pValue => sparkProperties.put(pName, pValue)}}
    +
    +    jars = Option(jars).map(SparkSubmit.resolveGlobPaths(_, hadoopConf)).orNull
    --- End diff --
    
    This will not work as flatMap is applied on the Option not the array of split values.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r128835523
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -66,4 +77,68 @@ object DriverWrapper {
             System.exit(-1)
         }
       }
    +
    +  // R or Python are not supported in cluster mode so download the jars to the driver side
    +  private def setupDependencies(loader: MutableURLClassLoader, userJar: String): Unit = {
    +    val packagesExclusions = sys.props.get("spark.jars.excludes").orNull
    +    val packages = sys.props.get("spark.jars.packages").orNull
    +    val repositories = sys.props.get("spark.jars.repositories").orNull
    +    val hadoopConf = new HadoopConfiguration()
    +    val childClasspath = new ArrayBuffer[String]()
    +    val ivyRepoPath = sys.props.get("spark.jars.ivy").orNull
    +    var jars = sys.props.get("spark.jars").orNull
    +
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(packages,
    +      ivySettings, exclusions = exclusions)
    +
    +    if (!StringUtils.isBlank(resolvedMavenCoordinates)) {
    +      jars = SparkSubmit.mergeFileLists(jars, resolvedMavenCoordinates)
    +    }
    +
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    +    Runtime.getRuntime.addShutdownHook(new Thread() {
    +      override def run(): Unit = {
    +        FileUtils.deleteQuietly(targetDir)
    +      }
    +    })
    +    // scalastyle:on runtimeaddshutdownhook
    +
    +    val sparkProperties = new mutable.HashMap[String, String]()
    +    val securityProperties = List("spark.ssl.fs.trustStore", "spark.ssl.trustStore",
    +      "spark.ssl.fs.trustStorePassword", "spark.ssl.trustStorePassword",
    +      "spark.ssl.fs.protocol", "spark.ssl.protocol")
    +
    +    securityProperties
    +      .map {pName => sys.props.get(pName)
    +        .map{pValue => sparkProperties.put(pName, pValue)}}
    +
    +    jars = Option(jars).map(SparkSubmit.resolveGlobPaths(_, hadoopConf)).orNull
    +
    +    // Filter out the user jar
    +    jars = jars.split(",").filterNot(_.contains(userJar.split("/").last)).mkString(",")
    +    jars = Option(jars)
    +      .map(SparkSubmit.downloadFileList(_, targetDir, sparkProperties, hadoopConf)).orNull
    --- End diff --
    
    I cannot omit the jars here... I skipped them earlier in SparkSubmit so I have to do this somewhere.. I am just migrating the place where this action takes place...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by jerryshao <gi...@git.apache.org>.
Github user jerryshao commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    I'm wondering if we can prepare all the resources in `SparkSubmit` and upload to HDFS's staging folder, then driver could download them from HDFS and add to classpath. This is what basically YARN#client does, I think maybe for standalone cluster mode we could do this also, so that the resources preparation logics are still in `SparkSubmit`. Just my two cents.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    @vanzin I did the required refactoring, addressing the issues you mentioned and added to the description a better message so its available in git log when this PR is merged.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/80468/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132262559
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -66,4 +70,24 @@ object DriverWrapper {
             System.exit(-1)
         }
       }
    +
    +  private def setupDependencies(loader: MutableURLClassLoader, userJar: String): Unit = {
    +
    --- End diff --
    
    nit: remove blank line.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r131722121
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,97 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(
    +      packages, ivySettings, exclusions = exclusions)
    +
    +    resolvedMavenCoordinates
    +  }
    +
    +  def createTempDir(): File = {
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    +    Runtime.getRuntime.addShutdownHook(new Thread() {
    +      override def run(): Unit = {
    +        FileUtils.deleteQuietly(targetDir)
    +      }
    +    })
    +    targetDir
    +  }
    +
    +  def resolveAndDownloadJars(jarList: String, userJar: String): String = {
    +    val targetDir = DependencyUtils.createTempDir()
    +    val hadoopConf = new Configuration()
    +    val sparkProperties = new HashMap[String, String]()
    +    val securityProperties = List("spark.ssl.fs.trustStore", "spark.ssl.trustStore",
    +      "spark.ssl.fs.trustStorePassword", "spark.ssl.trustStorePassword",
    +      "spark.ssl.fs.protocol", "spark.ssl.protocol")
    +    var jars = jarList
    +
    +    securityProperties.foreach{pName =>
    +      sys.props.get(pName).foreach {pValue => sparkProperties.put(pName, pValue)}}
    +
    +    jars = Option(jars).map(SparkSubmit.resolveGlobPaths(_, hadoopConf)).orNull
    --- End diff --
    
    Instead of re-assigning to this variable, a more functional approach is both cleaner and easier to read:
    
    ```
    Option(jars)
       .map(SparkSubmit....)
       .flatMap(_.split...)
       .filterNot(...)
       .mkString(...)
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r130753805
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala ---
    @@ -1315,6 +1294,80 @@ private[spark] object SparkSubmitUtils {
     
     }
     
    +private [deploy] object DependencyUtils {
    +  def resolveMavenDepndencies(args: Option[SparkSubmitArguments] = None): String = {
    +
    +   val (packagesExclusions, packages, repositories, ivyRepoPath) =
    +     args.map { x => (x.packagesExclusions, x.packages, x.repositories, x.ivyRepoPath) }
    +       .orElse {
    +         val props = sys.props
    +         Some((props.get("spark.jars.excludes").orNull, props.get("spark.jars.packages").orNull,
    +           props.get("spark.jars.repositories").orNull, props.get("spark.jars.ivy").orNull))
    +       }.get
    +
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(
    +      packages, ivySettings, exclusions = exclusions)
    +
    +    resolvedMavenCoordinates
    +  }
    +
    +  def createTempDir(): File = {
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    +    Runtime.getRuntime.addShutdownHook(new Thread() {
    +      override def run(): Unit = {
    +        FileUtils.deleteQuietly(targetDir)
    +      }
    +    })
    +    targetDir
    +  }
    +
    +  def resolveAndDownloadJars(jarList: String, userJar: String): String = {
    +    val targetDir = DependencyUtils.createTempDir()
    +    val hadoopConf = new HadoopConfiguration()
    +    val sparkProperties = new HashMap[String, String]()
    +    val securityProperties = List("spark.ssl.fs.trustStore", "spark.ssl.trustStore",
    +      "spark.ssl.fs.trustStorePassword", "spark.ssl.trustStorePassword",
    +      "spark.ssl.fs.protocol", "spark.ssl.protocol")
    +    var jars = jarList
    +
    +    securityProperties
    --- End diff --
    
    This is really oddly indented.
    
    ```
    securityProperties.map { pName => 
      sys.props.get(pName).map { pValue =>
        sparkProperties.put(pName, pValue)
      }
    }
    ```
    
    Also, it doesn't make a ton of sense to use `map` when you're not using the return value. That's what `foreach` is for.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for standalon...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    @vanzin pls review.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r128646523
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -66,4 +77,68 @@ object DriverWrapper {
             System.exit(-1)
         }
       }
    +
    +  // R or Python are not supported in cluster mode so download the jars to the driver side
    --- End diff --
    
    It's not clear what R and Python have to do with downloading jar files.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    **[Test build #80208 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/80208/testReport)** for PR 18630 at commit [`70649e2`](https://github.com/apache/spark/commit/70649e2a130daa01e4d0da28c69c96b1bc9f26a3).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    **[Test build #79670 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79670/testReport)** for PR 18630 at commit [`b75387c`](https://github.com/apache/spark/commit/b75387cf4cf2debc04979f2416efa01f82680b3c).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    **[Test build #80468 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/80468/testReport)** for PR 18630 at commit [`c0b0a7d`](https://github.com/apache/spark/commit/c0b0a7d79ca27bbcf91245b3d80070d5d4188174).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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

[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r130754099
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala ---
    @@ -1315,6 +1294,80 @@ private[spark] object SparkSubmitUtils {
     
     }
     
    +private [deploy] object DependencyUtils {
    +  def resolveMavenDepndencies(args: Option[SparkSubmitArguments] = None): String = {
    +
    +   val (packagesExclusions, packages, repositories, ivyRepoPath) =
    +     args.map { x => (x.packagesExclusions, x.packages, x.repositories, x.ivyRepoPath) }
    +       .orElse {
    +         val props = sys.props
    +         Some((props.get("spark.jars.excludes").orNull, props.get("spark.jars.packages").orNull,
    +           props.get("spark.jars.repositories").orNull, props.get("spark.jars.ivy").orNull))
    +       }.get
    +
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(
    +      packages, ivySettings, exclusions = exclusions)
    +
    +    resolvedMavenCoordinates
    +  }
    +
    +  def createTempDir(): File = {
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    +    Runtime.getRuntime.addShutdownHook(new Thread() {
    +      override def run(): Unit = {
    +        FileUtils.deleteQuietly(targetDir)
    +      }
    +    })
    +    targetDir
    +  }
    +
    +  def resolveAndDownloadJars(jarList: String, userJar: String): String = {
    +    val targetDir = DependencyUtils.createTempDir()
    +    val hadoopConf = new HadoopConfiguration()
    +    val sparkProperties = new HashMap[String, String]()
    +    val securityProperties = List("spark.ssl.fs.trustStore", "spark.ssl.trustStore",
    +      "spark.ssl.fs.trustStorePassword", "spark.ssl.trustStorePassword",
    +      "spark.ssl.fs.protocol", "spark.ssl.protocol")
    +    var jars = jarList
    +
    +    securityProperties
    +      .map {pName => sys.props.get(pName)
    +        .map{pValue => sparkProperties.put(pName, pValue)}}
    +
    +    jars = Option(jars).map(SparkSubmit.resolveGlobPaths(_, hadoopConf)).orNull
    +
    +    // Filter out the user jar
    +    jars = jars.split(",").filterNot(_.contains(userJar.split("/").last)).mkString(",")
    +    jars = Option(jars)
    +      .map(SparkSubmit.downloadFileList(_, targetDir, sparkProperties, hadoopConf)).orNull
    +    jars
    +  }
    +
    +  def addJarsToClassPath(jars: String, loader: MutableURLClassLoader): Unit = {
    +    val childClasspath = new ArrayBuffer[String]()
    +    if (jars != null) {childClasspath ++= jars.split(",")}
    --- End diff --
    
    ```
    if (blah) {
      // code
    }
    ```
    
    But really you don't need `childClasspath` here at all.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    This is how I build things:
    
    ./build/mvn -Pmesos -Phadoop-2.7 -Dhadoop.version=2.7.0 -DskipTests clean package
    
    #  -DskipTests clean package
    
    export JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre/
    
    ./dev/make-distribution.sh --name 18630 --tgz -Phadoop-2.7 -Pmesos 



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by jerryshao <gi...@git.apache.org>.
Github user jerryshao commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r127563323
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -66,4 +75,50 @@ object DriverWrapper {
             System.exit(-1)
         }
       }
    +
    +  // R or Python are not supported in cluster mode so just get jars and files for the driver
    +  private def setupDependencies(loader: MutableURLClassLoader, userJar: String): Unit = {
    +
    +    var packagesExclusions = sys.props.get("spark.jars.excludes").orNull
    +    var packages = sys.props.get("spark.jars.packages").orNull
    +    var repositories = sys.props.get("spark.jars.repositories").orNull
    +    val hadoopConf = new HadoopConfiguration()
    +    val childClasspath = new ArrayBuffer[String]()
    +    var jars = sys.props.get("spark.jars").orNull
    --- End diff --
    
    Here I think `jars` and `files` can only be remote resources, otherwise how can remote driver visit SparkSubmit local resources? So I think some defensive code may be necessary.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79599/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132765579
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,100 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    --- End diff --
    
    ok



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    **[Test build #80549 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/80549/testReport)** for PR 18630 at commit [`db60b27`](https://github.com/apache/spark/commit/db60b273e971dc758c5ff09ca3660f7f63522392).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r130908694
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala ---
    @@ -1315,6 +1294,80 @@ private[spark] object SparkSubmitUtils {
     
     }
     
    +private [deploy] object DependencyUtils {
    +  def resolveMavenDepndencies(args: Option[SparkSubmitArguments] = None): String = {
    +
    +   val (packagesExclusions, packages, repositories, ivyRepoPath) =
    +     args.map { x => (x.packagesExclusions, x.packages, x.repositories, x.ivyRepoPath) }
    +       .orElse {
    +         val props = sys.props
    +         Some((props.get("spark.jars.excludes").orNull, props.get("spark.jars.packages").orNull,
    +           props.get("spark.jars.repositories").orNull, props.get("spark.jars.ivy").orNull))
    +       }.get
    +
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(
    +      packages, ivySettings, exclusions = exclusions)
    +
    +    resolvedMavenCoordinates
    +  }
    +
    +  def createTempDir(): File = {
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    +    Runtime.getRuntime.addShutdownHook(new Thread() {
    +      override def run(): Unit = {
    +        FileUtils.deleteQuietly(targetDir)
    +      }
    +    })
    +    targetDir
    +  }
    +
    +  def resolveAndDownloadJars(jarList: String, userJar: String): String = {
    +    val targetDir = DependencyUtils.createTempDir()
    +    val hadoopConf = new HadoopConfiguration()
    +    val sparkProperties = new HashMap[String, String]()
    +    val securityProperties = List("spark.ssl.fs.trustStore", "spark.ssl.trustStore",
    +      "spark.ssl.fs.trustStorePassword", "spark.ssl.trustStorePassword",
    +      "spark.ssl.fs.protocol", "spark.ssl.protocol")
    +    var jars = jarList
    +
    +    securityProperties
    --- End diff --
    
    Yes correct.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    I wasn't really expecting python support to be added here. I wonder if there's a bug open for that.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r127613972
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala ---
    @@ -473,6 +474,12 @@ object SparkSubmit extends CommandLineUtils {
           OptionAssigner(args.driverExtraLibraryPath, ALL_CLUSTER_MGRS, ALL_DEPLOY_MODES,
             sysProp = "spark.driver.extraLibraryPath"),
     
    +      // Standalone only - propagate attributes for dependency resolution at the driver side
    +      OptionAssigner(args.packages, STANDALONE, CLUSTER, sysProp = "spark.jars.packages"),
    --- End diff --
    
    ok...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    @BryanCutler @vanzin  to make things testable DriverWrapper needs refactoring from a quick look I took. 
     py files are resolved in client mode, let's fix it in another PR (I could do it). The docs (https://spark.apache.org/docs/latest/submitting-applications.html) state:
    "Currently, standalone mode does not support cluster mode for Python applications."
    So is the file distribution the only thing to do? I havent scoped the work needed to support python apps.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    **[Test build #79669 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79669/testReport)** for PR 18630 at commit [`1f92106`](https://github.com/apache/spark/commit/1f92106fe04bfc1fd3d03523dd4fe160eb91a634).
     * This patch **fails Scala style tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    **[Test build #80549 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/80549/testReport)** for PR 18630 at commit [`db60b27`](https://github.com/apache/spark/commit/db60b273e971dc758c5ff09ca3660f7f63522392).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    @jerryshao 
    
    > 
    
    Are you trying to supportĀ --packagesĀ in standalone cluster?
    
    Yes that is my intention as stated in the description. I will proceed with the changes thnx for the review.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r128835800
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -43,7 +52,7 @@ object DriverWrapper {
             rpcEnv.setupEndpoint("workerWatcher", new WorkerWatcher(rpcEnv, workerUrl))
     
             val currentLoader = Thread.currentThread.getContextClassLoader
    -        val userJarUrl = new File(userJar).toURI().toURL()
    +        val userJarUrl = new File(userJar).toURI.toURL
    --- End diff --
    
    Its more scala style that I prefer but anyway...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132056777
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,97 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(
    +      packages, ivySettings, exclusions = exclusions)
    +
    +    resolvedMavenCoordinates
    +  }
    +
    +  def createTempDir(): File = {
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    +    Runtime.getRuntime.addShutdownHook(new Thread() {
    +      override def run(): Unit = {
    +        FileUtils.deleteQuietly(targetDir)
    +      }
    +    })
    +    targetDir
    +  }
    +
    +  def resolveAndDownloadJars(jarList: String, userJar: String): String = {
    +    val targetDir = DependencyUtils.createTempDir()
    +    val hadoopConf = new Configuration()
    +    val sparkProperties = new HashMap[String, String]()
    +    val securityProperties = List("spark.ssl.fs.trustStore", "spark.ssl.trustStore",
    +      "spark.ssl.fs.trustStorePassword", "spark.ssl.trustStorePassword",
    +      "spark.ssl.fs.protocol", "spark.ssl.protocol")
    +    var jars = jarList
    +
    +    securityProperties.foreach{pName =>
    +      sys.props.get(pName).foreach {pValue => sparkProperties.put(pName, pValue)}}
    +
    +    jars = Option(jars).map(SparkSubmit.resolveGlobPaths(_, hadoopConf)).orNull
    --- End diff --
    
    I meant less "use my code verbatim" and more "rewrite this for readability".


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    @jerryshao I agree I had shared this thought with @vanzin for utilizing the distributed cache or whatever is available there in the other PR for mesos. For mesos I am also going to discuss this with Mesosphere guys. Flink has one layer for all: https://issues.apache.org/jira/browse/FLINK-6177
    Check my comment here: https://github.com/apache/spark/pull/18587


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132058305
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,97 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(
    --- End diff --
    
    Yeah ok its more for clarity but anyway sure.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79598/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    **[Test build #79906 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79906/testReport)** for PR 18630 at commit [`c559a08`](https://github.com/apache/spark/commit/c559a08028633394371e784930dda0f8ff3f19ea).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    **[Test build #80433 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/80433/testReport)** for PR 18630 at commit [`a177992`](https://github.com/apache/spark/commit/a177992ec0a5a6797422c6b445c95b5b50d436b5).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    You forgot to address @BryanCutler 's comments; I'll fix the easy ones during merge.
    
    Merging to master.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    I agree that's why I didnt try to do the refactoring... I thought it would take a long time... As for the cluster mode some people use it due to the supervise feature, guess not too many, but dont have a clear view to be honest. @vanzin @srowen thoughts?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    **[Test build #80468 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/80468/testReport)** for PR 18630 at commit [`c0b0a7d`](https://github.com/apache/spark/commit/c0b0a7d79ca27bbcf91245b3d80070d5d4188174).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by BryanCutler <gi...@git.apache.org>.
Github user BryanCutler commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132325862
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,101 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    --- End diff --
    
    Ok, that's fine if you are thinking the calls back to `SparkSubmitUtils` can be moved here eventually.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by BryanCutler <gi...@git.apache.org>.
Github user BryanCutler commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Sure, python support could be added at a later point, I was just thinking if it was only a small addition to what's already here, but no problem.  Btw, after checking out this PR I tried spark-shell and got the error below.  Not sure if it was my environment, but after switching back to master it worked fine
    ```
    bin/spark-shell 
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
    	at org.apache.hadoop.conf.Configuration.<clinit>(Configuration.java:178)
    	at org.apache.spark.deploy.SparkSubmit$.prepareSubmitEnvironment(SparkSubmit.scala:324)
    	at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:155)
    	at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:121)
    	at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
    Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by BryanCutler <gi...@git.apache.org>.
Github user BryanCutler commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Ok, thanks for checking.  It doesn't look like it's coming from your changes, so I'm sure it's just me.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    @BryanCutler sure check here, it works:
    https://gist.github.com/skonto/dc2070d1529c97ec5de32e99983a834f


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r128647444
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -43,7 +52,7 @@ object DriverWrapper {
             rpcEnv.setupEndpoint("workerWatcher", new WorkerWatcher(rpcEnv, workerUrl))
     
             val currentLoader = Thread.currentThread.getContextClassLoader
    -        val userJarUrl = new File(userJar).toURI().toURL()
    +        val userJarUrl = new File(userJar).toURI.toURL
    --- End diff --
    
    No need for this change.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132058269
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,97 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(
    +      packages, ivySettings, exclusions = exclusions)
    +
    +    resolvedMavenCoordinates
    +  }
    +
    +  def createTempDir(): File = {
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    --- End diff --
    
    :+1: 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    @vanzin thnx done, I changed the title. I am willing to work on the distributed cache but needs time for sure.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r128834674
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -66,4 +77,68 @@ object DriverWrapper {
             System.exit(-1)
         }
       }
    +
    +  // R or Python are not supported in cluster mode so download the jars to the driver side
    --- End diff --
    
    Just saying we dont covering them.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by jerryshao <gi...@git.apache.org>.
Github user jerryshao commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    One layer for different cluster managers seems promising, but looks like it requires lots of refactoring works (trying to build a Spark own distributed cache and change the existing way to distribute resources). Maybe a quick fix is enough (I don't think there's lots of users will use standalone cluster mode).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r128646482
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -66,4 +77,68 @@ object DriverWrapper {
             System.exit(-1)
         }
       }
    +
    +  // R or Python are not supported in cluster mode so download the jars to the driver side
    +  private def setupDependencies(loader: MutableURLClassLoader, userJar: String): Unit = {
    +    val packagesExclusions = sys.props.get("spark.jars.excludes").orNull
    --- End diff --
    
    Hmm, this is too much copy & paste for my liking. Could you instead refactor this code into a helper class or object (e.g. `IvytUtils`)?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r131720271
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,97 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(
    +      packages, ivySettings, exclusions = exclusions)
    +
    +    resolvedMavenCoordinates
    +  }
    +
    +  def createTempDir(): File = {
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    --- End diff --
    
    minor: you need to add `scalastyle:on` after this block.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132288098
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,101 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    --- End diff --
    
    I asked for this change, because `SparkSubmitUtils` is kind of a bad place to keep this code if things other than `SparkSubmit` start using it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by BryanCutler <gi...@git.apache.org>.
Github user BryanCutler commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132277650
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,101 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    SparkSubmitUtils.resolveMavenCoordinates(packages, ivySettings, exclusions = exclusions)
    +  }
    +
    +  def createTempDir(): File = {
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    +    Runtime.getRuntime.addShutdownHook(new Thread() {
    +      override def run(): Unit = {
    +        FileUtils.deleteQuietly(targetDir)
    +      }
    +    })
    +    // scalastyle:on runtimeaddshutdownhook
    +    targetDir
    +  }
    +
    +  def resolveAndDownloadJars(jarList: String, userJar: String): String = {
    +    val targetDir = DependencyUtils.createTempDir()
    +    val hadoopConf = new Configuration()
    +    val sparkProperties = new HashMap[String, String]()
    +    val securityProperties = List("spark.ssl.fs.trustStore", "spark.ssl.trustStore",
    +      "spark.ssl.fs.trustStorePassword", "spark.ssl.trustStorePassword",
    +      "spark.ssl.fs.protocol", "spark.ssl.protocol")
    +    var jars = jarList
    +
    +    securityProperties.map { pName =>
    +      sys.props.get(pName).map { pValue =>
    +        sparkProperties.put(pName, pValue)
    +      }
    +    }
    +
    +    Option(jars)
    +      .map {
    +        SparkSubmit.resolveGlobPaths(_, hadoopConf)
    +          .split(",")
    +          .filterNot(_.contains(userJar.split("/").last))
    +          .mkString(",")
    +      }
    +      .filterNot(_ == "")
    +      .map (SparkSubmit.downloadFileList(_, targetDir, sparkProperties, hadoopConf))
    +      .orNull
    --- End diff --
    
    This is a huge statement.  I think it would be better to break it up to be easier to follow.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by BryanCutler <gi...@git.apache.org>.
Github user BryanCutler commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132274444
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,101 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    --- End diff --
    
    nit: i think this could be moved to the line above?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    @vanzin I fixed these minor issues.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by BryanCutler <gi...@git.apache.org>.
Github user BryanCutler commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132275584
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,101 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    SparkSubmitUtils.resolveMavenCoordinates(packages, ivySettings, exclusions = exclusions)
    +  }
    +
    +  def createTempDir(): File = {
    --- End diff --
    
    Can we just use `o.a.s.util.Utils.createTempDir`?  @vanzin it's slightly different but I think serves the same purpose, what do you think?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by BryanCutler <gi...@git.apache.org>.
Github user BryanCutler commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132280876
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,101 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    --- End diff --
    
    Do we really need this new object?  It make the order of calls confusing.  For instance SparkSubmit calls DependencyUtils which makes calls to SparkSubmitUtils.  Can we just move this to SparkSubmitUtils?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by BryanCutler <gi...@git.apache.org>.
Github user BryanCutler commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Maybe it was just something with my env - but I was running it locally, can you just verify that works too?  Just don't specify the `--master` conf and run out of your spark home dir


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132262064
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,101 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    SparkSubmitUtils.resolveMavenCoordinates(packages, ivySettings, exclusions = exclusions)
    +  }
    +
    +  def createTempDir(): File = {
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    +    Runtime.getRuntime.addShutdownHook(new Thread() {
    +      override def run(): Unit = {
    +        FileUtils.deleteQuietly(targetDir)
    +      }
    +    })
    +    // scalastyle:on runtimeaddshutdownhook
    +    targetDir
    +  }
    +
    +  def resolveAndDownloadJars(jarList: String, userJar: String): String = {
    +    val targetDir = DependencyUtils.createTempDir()
    +    val hadoopConf = new Configuration()
    +    val sparkProperties = new HashMap[String, String]()
    +    val securityProperties = List("spark.ssl.fs.trustStore", "spark.ssl.trustStore",
    +      "spark.ssl.fs.trustStorePassword", "spark.ssl.trustStorePassword",
    +      "spark.ssl.fs.protocol", "spark.ssl.protocol")
    +    var jars = jarList
    --- End diff --
    
    nit: not necessary anymore


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    As with the Mesos change, I'm ok with this approach until there's some sort of distributed cache available for those cluster managers. I still need to review the code, though.
    
    @skonto please mention in the PR title that this is for cluster mode.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r130754644
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -66,4 +70,16 @@ object DriverWrapper {
             System.exit(-1)
         }
       }
    +
    +  private def setupDependencies(loader: MutableURLClassLoader, userJar: String): Unit = {
    +    var jars = sys.props.get("spark.jars").orNull
    +    val resolvedMavenCoordinates = DependencyUtils.resolveMavenDepndencies()
    +
    +    if (!StringUtils.isBlank(resolvedMavenCoordinates)) {
    +      jars = SparkSubmit.mergeFileLists(jars, resolvedMavenCoordinates)
    +    }
    +
    +    jars = DependencyUtils.resolveAndDownloadJars(jars, userJar)
    --- End diff --
    
    Instead of using a `var` I find it cleaner to define a different variable (e.g. `val localJars = DependencyUtils...`).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    @vanzin fixed the issues. Please give it another try or merge.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/80208/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r128648079
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -66,4 +77,68 @@ object DriverWrapper {
             System.exit(-1)
         }
       }
    +
    +  // R or Python are not supported in cluster mode so download the jars to the driver side
    +  private def setupDependencies(loader: MutableURLClassLoader, userJar: String): Unit = {
    +    val packagesExclusions = sys.props.get("spark.jars.excludes").orNull
    +    val packages = sys.props.get("spark.jars.packages").orNull
    +    val repositories = sys.props.get("spark.jars.repositories").orNull
    +    val hadoopConf = new HadoopConfiguration()
    +    val childClasspath = new ArrayBuffer[String]()
    +    val ivyRepoPath = sys.props.get("spark.jars.ivy").orNull
    +    var jars = sys.props.get("spark.jars").orNull
    +
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(packages,
    +      ivySettings, exclusions = exclusions)
    +
    +    if (!StringUtils.isBlank(resolvedMavenCoordinates)) {
    +      jars = SparkSubmit.mergeFileLists(jars, resolvedMavenCoordinates)
    +    }
    +
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    +    Runtime.getRuntime.addShutdownHook(new Thread() {
    +      override def run(): Unit = {
    +        FileUtils.deleteQuietly(targetDir)
    +      }
    +    })
    +    // scalastyle:on runtimeaddshutdownhook
    +
    +    val sparkProperties = new mutable.HashMap[String, String]()
    +    val securityProperties = List("spark.ssl.fs.trustStore", "spark.ssl.trustStore",
    +      "spark.ssl.fs.trustStorePassword", "spark.ssl.trustStorePassword",
    +      "spark.ssl.fs.protocol", "spark.ssl.protocol")
    +
    +    securityProperties
    +      .map {pName => sys.props.get(pName)
    +        .map{pValue => sparkProperties.put(pName, pValue)}}
    +
    +    jars = Option(jars).map(SparkSubmit.resolveGlobPaths(_, hadoopConf)).orNull
    +
    +    // Filter out the user jar
    +    jars = jars.split(",").filterNot(_.contains(userJar.split("/").last)).mkString(",")
    +    jars = Option(jars)
    +      .map(SparkSubmit.downloadFileList(_, targetDir, sparkProperties, hadoopConf)).orNull
    +
    +    if (jars != null) {childClasspath ++= jars.split(",")}
    +
    +    for (jar <- childClasspath) {
    +        SparkSubmit.addJarToClasspath(jar, loader)
    --- End diff --
    
    So now all the stuff in `spark.jars` that actually exists on the node will be automatically added to the driver's classpath, which is a change in behavior from before. It's probably ok, but please call out this kind of thing in the commit message.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r128835610
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -66,4 +77,68 @@ object DriverWrapper {
             System.exit(-1)
         }
       }
    +
    +  // R or Python are not supported in cluster mode so download the jars to the driver side
    +  private def setupDependencies(loader: MutableURLClassLoader, userJar: String): Unit = {
    +    val packagesExclusions = sys.props.get("spark.jars.excludes").orNull
    +    val packages = sys.props.get("spark.jars.packages").orNull
    +    val repositories = sys.props.get("spark.jars.repositories").orNull
    +    val hadoopConf = new HadoopConfiguration()
    +    val childClasspath = new ArrayBuffer[String]()
    +    val ivyRepoPath = sys.props.get("spark.jars.ivy").orNull
    +    var jars = sys.props.get("spark.jars").orNull
    +
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(packages,
    +      ivySettings, exclusions = exclusions)
    +
    +    if (!StringUtils.isBlank(resolvedMavenCoordinates)) {
    +      jars = SparkSubmit.mergeFileLists(jars, resolvedMavenCoordinates)
    +    }
    +
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    +    Runtime.getRuntime.addShutdownHook(new Thread() {
    +      override def run(): Unit = {
    +        FileUtils.deleteQuietly(targetDir)
    +      }
    +    })
    +    // scalastyle:on runtimeaddshutdownhook
    +
    +    val sparkProperties = new mutable.HashMap[String, String]()
    +    val securityProperties = List("spark.ssl.fs.trustStore", "spark.ssl.trustStore",
    +      "spark.ssl.fs.trustStorePassword", "spark.ssl.trustStorePassword",
    +      "spark.ssl.fs.protocol", "spark.ssl.protocol")
    +
    +    securityProperties
    +      .map {pName => sys.props.get(pName)
    +        .map{pValue => sparkProperties.put(pName, pValue)}}
    +
    +    jars = Option(jars).map(SparkSubmit.resolveGlobPaths(_, hadoopConf)).orNull
    +
    +    // Filter out the user jar
    +    jars = jars.split(",").filterNot(_.contains(userJar.split("/").last)).mkString(",")
    +    jars = Option(jars)
    +      .map(SparkSubmit.downloadFileList(_, targetDir, sparkProperties, hadoopConf)).orNull
    +
    +    if (jars != null) {childClasspath ++= jars.split(",")}
    +
    +    for (jar <- childClasspath) {
    +        SparkSubmit.addJarToClasspath(jar, loader)
    --- End diff --
    
    Ok I will do so...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r131722371
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,97 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(
    --- End diff --
    
    No need for the `val` since you're just returning it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    **[Test build #79670 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79670/testReport)** for PR 18630 at commit [`b75387c`](https://github.com/apache/spark/commit/b75387cf4cf2debc04979f2416efa01f82680b3c).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by jerryshao <gi...@git.apache.org>.
Github user jerryshao commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r127561962
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala ---
    @@ -473,6 +474,12 @@ object SparkSubmit extends CommandLineUtils {
           OptionAssigner(args.driverExtraLibraryPath, ALL_CLUSTER_MGRS, ALL_DEPLOY_MODES,
             sysProp = "spark.driver.extraLibraryPath"),
     
    +      // Standalone only - propagate attributes for dependency resolution at the driver side
    +      OptionAssigner(args.packages, STANDALONE, CLUSTER, sysProp = "spark.jars.packages"),
    --- End diff --
    
    You can merge this with mesos cluster `OptionAssigner` like `OptionAssigner(args.packages, STANDALONE | MESOS, CLUSTER, sysProp = "spark.jars.packages")`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by jerryshao <gi...@git.apache.org>.
Github user jerryshao commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r127562278
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -66,4 +75,50 @@ object DriverWrapper {
             System.exit(-1)
         }
       }
    +
    +  // R or Python are not supported in cluster mode so just get jars and files for the driver
    +  private def setupDependencies(loader: MutableURLClassLoader, userJar: String): Unit = {
    +
    +    var packagesExclusions = sys.props.get("spark.jars.excludes").orNull
    +    var packages = sys.props.get("spark.jars.packages").orNull
    +    var repositories = sys.props.get("spark.jars.repositories").orNull
    +    val hadoopConf = new HadoopConfiguration()
    +    val childClasspath = new ArrayBuffer[String]()
    +    var jars = sys.props.get("spark.jars").orNull
    +    var files = sys.props.get("spark.files").orNull
    +    var ivyRepoPath = sys.props.get("spark.jars.ivy").orNull
    +
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(packages,
    +      ivySettings, exclusions = exclusions)
    +
    +    if (!StringUtils.isBlank(resolvedMavenCoordinates)) {
    +      jars = SparkSubmit.mergeFileLists(jars, resolvedMavenCoordinates)
    +    }
    +
    +    // filter out the user jar
    +    jars = jars.split(",").filterNot(_.contains(userJar.split("/").last)).mkString(",")
    +    jars = Option(jars).map(SparkSubmit.downloadFileList(_, hadoopConf)).orNull
    --- End diff --
    
    The API interface is changed, this is not compilable.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r130909789
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala ---
    @@ -1315,6 +1294,80 @@ private[spark] object SparkSubmitUtils {
     
     }
     
    +private [deploy] object DependencyUtils {
    +  def resolveMavenDepndencies(args: Option[SparkSubmitArguments] = None): String = {
    --- End diff --
    
    Ok sure will change it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by BryanCutler <gi...@git.apache.org>.
Github user BryanCutler commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132325962
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,101 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    SparkSubmitUtils.resolveMavenCoordinates(packages, ivySettings, exclusions = exclusions)
    +  }
    +
    +  def createTempDir(): File = {
    --- End diff --
    
    Ok, makes sense thanks for clarifying that


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    **[Test build #80208 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/80208/testReport)** for PR 18630 at commit [`70649e2`](https://github.com/apache/spark/commit/70649e2a130daa01e4d0da28c69c96b1bc9f26a3).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    **[Test build #79906 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79906/testReport)** for PR 18630 at commit [`c559a08`](https://github.com/apache/spark/commit/c559a08028633394371e784930dda0f8ff3f19ea).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r130753379
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala ---
    @@ -1315,6 +1294,80 @@ private[spark] object SparkSubmitUtils {
     
     }
     
    +private [deploy] object DependencyUtils {
    +  def resolveMavenDepndencies(args: Option[SparkSubmitArguments] = None): String = {
    --- End diff --
    
    nit: add empty line before this one, remove the empty line after it.
    
    It's also weird for this method to depend on `SparkSubmitArguments`, and fall back to system properties. It makes more sense for it to take all those argument explicitly, and let the caller defined where they come from.
    
    Finally there is a typo in the method name.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    @jerryshao @vanzin  I updated the PR, pls review. In standalone cluster mode with this new update I can resolve jars paths of the form: /tmp/tmp7255787727862122372/jarname.jar,
    file:///home/ubuntu/.ivy2/jars/jarname.jar
    There is no need to download spark.files at the driver side this is taken care at the executor side as long as the property is preserved.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132738772
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,100 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    --- End diff --
    
    Your method name still has a typo.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    **[Test build #80433 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/80433/testReport)** for PR 18630 at commit [`a177992`](https://github.com/apache/spark/commit/a177992ec0a5a6797422c6b445c95b5b50d436b5).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r128834993
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -66,4 +77,68 @@ object DriverWrapper {
             System.exit(-1)
         }
       }
    +
    +  // R or Python are not supported in cluster mode so download the jars to the driver side
    +  private def setupDependencies(loader: MutableURLClassLoader, userJar: String): Unit = {
    +    val packagesExclusions = sys.props.get("spark.jars.excludes").orNull
    --- End diff --
    
    Its not exactly the same with the code in SparkSubmit but I can give it a shot. I thought about too.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79906/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    **[Test build #79598 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79598/testReport)** for PR 18630 at commit [`81a5dee`](https://github.com/apache/spark/commit/81a5deeb2f8d152242f9248f8e5d5c0dd3e1f1ea).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    @srowen  or @vanzin can I get a merge pls?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132072398
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,97 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(
    --- End diff --
    
    fixed it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r128648242
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -66,4 +77,68 @@ object DriverWrapper {
             System.exit(-1)
         }
       }
    +
    +  // R or Python are not supported in cluster mode so download the jars to the driver side
    +  private def setupDependencies(loader: MutableURLClassLoader, userJar: String): Unit = {
    +    val packagesExclusions = sys.props.get("spark.jars.excludes").orNull
    +    val packages = sys.props.get("spark.jars.packages").orNull
    +    val repositories = sys.props.get("spark.jars.repositories").orNull
    +    val hadoopConf = new HadoopConfiguration()
    +    val childClasspath = new ArrayBuffer[String]()
    +    val ivyRepoPath = sys.props.get("spark.jars.ivy").orNull
    +    var jars = sys.props.get("spark.jars").orNull
    +
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(packages,
    +      ivySettings, exclusions = exclusions)
    +
    +    if (!StringUtils.isBlank(resolvedMavenCoordinates)) {
    +      jars = SparkSubmit.mergeFileLists(jars, resolvedMavenCoordinates)
    +    }
    +
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    +    Runtime.getRuntime.addShutdownHook(new Thread() {
    +      override def run(): Unit = {
    +        FileUtils.deleteQuietly(targetDir)
    +      }
    +    })
    +    // scalastyle:on runtimeaddshutdownhook
    +
    +    val sparkProperties = new mutable.HashMap[String, String]()
    +    val securityProperties = List("spark.ssl.fs.trustStore", "spark.ssl.trustStore",
    +      "spark.ssl.fs.trustStorePassword", "spark.ssl.trustStorePassword",
    +      "spark.ssl.fs.protocol", "spark.ssl.protocol")
    +
    +    securityProperties
    +      .map {pName => sys.props.get(pName)
    +        .map{pValue => sparkProperties.put(pName, pValue)}}
    +
    +    jars = Option(jars).map(SparkSubmit.resolveGlobPaths(_, hadoopConf)).orNull
    +
    +    // Filter out the user jar
    +    jars = jars.split(",").filterNot(_.contains(userJar.split("/").last)).mkString(",")
    +    jars = Option(jars)
    +      .map(SparkSubmit.downloadFileList(_, targetDir, sparkProperties, hadoopConf)).orNull
    --- End diff --
    
    You're also implementing a separate feature that is not part of SPARK-12559. You should at the very least call this out in the commit message. I wouldn't be surprised if there's already a bug tracking this, though, so you should take a look.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r131720579
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,97 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(
    +      packages, ivySettings, exclusions = exclusions)
    +
    +    resolvedMavenCoordinates
    +  }
    +
    +  def createTempDir(): File = {
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    +    Runtime.getRuntime.addShutdownHook(new Thread() {
    +      override def run(): Unit = {
    +        FileUtils.deleteQuietly(targetDir)
    +      }
    +    })
    +    targetDir
    +  }
    +
    +  def resolveAndDownloadJars(jarList: String, userJar: String): String = {
    +    val targetDir = DependencyUtils.createTempDir()
    +    val hadoopConf = new Configuration()
    +    val sparkProperties = new HashMap[String, String]()
    +    val securityProperties = List("spark.ssl.fs.trustStore", "spark.ssl.trustStore",
    +      "spark.ssl.fs.trustStorePassword", "spark.ssl.trustStorePassword",
    +      "spark.ssl.fs.protocol", "spark.ssl.protocol")
    +    var jars = jarList
    +
    +    securityProperties.foreach{pName =>
    --- End diff --
    
    nit: `.foreach { pName =>`
    
    Also, I suggested a different, clearer indentation previously that makes this block easier to read.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/18630


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r127614213
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -66,4 +75,50 @@ object DriverWrapper {
             System.exit(-1)
         }
       }
    +
    +  // R or Python are not supported in cluster mode so just get jars and files for the driver
    +  private def setupDependencies(loader: MutableURLClassLoader, userJar: String): Unit = {
    +
    +    var packagesExclusions = sys.props.get("spark.jars.excludes").orNull
    +    var packages = sys.props.get("spark.jars.packages").orNull
    +    var repositories = sys.props.get("spark.jars.repositories").orNull
    +    val hadoopConf = new HadoopConfiguration()
    +    val childClasspath = new ArrayBuffer[String]()
    +    var jars = sys.props.get("spark.jars").orNull
    +    var files = sys.props.get("spark.files").orNull
    +    var ivyRepoPath = sys.props.get("spark.jars.ivy").orNull
    +
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(packages,
    +      ivySettings, exclusions = exclusions)
    +
    +    if (!StringUtils.isBlank(resolvedMavenCoordinates)) {
    +      jars = SparkSubmit.mergeFileLists(jars, resolvedMavenCoordinates)
    +    }
    +
    +    // filter out the user jar
    +    jars = jars.split(",").filterNot(_.contains(userJar.split("/").last)).mkString(",")
    +    jars = Option(jars).map(SparkSubmit.downloadFileList(_, hadoopConf)).orNull
    --- End diff --
    
    Ok will fix that...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132262219
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,101 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    SparkSubmitUtils.resolveMavenCoordinates(packages, ivySettings, exclusions = exclusions)
    +  }
    +
    +  def createTempDir(): File = {
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    +    Runtime.getRuntime.addShutdownHook(new Thread() {
    +      override def run(): Unit = {
    +        FileUtils.deleteQuietly(targetDir)
    +      }
    +    })
    +    // scalastyle:on runtimeaddshutdownhook
    +    targetDir
    +  }
    +
    +  def resolveAndDownloadJars(jarList: String, userJar: String): String = {
    +    val targetDir = DependencyUtils.createTempDir()
    +    val hadoopConf = new Configuration()
    +    val sparkProperties = new HashMap[String, String]()
    +    val securityProperties = List("spark.ssl.fs.trustStore", "spark.ssl.trustStore",
    +      "spark.ssl.fs.trustStorePassword", "spark.ssl.trustStorePassword",
    +      "spark.ssl.fs.protocol", "spark.ssl.protocol")
    +    var jars = jarList
    +
    +    securityProperties.map { pName =>
    --- End diff --
    
    `map` -> `foreach`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r130754452
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala ---
    @@ -1315,6 +1294,80 @@ private[spark] object SparkSubmitUtils {
     
     }
     
    +private [deploy] object DependencyUtils {
    --- End diff --
    
    Do you mind moving this to a separate source file?
    
    I think there's other stuff in `SparkSubmit` that should eventually be moved here, but it's ok to leave that for later.
    
    Also, nit: no space after `private`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132262101
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,101 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    SparkSubmitUtils.resolveMavenCoordinates(packages, ivySettings, exclusions = exclusions)
    +  }
    +
    +  def createTempDir(): File = {
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    +    Runtime.getRuntime.addShutdownHook(new Thread() {
    +      override def run(): Unit = {
    +        FileUtils.deleteQuietly(targetDir)
    +      }
    +    })
    +    // scalastyle:on runtimeaddshutdownhook
    +    targetDir
    +  }
    +
    +  def resolveAndDownloadJars(jarList: String, userJar: String): String = {
    +    val targetDir = DependencyUtils.createTempDir()
    +    val hadoopConf = new Configuration()
    +    val sparkProperties = new HashMap[String, String]()
    +    val securityProperties = List("spark.ssl.fs.trustStore", "spark.ssl.trustStore",
    +      "spark.ssl.fs.trustStorePassword", "spark.ssl.trustStorePassword",
    +      "spark.ssl.fs.protocol", "spark.ssl.protocol")
    +    var jars = jarList
    +
    +    securityProperties.map { pName =>
    +      sys.props.get(pName).map { pValue =>
    +        sparkProperties.put(pName, pValue)
    +      }
    +    }
    +
    +    Option(jars)
    +      .map {
    +        SparkSubmit.resolveGlobPaths(_, hadoopConf)
    +          .split(",")
    +          .filterNot(_.contains(userJar.split("/").last))
    +          .mkString(",")
    +      }
    +      .filterNot(_ == "")
    +      .map (SparkSubmit.downloadFileList(_, targetDir, sparkProperties, hadoopConf))
    --- End diff --
    
    nit: no space after `map`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79669/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132058239
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -66,4 +70,24 @@ object DriverWrapper {
             System.exit(-1)
         }
       }
    +
    +  private def setupDependencies(loader: MutableURLClassLoader, userJar: String): Unit = {
    +    val (packagesExclusions, packages, repositories, ivyRepoPath) = {
    --- End diff --
    
    ok sounds good.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    @vanzin do you think we are ready for a merge?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by BryanCutler <gi...@git.apache.org>.
Github user BryanCutler commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132274309
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala ---
    @@ -300,28 +298,14 @@ object SparkSubmit extends CommandLineUtils {
         }
         val isYarnCluster = clusterManager == YARN && deployMode == CLUSTER
         val isMesosCluster = clusterManager == MESOS && deployMode == CLUSTER
    +    val isStandAloneCluster = clusterManager == STANDALONE && deployMode == CLUSTER
     
    -    if (!isMesosCluster) {
    +    if (!isMesosCluster && !isStandAloneCluster) {
           // Resolve maven dependencies if there are any and add classpath to jars. Add them to py-files
           // too for packages that include Python code
    -      val exclusions: Seq[String] =
    -      if (!StringUtils.isBlank(args.packagesExclusions)) {
    -        args.packagesExclusions.split(",")
    -      } else {
    -        Nil
    -      }
    -
    -      // Create the IvySettings, either load from file or build defaults
    -      val ivySettings = args.sparkProperties.get("spark.jars.ivySettings").map { ivySettingsFile =>
    -        SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(args.repositories),
    -          Option(args.ivyRepoPath))
    -      }.getOrElse {
    -        SparkSubmitUtils.buildIvySettings(Option(args.repositories), Option(args.ivyRepoPath))
    -      }
    -
    -      val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(args.packages,
    -        ivySettings, exclusions = exclusions)
    -
    +      val resolvedMavenCoordinates =
    +      DependencyUtils.resolveMavenDepndencies(args.packagesExclusions, args.packages,
    --- End diff --
    
    should be an indention here.  Maybe this instead?
    ```
    val resolvedMavenCoordinates = DependencyUtils.resolveMavenDepndencies(args.packagesExclusions, 
      args.packages, ivySettings, exclusions = exclusions)
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132059601
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -66,4 +70,24 @@ object DriverWrapper {
             System.exit(-1)
         }
       }
    +
    +  private def setupDependencies(loader: MutableURLClassLoader, userJar: String): Unit = {
    +    val (packagesExclusions, packages, repositories, ivyRepoPath) = {
    --- End diff --
    
    :+1: 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by BryanCutler <gi...@git.apache.org>.
Github user BryanCutler commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132281415
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -66,4 +70,24 @@ object DriverWrapper {
             System.exit(-1)
         }
       }
    +
    +  private def setupDependencies(loader: MutableURLClassLoader, userJar: String): Unit = {
    +
    +    val Seq(packagesExclusions, packages, repositories, ivyRepoPath) =
    +      Seq("spark.jars.excludes", "spark.jars.packages", "spark.jars.repositories", "spark.jars.ivy")
    +        .map(sys.props.get(_).orNull)
    +
    +    val resolvedMavenCoordinates = DependencyUtils.resolveMavenDepndencies(packagesExclusions,
    +      packages, repositories, ivyRepoPath)
    +    val jars = {
    +      val jarsProp = sys.props.get("spark.jars").orNull
    +      if (!StringUtils.isBlank(resolvedMavenCoordinates)) {
    +        SparkSubmit.mergeFileLists(jarsProp, resolvedMavenCoordinates)
    --- End diff --
    
    is this same code repeated elsewhere?  if so maybe it could be put into a common function


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r130911557
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -66,4 +70,16 @@ object DriverWrapper {
             System.exit(-1)
         }
       }
    +
    +  private def setupDependencies(loader: MutableURLClassLoader, userJar: String): Unit = {
    +    var jars = sys.props.get("spark.jars").orNull
    +    val resolvedMavenCoordinates = DependencyUtils.resolveMavenDepndencies()
    +
    +    if (!StringUtils.isBlank(resolvedMavenCoordinates)) {
    +      jars = SparkSubmit.mergeFileLists(jars, resolvedMavenCoordinates)
    +    }
    +
    +    jars = DependencyUtils.resolveAndDownloadJars(jars, userJar)
    --- End diff --
    
    Ok no problem.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    **[Test build #79669 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79669/testReport)** for PR 18630 at commit [`1f92106`](https://github.com/apache/spark/commit/1f92106fe04bfc1fd3d03523dd4fe160eb91a634).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    @vanzin fixed the issues. Ready for merge.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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

[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by BryanCutler <gi...@git.apache.org>.
Github user BryanCutler commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132328236
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,101 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    SparkSubmitUtils.resolveMavenCoordinates(packages, ivySettings, exclusions = exclusions)
    +  }
    +
    +  def createTempDir(): File = {
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    +    Runtime.getRuntime.addShutdownHook(new Thread() {
    +      override def run(): Unit = {
    +        FileUtils.deleteQuietly(targetDir)
    +      }
    +    })
    +    // scalastyle:on runtimeaddshutdownhook
    +    targetDir
    +  }
    +
    +  def resolveAndDownloadJars(jarList: String, userJar: String): String = {
    +    val targetDir = DependencyUtils.createTempDir()
    +    val hadoopConf = new Configuration()
    +    val sparkProperties = new HashMap[String, String]()
    +    val securityProperties = List("spark.ssl.fs.trustStore", "spark.ssl.trustStore",
    +      "spark.ssl.fs.trustStorePassword", "spark.ssl.trustStorePassword",
    +      "spark.ssl.fs.protocol", "spark.ssl.protocol")
    +    var jars = jarList
    +
    +    securityProperties.map { pName =>
    +      sys.props.get(pName).map { pValue =>
    +        sparkProperties.put(pName, pValue)
    +      }
    +    }
    +
    +    Option(jars)
    +      .map {
    +        SparkSubmit.resolveGlobPaths(_, hadoopConf)
    +          .split(",")
    +          .filterNot(_.contains(userJar.split("/").last))
    +          .mkString(",")
    +      }
    +      .filterNot(_ == "")
    +      .map (SparkSubmit.downloadFileList(_, targetDir, sparkProperties, hadoopConf))
    +      .orNull
    --- End diff --
    
    Here is a suggestion, not much different but I prefer some separation between the calls to `resolveGlobPaths` and `downloadFileList` since there is a lot going on in each of those, and checking `nonEmpty` vs ` .filterNot(_ == "")`
    
    ```scala
    def resolveAndDownloadJars(jars: String, userJar: String): String = {
       ...
        Option(jars).map { allJars =>
          val jarList = SparkSubmit.resolveGlobPaths(allJars, hadoopConf)
            .split(",")
            .filterNot(_.contains(userJar.split("/").last))
    
          if (jarList.nonEmpty) {
            SparkSubmit.downloadFileList(jarList.mkString(","), targetDir, sparkProperties, hadoopConf)
          } else {
            null
          }
        }.orNull
      }
    ```
    it's up to you though, not a huge deal.  If you do leave it as is, the `var jar` should be removed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    @BryanCutler you just started spark shell and it failed? How can I reproduce it?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    One thing I noticed is that if you use https you need to set : --conf spark.ssl.enabled=true --conf spark.ssl.protocol=TLS but this does nto apply to the user jar. I think that is an issue.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132058214
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,97 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(
    +      packages, ivySettings, exclusions = exclusions)
    +
    +    resolvedMavenCoordinates
    +  }
    +
    +  def createTempDir(): File = {
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    +    Runtime.getRuntime.addShutdownHook(new Thread() {
    +      override def run(): Unit = {
    +        FileUtils.deleteQuietly(targetDir)
    +      }
    +    })
    +    targetDir
    +  }
    +
    +  def resolveAndDownloadJars(jarList: String, userJar: String): String = {
    +    val targetDir = DependencyUtils.createTempDir()
    +    val hadoopConf = new Configuration()
    +    val sparkProperties = new HashMap[String, String]()
    +    val securityProperties = List("spark.ssl.fs.trustStore", "spark.ssl.trustStore",
    +      "spark.ssl.fs.trustStorePassword", "spark.ssl.trustStorePassword",
    +      "spark.ssl.fs.protocol", "spark.ssl.protocol")
    +    var jars = jarList
    +
    +    securityProperties.foreach{pName =>
    --- End diff --
    
    ok missed that.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    @vanzin fixed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79670/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    **[Test build #79599 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79599/testReport)** for PR 18630 at commit [`9816704`](https://github.com/apache/spark/commit/9816704abcbe12bf99e8e735bf8ede679dcd8cd1).
     * This patch **fails to build**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132288578
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,101 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    SparkSubmitUtils.resolveMavenCoordinates(packages, ivySettings, exclusions = exclusions)
    +  }
    +
    +  def createTempDir(): File = {
    --- End diff --
    
    This code cannot call into things that initialize logging, and the Utils method initializes logging indirectly through `ShutdownHookManager`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132262287
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,101 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    SparkSubmitUtils.resolveMavenCoordinates(packages, ivySettings, exclusions = exclusions)
    +  }
    +
    +  def createTempDir(): File = {
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    +    Runtime.getRuntime.addShutdownHook(new Thread() {
    +      override def run(): Unit = {
    +        FileUtils.deleteQuietly(targetDir)
    +      }
    +    })
    +    // scalastyle:on runtimeaddshutdownhook
    +    targetDir
    +  }
    +
    +  def resolveAndDownloadJars(jarList: String, userJar: String): String = {
    +    val targetDir = DependencyUtils.createTempDir()
    +    val hadoopConf = new Configuration()
    +    val sparkProperties = new HashMap[String, String]()
    +    val securityProperties = List("spark.ssl.fs.trustStore", "spark.ssl.trustStore",
    +      "spark.ssl.fs.trustStorePassword", "spark.ssl.trustStorePassword",
    +      "spark.ssl.fs.protocol", "spark.ssl.protocol")
    +    var jars = jarList
    +
    +    securityProperties.map { pName =>
    +      sys.props.get(pName).map { pValue =>
    --- End diff --
    
    `map` -> `foreach`.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by BryanCutler <gi...@git.apache.org>.
Github user BryanCutler commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Yeah, just by running `bin/spark-shell` it failed immediately with that error.  I double-check by rebuilding and same thing but I'm not sure if was something from your changes or not.  Are you able to startup the shell?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132072408
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,97 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(
    +      packages, ivySettings, exclusions = exclusions)
    +
    +    resolvedMavenCoordinates
    +  }
    +
    +  def createTempDir(): File = {
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    --- End diff --
    
    Fixed it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r128648684
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -66,4 +77,68 @@ object DriverWrapper {
             System.exit(-1)
         }
       }
    +
    +  // R or Python are not supported in cluster mode so download the jars to the driver side
    +  private def setupDependencies(loader: MutableURLClassLoader, userJar: String): Unit = {
    +    val packagesExclusions = sys.props.get("spark.jars.excludes").orNull
    +    val packages = sys.props.get("spark.jars.packages").orNull
    +    val repositories = sys.props.get("spark.jars.repositories").orNull
    +    val hadoopConf = new HadoopConfiguration()
    +    val childClasspath = new ArrayBuffer[String]()
    +    val ivyRepoPath = sys.props.get("spark.jars.ivy").orNull
    +    var jars = sys.props.get("spark.jars").orNull
    +
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(packages,
    +      ivySettings, exclusions = exclusions)
    +
    +    if (!StringUtils.isBlank(resolvedMavenCoordinates)) {
    +      jars = SparkSubmit.mergeFileLists(jars, resolvedMavenCoordinates)
    +    }
    +
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    +    Runtime.getRuntime.addShutdownHook(new Thread() {
    +      override def run(): Unit = {
    +        FileUtils.deleteQuietly(targetDir)
    +      }
    +    })
    +    // scalastyle:on runtimeaddshutdownhook
    +
    +    val sparkProperties = new mutable.HashMap[String, String]()
    +    val securityProperties = List("spark.ssl.fs.trustStore", "spark.ssl.trustStore",
    +      "spark.ssl.fs.trustStorePassword", "spark.ssl.trustStorePassword",
    +      "spark.ssl.fs.protocol", "spark.ssl.protocol")
    +
    +    securityProperties
    +      .map {pName => sys.props.get(pName)
    +        .map{pValue => sparkProperties.put(pName, pValue)}}
    +
    +    jars = Option(jars).map(SparkSubmit.resolveGlobPaths(_, hadoopConf)).orNull
    --- End diff --
    
    These helper methods in `SparkSubmit` should probably be moved to a more properly-named object if they're going to be used in other places. e.g., instead of my previous `IvyUtils` suggestion, you could have a `DependencyUtils` or something like that having all these methods.
    
    Then you could use that method in `DriverRunner` instead of its own `downloadUserJar`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/80433/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132288778
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala ---
    @@ -0,0 +1,101 @@
    +/*
    + * 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.deploy
    +
    +import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable.HashMap
    +
    +import org.apache.commons.io.FileUtils
    +import org.apache.commons.lang3.StringUtils
    +import org.apache.hadoop.conf.Configuration
    +
    +import org.apache.spark.util.MutableURLClassLoader
    +
    +private[deploy] object DependencyUtils {
    +
    +  def resolveMavenDepndencies(
    +      packagesExclusions: String,
    +      packages: String,
    +      repositories: String,
    +      ivyRepoPath: String): String = {
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    SparkSubmitUtils.resolveMavenCoordinates(packages, ivySettings, exclusions = exclusions)
    +  }
    +
    +  def createTempDir(): File = {
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    +    Runtime.getRuntime.addShutdownHook(new Thread() {
    +      override def run(): Unit = {
    +        FileUtils.deleteQuietly(targetDir)
    +      }
    +    })
    +    // scalastyle:on runtimeaddshutdownhook
    +    targetDir
    +  }
    +
    +  def resolveAndDownloadJars(jarList: String, userJar: String): String = {
    +    val targetDir = DependencyUtils.createTempDir()
    +    val hadoopConf = new Configuration()
    +    val sparkProperties = new HashMap[String, String]()
    +    val securityProperties = List("spark.ssl.fs.trustStore", "spark.ssl.trustStore",
    +      "spark.ssl.fs.trustStorePassword", "spark.ssl.trustStorePassword",
    +      "spark.ssl.fs.protocol", "spark.ssl.protocol")
    +    var jars = jarList
    +
    +    securityProperties.map { pName =>
    +      sys.props.get(pName).map { pValue =>
    +        sparkProperties.put(pName, pValue)
    +      }
    +    }
    +
    +    Option(jars)
    +      .map {
    +        SparkSubmit.resolveGlobPaths(_, hadoopConf)
    +          .split(",")
    +          .filterNot(_.contains(userJar.split("/").last))
    +          .mkString(",")
    +      }
    +      .filterNot(_ == "")
    +      .map (SparkSubmit.downloadFileList(_, targetDir, sparkProperties, hadoopConf))
    +      .orNull
    --- End diff --
    
    What's your suggestion?
    
    This syntax is more functional and easier to follow than a bunch of disjoint statements.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    **[Test build #79599 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79599/testReport)** for PR 18630 at commit [`9816704`](https://github.com/apache/spark/commit/9816704abcbe12bf99e8e735bf8ede679dcd8cd1).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r128920834
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -18,8 +18,17 @@
     package org.apache.spark.deploy.worker
     
     import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable
    +import scala.collection.mutable.ArrayBuffer
    --- End diff --
    
    Sure...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/80549/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r127614182
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -66,4 +75,50 @@ object DriverWrapper {
             System.exit(-1)
         }
       }
    +
    +  // R or Python are not supported in cluster mode so just get jars and files for the driver
    +  private def setupDependencies(loader: MutableURLClassLoader, userJar: String): Unit = {
    +
    +    var packagesExclusions = sys.props.get("spark.jars.excludes").orNull
    +    var packages = sys.props.get("spark.jars.packages").orNull
    +    var repositories = sys.props.get("spark.jars.repositories").orNull
    +    val hadoopConf = new HadoopConfiguration()
    +    val childClasspath = new ArrayBuffer[String]()
    +    var jars = sys.props.get("spark.jars").orNull
    --- End diff --
    
    Ivy does the resolution and downloads them locally at the file system's node where the driver is launched on. So then you use the hadoop utilities to fetch them. That's the idea about jars. I was only focusing on packages... but yes need to write some more code to handle files and remote jars already passed though.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    > spark-2.3.0-SNAPSHOT-bin-18630/bin$ ./spark-shell --verbose --master spark://ip-10-10-1-79:7077 
    Using properties file: null
    Parsed arguments:
      master                  spark://ip-10-10-1-79:7077
      deployMode              null
      executorMemory          null
      executorCores           null
      totalExecutorCores      null
      propertiesFile          null
      driverMemory            null
      driverCores             null
      driverExtraClassPath    null
      driverExtraLibraryPath  null
      driverExtraJavaOptions  null
      supervise               false
      queue                   null
      numExecutors            null
      files                   null
      pyFiles                 null
      archives                null
      mainClass               org.apache.spark.repl.Main
      primaryResource         spark-shell
      name                    Spark shell
      childArgs               []
      jars                    null
      packages                null
      packagesExclusions      null
      repositories            null
      verbose                 true
    
    Spark properties used, including those specified through
     --conf and those from the properties file null:
      
    
        
    Main class:
    org.apache.spark.repl.Main
    Arguments:
    
    System properties:
    (SPARK_SUBMIT,true)
    (spark.app.name,Spark shell)
    (spark.jars,)
    (spark.submit.deployMode,client)
    (spark.master,spark://ip-10-10-1-79:7077)
    Classpath elements:
    
    
    
    Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
    Setting default log level to "WARN".
    To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).
    17/08/09 23:28:03 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
    Spark context Web UI available at http://10.10.1.79:4040
    Spark context available as 'sc' (master = spark://ip-10-10-1-79:7077, app id = app-20170809232804-0003).
    Spark session available as 'spark'.
    Welcome to
          ____              __
         / __/__  ___ _____/ /__
        _\ \/ _ \/ _ `/ __/  '_/
       /___/ .__/\_,_/_/ /_/\_\   version 2.3.0-SNAPSHOT
          /_/
             
    Using Scala version 2.11.8 (OpenJDK 64-Bit Server VM, Java 1.8.0_131)
    Type in expressions to have them evaluated.
    Type :help for more information.
    
    scala> 



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for stand-alo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18630
  
    **[Test build #79598 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79598/testReport)** for PR 18630 at commit [`81a5dee`](https://github.com/apache/spark/commit/81a5deeb2f8d152242f9248f8e5d5c0dd3e1f1ea).
     * This patch **fails to build**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by BryanCutler <gi...@git.apache.org>.
Github user BryanCutler commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r132274194
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala ---
    @@ -300,28 +298,14 @@ object SparkSubmit extends CommandLineUtils {
         }
         val isYarnCluster = clusterManager == YARN && deployMode == CLUSTER
         val isMesosCluster = clusterManager == MESOS && deployMode == CLUSTER
    +    val isStandAloneCluster = clusterManager == STANDALONE && deployMode == CLUSTER
     
    -    if (!isMesosCluster) {
    +    if (!isMesosCluster && !isStandAloneCluster) {
           // Resolve maven dependencies if there are any and add classpath to jars. Add them to py-files
           // too for packages that include Python code
    -      val exclusions: Seq[String] =
    -      if (!StringUtils.isBlank(args.packagesExclusions)) {
    -        args.packagesExclusions.split(",")
    -      } else {
    -        Nil
    -      }
    -
    -      // Create the IvySettings, either load from file or build defaults
    -      val ivySettings = args.sparkProperties.get("spark.jars.ivySettings").map { ivySettingsFile =>
    -        SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(args.repositories),
    -          Option(args.ivyRepoPath))
    -      }.getOrElse {
    -        SparkSubmitUtils.buildIvySettings(Option(args.repositories), Option(args.ivyRepoPath))
    -      }
    -
    -      val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(args.packages,
    -        ivySettings, exclusions = exclusions)
    -
    +      val resolvedMavenCoordinates =
    +      DependencyUtils.resolveMavenDepndencies(args.packagesExclusions, args.packages,
    --- End diff --
    
    should be an indention here.  Maybe this instead?
    ```
    val resolvedMavenCoordinates = DependencyUtils.resolveMavenDepndencies(args.packagesExclusions, 
      args.packages, ivySettings, exclusions = exclusions)
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r131721270
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -66,4 +70,24 @@ object DriverWrapper {
             System.exit(-1)
         }
       }
    +
    +  private def setupDependencies(loader: MutableURLClassLoader, userJar: String): Unit = {
    +    val (packagesExclusions, packages, repositories, ivyRepoPath) = {
    --- End diff --
    
    Slightly less verbose:
    
        val Seq(a, b, c, d) = Seq("a", "b", "c", "d").map(sys.props.get(_).orNull)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r130908550
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala ---
    @@ -1315,6 +1294,80 @@ private[spark] object SparkSubmitUtils {
     
     }
     
    +private [deploy] object DependencyUtils {
    +  def resolveMavenDepndencies(args: Option[SparkSubmitArguments] = None): String = {
    +
    +   val (packagesExclusions, packages, repositories, ivyRepoPath) =
    +     args.map { x => (x.packagesExclusions, x.packages, x.repositories, x.ivyRepoPath) }
    +       .orElse {
    +         val props = sys.props
    +         Some((props.get("spark.jars.excludes").orNull, props.get("spark.jars.packages").orNull,
    +           props.get("spark.jars.repositories").orNull, props.get("spark.jars.ivy").orNull))
    +       }.get
    +
    +    val exclusions: Seq[String] =
    +      if (!StringUtils.isBlank(packagesExclusions)) {
    +        packagesExclusions.split(",")
    +      } else {
    +        Nil
    +      }
    +    // Create the IvySettings, either load from file or build defaults
    +    val ivySettings = sys.props.get("spark.jars.ivySettings").map { ivySettingsFile =>
    +      SparkSubmitUtils.loadIvySettings(ivySettingsFile, Option(repositories),
    +        Option(ivyRepoPath))
    +    }.getOrElse {
    +      SparkSubmitUtils.buildIvySettings(Option(repositories), Option(ivyRepoPath))
    +    }
    +
    +    val resolvedMavenCoordinates = SparkSubmitUtils.resolveMavenCoordinates(
    +      packages, ivySettings, exclusions = exclusions)
    +
    +    resolvedMavenCoordinates
    +  }
    +
    +  def createTempDir(): File = {
    +    val targetDir = Files.createTempDirectory("tmp").toFile
    +    // scalastyle:off runtimeaddshutdownhook
    +    Runtime.getRuntime.addShutdownHook(new Thread() {
    +      override def run(): Unit = {
    +        FileUtils.deleteQuietly(targetDir)
    +      }
    +    })
    +    targetDir
    +  }
    +
    +  def resolveAndDownloadJars(jarList: String, userJar: String): String = {
    +    val targetDir = DependencyUtils.createTempDir()
    +    val hadoopConf = new HadoopConfiguration()
    +    val sparkProperties = new HashMap[String, String]()
    +    val securityProperties = List("spark.ssl.fs.trustStore", "spark.ssl.trustStore",
    +      "spark.ssl.fs.trustStorePassword", "spark.ssl.trustStorePassword",
    +      "spark.ssl.fs.protocol", "spark.ssl.protocol")
    +    var jars = jarList
    +
    +    securityProperties
    +      .map {pName => sys.props.get(pName)
    +        .map{pValue => sparkProperties.put(pName, pValue)}}
    +
    +    jars = Option(jars).map(SparkSubmit.resolveGlobPaths(_, hadoopConf)).orNull
    +
    +    // Filter out the user jar
    +    jars = jars.split(",").filterNot(_.contains(userJar.split("/").last)).mkString(",")
    +    jars = Option(jars)
    +      .map(SparkSubmit.downloadFileList(_, targetDir, sparkProperties, hadoopConf)).orNull
    +    jars
    +  }
    +
    +  def addJarsToClassPath(jars: String, loader: MutableURLClassLoader): Unit = {
    +    val childClasspath = new ArrayBuffer[String]()
    +    if (jars != null) {childClasspath ++= jars.split(",")}
    --- End diff --
    
    You mean simply split and add each jar? Yes should be more compact.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r128646011
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/worker/DriverWrapper.scala ---
    @@ -18,8 +18,17 @@
     package org.apache.spark.deploy.worker
     
     import java.io.File
    +import java.nio.file.Files
    +
    +import scala.collection.mutable
    +import scala.collection.mutable.ArrayBuffer
    --- End diff --
    
    Pick a style; either use `mutable.Foo` everywhere, or import each class.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18630: [SPARK-12559][SPARK SUBMIT] fix --packages for st...

Posted by skonto <gi...@git.apache.org>.
Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18630#discussion_r130908799
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala ---
    @@ -1315,6 +1294,80 @@ private[spark] object SparkSubmitUtils {
     
     }
     
    +private [deploy] object DependencyUtils {
    --- End diff --
    
    ok


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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