GitHub user zjffdu reopened a pull request:

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

    [SPARK-17387][PYSPARK] Creating SparkContext() from python without 
spark-submit ignores user conf

    ## What changes were proposed in this pull request?
    
    The root cause that we would ignore SparkConf when launching JVM is that 
SparkConf require JVM to be created first.  
https://github.com/apache/spark/blob/master/python/pyspark/conf.py#L106
    In this PR, I would defer the launching of JVM until SparkContext is 
created so that we can pass SparkConf to JVM correctly. 
    
    
    ## How was this patch tested?
    
    Use the example code in the description of SPARK-17387,
    ```
    $ SPARK_HOME=$PWD PYTHONPATH=python:python/lib/py4j-0.10.3-src.zip python
    Python 2.7.12 (default, Jul  1 2016, 15:12:24) 
    [GCC 5.4.0 20160609] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from pyspark import SparkContext
    >>> from pyspark import SparkConf
    >>> conf = SparkConf().set("spark.driver.memory", "4g")
    >>> sc = SparkContext(conf=conf)
    ```
    And verify the spark.driver.memory is correctly picked up.
    
    ```
    ...op/ -Xmx4g org.apache.spark.deploy.SparkSubmit --conf 
spark.driver.memory=4g pyspark-shell
    ```


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

    $ git pull https://github.com/zjffdu/spark SPARK-17387

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

    https://github.com/apache/spark/pull/14959.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 #14959
    
----
commit f97776152c1e1d02bf5049eb182e37a7e4d5ed52
Author: Jeff Zhang <zjf...@apache.org>
Date:   2016-09-05T08:37:06Z

    [SPARK-17387][PYSPARK] Creating SparkContext() from python without 
spark-submit ignores user conf

commit 8ade76d1c81dea2c57bc70191e1c5da8ebf6b64e
Author: Jeff Zhang <zjf...@apache.org>
Date:   2016-09-05T11:17:38Z

    fix code style

commit f24f9167e4225ea6f8c6b0868c4831934a2f0f34
Author: Jeff Zhang <zjf...@apache.org>
Date:   2016-09-05T12:30:40Z

    fix unit test

commit b07c5749235bd17bb434710170f55f3c752cf7dc
Author: Jeff Zhang <zjf...@apache.org>
Date:   2016-09-20T06:12:04Z

    address comment

----


---
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