Github user vogxn commented on a diff in the pull request:

    https://github.com/apache/spark/pull/13599#discussion_r86720667
  
    --- Diff: 
core/src/main/scala/org/apache/spark/api/python/PythonWorkerFactory.scala ---
    @@ -69,6 +84,66 @@ private[spark] class PythonWorkerFactory(pythonExec: 
String, envVars: Map[String
       }
     
       /**
    +   * Create virtualenv using native virtualenv or conda
    +   *
    +   * Native Virtualenv:
    +   *   -  Execute command: virtualenv -p pythonExec --no-site-packages 
virtualenvName
    +   *   -  Execute command: python -m pip --cache-dir cache-dir install -r 
requirement_file
    +   *
    +   * Conda
    +   *   -  Execute command: conda create --prefix prefix --file 
requirement_file -y
    +   *
    +   */
    +  def setupVirtualEnv(): Unit = {
    +    logDebug("Start to setup virtualenv...")
    +    logDebug("user.dir=" + System.getProperty("user.dir"))
    +    logDebug("user.home=" + System.getProperty("user.home"))
    +
    +    require(virtualEnvType == "native" || virtualEnvType == "conda",
    +      s"VirtualEnvType: ${virtualEnvType} is not supported" )
    +    virtualEnvName = "virtualenv_" + conf.getAppId + "_" + 
VIRTUALENV_ID.getAndIncrement()
    +    // use the absolute path when it is local mode otherwise just use 
filename as it would be
    +    // fetched from FileServer
    +    val pyspark_requirements =
    +      if (Utils.isLocalMaster(conf)) {
    +        conf.get("spark.pyspark.virtualenv.requirements")
    +      } else {
    +        conf.get("spark.pyspark.virtualenv.requirements").split("/").last
    +      }
    +
    +    val createEnvCommand =
    +      if (virtualEnvType == "native") {
    +        Arrays.asList(virtualEnvPath,
    +          "-p", pythonExec,
    +          "--no-site-packages", virtualEnvName)
    +      } else {
    +        Arrays.asList(virtualEnvPath,
    +          "create", "--prefix", System.getProperty("user.dir") + "/" + 
virtualEnvName,
    --- End diff --
    
    I was trying to test this patch with `conda` and ended up with permission 
errors on this directory when the virtualenv gets created. So this location is 
owned by yarn and my spark-submit client does not have permissions to write to 
the directory. Is it possible to use something more standard like java tmpdir 
or may be provide a option to override this location?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to