Access to Spark from Flask app

后端 未结 3 1093
深忆病人
深忆病人 2021-02-02 02:31

I wrote a simple Flask app to pass some data to Spark. The script works in IPython Notebook, but not when I try to run it in it\'s own server. I don\'t think that the Spark co

3条回答
  •  梦毁少年i
    2021-02-02 02:58

    Modify your .py file as it is shown in the linked guide 'Using IPython Notebook with Spark' part second point. Insted sys.path.insert use sys.path.append. Try insert this snippet:

    import sys
    try:
        sys.path.append("your/spark/home/python")
        from pyspark import context
        print ("Successfully imported Spark Modules")
    except ImportError as e:
        print ("Can not import Spark Modules", e)
    

提交回复
热议问题