地图中的功能未执行

时间:2018-08-08 09:25:47

标签: apache-spark neo4j pyspark

我想在到csvLine的映射中执行“执行”功能,但未执行

from neo4j.v1 import GraphDatabase, basic_auth
driver = GraphDatabase.driver("bolt://localhost", 
auth=basic_auth("neo4j","azerty"), encrypted=False)
from pyspark import SparkContext
import sys

def execute(line):
    print('Hola')
    session = driver.session()
    session.run("CREATE (n:Node {value: {v} })", {'v': int(line[0])})
    session.close()

if __name__ == '__main__':
    sc = SparkContext()
    csvData = sc.textFile(sys.argv[1]).cache()
    print("VOila")    
    csvData.map(execute)    
"""
    session = driver.session()    
    session.run("CREATE (n:Node {value: {v1} })-[:FRIEND]->(m:Node {value: {v2}})",{'v1': 1, 'v2':2})    
    print('fini')
    session.close()
"""

我调用了execute函数,但是没有执行

0 个答案:

没有答案