GitHub user srowen opened a pull request:

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

    SPARK-1974. Most examples fail at startup because spark.master is not set

    Most example code has a few lines like:
    
    ```
    val sparkConf = new SparkConf().setAppName("Foo")
    val sc = new SparkContext(sparkConf)
    ```
    
    The `SparkContext` constructor throws a `SparkException` if `spark.master` 
is not set though, so this fails immediately.
    
    This changes all examples to call `new SparkContext("local[2]", "Foo")` or 
similar. `local[2]` because it's necessary for streaming examples and because 
it's otherwise used as the default over `local[1]` in Spark.
    
    (Since this started off when debugging the Kafka streaming code, I also 
included some refinements there to the logging and resource management. Lightly 
related.)

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

    $ git pull https://github.com/srowen/spark SPARK-1974

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

    https://github.com/apache/spark/pull/926.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 #926
    
----
commit fc852b7937adc87788004711e5295f8542da7b14
Author: Sean Owen <so...@cloudera.com>
Date:   2014-05-30T21:36:24Z

    Add required Spark master parameter to StreamingContext creation in 
examples, where SparkConf object before only set app name

commit 75d4d0d1eb6686a42d887460d416b3225c19ae0d
Author: Sean Owen <so...@cloudera.com>
Date:   2014-05-30T21:44:52Z

    Close resources and log more errors in Kafka consumer stream

----


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

Reply via email to