【发布时间】:2018-07-07 19:35:36
【问题描述】:
环境:
我们正在使用 EMR,以及 Spark 2.1 和 EMR FS。
我们正在做的过程:
我们正在运行 PySpark 作业以连接 2 个 Hive 表,并使用 saveAsTable 基于此结果创建另一个 hive 表并将其存储为带分区的 ORC
问题:
18/01/23 10:21:28 INFO OutputCommitCoordinator: Task was denied committing,
stage: 84, partition: 901, attempt: 10364
18/01/23 10:21:28 INFO TaskSetManager: Starting task 901.10365 in stage 84.0
(TID 212686, ip-172-31-46-97.ec2.internal, executor 10, partition 901,
PROCESS_LOCAL, 6235 bytes)
18/01/23 10:21:28 WARN TaskSetManager: Lost task 884.10406 in stage 84.0
(TID 212677, ip-172-31-46-97.ec2.internal, executor 85): TaskCommitDenied
(Driver denied task commit) for job: 84, partition: 884, attemptNumber: 10406
这个特定的日志信息是从 Spark 日志中递归的,当我们终止作业时,我们已经看到了大约 170000 (160595) 次,如:Spark-Task Commit Denied
从Source Code 显示:
/** * :: DeveloperApi :: * Task requested the driver to commit, but was denied. */
@DeveloperApicase class TaskCommitDenied
( jobID: Int,
partitionID: Int,
attemptNumber: Int) extends TaskFailedReason
{
override def toErrorString: String = s"TaskCommitDenied (Driver denied task commit)" +
s" for job: $jobID, partition: $partitionID, attemptNumber: $attemptNumber"
/** * If a task failed because its attempt to commit was denied, do not count this failure * towards failing the stage. This is intended to prevent spurious stage failures in cases * where many speculative tasks are launched and denied to commit. */
override def countTowardsTaskFailures: Boolean = false
}
请注意,我们没有启用 spark.speculation 即(它是错误的)并且从 spark 作业环境中我们根本没有看到这个属性。
但是在作业运行时,我们可以看到在 EMRFS 下的 table temp 目录下创建了相应的文件,例如:
hdfs://ip-172-31-18-155.ec2.internal:8020/hive/location/hive.db/hivetable/_temporary/0/task_1513431588574_1185_3_01_000000/00000_0.orc
我们可以在 2001 年左右看到这类文件夹(正如我们给出的 spark.sql.shuffle.partitions = 2001)
问题:
1) 即使我们没有启用 spark.speculation,什么可能导致作业启动 ~170000 个任务
2) 当它完成将数据写入 HDFS (EMRFS) 时,为什么每个执行器都尝试启动新任务
3) 有没有办法避免这种情况?
非常感谢您对此进行调查。任何与此相关的输入都会对我们有很大帮助。
文卡特
【问题讨论】:
标签: apache-spark pyspark apache-spark-sql pyspark-sql apache-spark-2.0