def create_session(self):
"""
spark Loader Class
creadted for the purpose of handling Spark Jobs
"""
try :
tfmsa_logger("Spark Session Created")
# #tfmsa_logger("spark_context : {0}".format(spark_context))
# if (isinstance(spark_context, (SparkContext))):
# return spark_context
conf = SparkConf()
conf.setMaster('spark://{0}'.format(settings.SPARK_HOST))
conf.setAppName("tfmsa_session_manager")
conf.set('spark.driver.cores', settings.SPARK_CORE)
conf.set('spark.driver.memory', settings.SPARK_MEMORY)
conf.set('spark.executor.cores', settings.SPARK_WORKER_CORE)
conf.set('spark.executor.memory', settings.SPARK_WORKER_MEMORY)
#conf.set('spark.driver.allowMultipleContexts', "true")
SparkSession.spark_context = SparkContext(conf=conf)
return spark_context
except Exception as e :
# tfmsa_logger(e)
# raise Exception(e)
return spark_context
评论列表
文章目录