-1
只使用一个核心所以我有这样的代码:火花上的并行任务
conf = SparkConf().setAll((
("spark.python.profile", "true" if args.profile else "false"),
("spark.task.maxFailures", "20"),
("spark.driver.cores", "4"),
("spark.executor.cores", "4"),
("spark.shuffle.service.enabled", "true"),
("spark.dynamicAllocation.enabled", "true"),
))
# TODO could this be set somewhere in cosr-ops instead?
executor_environment = {}
if config["ENV"] == "prod":
executor_environment = {
"PYTHONPATH": "/cosr/back",
"PYSPARK_PYTHON": "/cosr/back/venv/bin/python",
"LD_LIBRARY_PATH": "/usr/local/lib"
}
sc = SparkContext(appName="Common Search Index", conf=conf, environment=executor_environment)
# First, generate a list of all WARC files
warc_filenames = list_warc_filenames()
# Then split their indexing in Spark workers
warc_records = sc.parallelize(warc_filenames, 4).flatMap(iter_records)
虽然lounches所有它使用的所有核心火花的东西。
但是,当它开始执行任务(索引)时,它仅使用1个100%的内核。
如何使一个火花任务使用所有的核心?
这不会做任何事情......它不会执行任何操作 –
它的确如此,itter_records包含了这项工作。 – IvRRimUm
当它被调用时,它开始将warc bodys索引到ES簇。 – IvRRimUm