def setUpClass(cls):
master = os.getenv('MASTER')
assert master is not None, "Please start a Spark standalone cluster and export MASTER to your env."
num_workers = os.getenv('SPARK_WORKER_INSTANCES')
assert num_workers is not None, "Please export SPARK_WORKER_INSTANCES to your env."
cls.num_workers = int(num_workers)
spark_jars = os.getenv('SPARK_CLASSPATH')
assert spark_jars and 'tensorflow-hadoop' in spark_jars, "Please add path to tensorflow-hadoop-*.jar to SPARK_CLASSPATH."
cls.conf = SparkConf().set('spark.jars', spark_jars)
cls.sc = SparkContext(master, cls.__name__, conf=cls.conf)
cls.spark = SparkSession.builder.getOrCreate()
评论列表
文章目录