pacci.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:PACCI 作者: SymSecGroup 项目源码 文件源码
def getSparkConf(mode="mesos", node=0):
    """
    get the spark configuration according to the setting
    :param mode:
    :param node:
    :return:
    """
    global options

    '''
    get spark configuration
    '''
    sconf=SparkConf()

    '''
    set spark configuration
    '''
    sconf.setAppName("%s" % (str(options)))

    # set run mode, now only support spark standalone and mesos coarse mode
    if (mode == 'spark'):
        sconf.setMaster(Setting.SPARK_STANDALONE_URL)
    elif (mode == 'mesos'):
        sconf.setMaster(Setting.MESOS_COARSE_URL)
        # sconf.set("spark.mesos.coarse", "false")
        sconf.set("spark.mesos.coarse", "true")
        sconf.set("spark.mesos.executor.home", Setting.SPARK_HOME)
    else:
        print("****unknown mode")
        exit(0)

    # set core limit if need
    if (0 >= node):
        print "****Spark:no cores max"
    else:
        sconf.set("spark.cores.max", "%d" % (options.cpu * node))

    return sconf
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号