Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when runing spark on travis #294

Closed
miguelgfierro opened this issue Nov 11, 2018 · 4 comments
Closed

error when runing spark on travis #294

miguelgfierro opened this issue Nov 11, 2018 · 4 comments

Comments

@miguelgfierro
Copy link
Owner

with

def spark(app_name="App", url="local[*]", memory="10G", cores="16"):
    """Start Spark if not started
    Args:
        app_name (str): Set name of the application
        url (str): URL for spark master.
        memory (str): Size of memory for spark driver and executor.  
        cores (str): Number of executor cores
    Returns:
        obj: Spark context.
    Examples: 
        >>> spark = spark()
        >>> spark is not None
        True
    """
    return (
        SparkSession.builder.appName(app_name)
        .master(url)
        .config("spark.driver.memory", memory)
        .config("spark.executor.cores", cores)
        .config("spark.executor.memory", memory)
        .config("spark.memory.fraction", "0.9")
        .config("spark.memory.stageFraction", "0.3")
        .config("spark.executor.instances", 1)
        .config("spark.executor.heartbeatInterval", "36000s")
        .config("spark.network.timeout", "10000000s")
        .config("spark.driver.maxResultSize", "50g")
        .getOrCreate()
    )

In travis I get:

=================================== FAILURES ===================================
________________ [doctest] python.pyspark_base.spark_conf.spark ________________
005 Start Spark if not started
006     Args:
007         app_name (str): Set name of the application
008         url (str): URL for spark master.
009         memory (str): Size of memory for spark driver.  
010     Returns:
011         obj: Spark context.
012     Examples: 
013         >>> spark = spark()
UNEXPECTED EXCEPTION: TypeError("'SparkSession' object is not callable",)
Traceback (most recent call last):
  File "/home/travis/miniconda/envs/codebase/lib/python3.6/doctest.py", line 1330, in __run
    compileflags, 1), test.globs)
  File "<doctest python.pyspark_base.spark_conf.spark[0]>", line 1, in <module>
TypeError: 'SparkSession' object is not callable

However, in a machine configured with spark it works.

Related to #292

@miguelgfierro
Copy link
Owner Author

Same error in spark 2.3.1 and 2.3.2

@miguelgfierro
Copy link
Owner Author

return SparkSession.builder.getOrCreate() not working in a functio, but when I do >>> spark = SparkSession.builder.getOrCreate() in the tests, it works

@miguelgfierro
Copy link
Owner Author

wierd error, it looks it is related to travis, skip it in the code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant