AWS Glue Spark 应用程序日志仍在处理中

问题描述 投票:0回答:1

我正在使用 AWS Glue 运行 PySpark 作业。作业成功完成(最后一步是将数据帧写入 S3,我确实看到文件已创建)。

问题是我没有获得可以在 Spark UI 中查看的“完成”Spark 日志。

在 Glue 作业详细信息中,我为

Spark UI logs path
指定了 S3 位置,文件确实以
spark-application-<nnnnnnnnn>.inprogress
的名称写入那里,但作业完成后,没有写入最终日志(没有
inprogress
扩展名) .

根据这个SO问题的公认答案,我尝试在最后用

time.sleep(2*60)
人为地延长工作时间,但这并没有什么区别。

我在 Cloudwatch 日志中浏览了一下,并在最后找到了这些日志消息:

...
2023-10-11 16:25:20,274 INFO [Executor task launch worker for task 3.0 in stage 1.0 (TID 4)] mapred.SparkHadoopMapRedUtil (Logging.scala:logInfo(61)): attempt_202310111625128823931779720627407_0001_m_000003_4: Committed. Elapsed time: 75 ms.
2023-10-11 16:25:20,276 INFO [Executor task launch worker for task 3.0 in stage 1.0 (TID 4)] executor.Executor (Logging.scala:logInfo(61)): Finished task 3.0 in stage 1.0 (TID 4). 2062 bytes result sent to driver
2023-10-11 16:25:20,885 ERROR [dispatcher-Executor] executor.CoarseGrainedExecutorBackend (Logging.scala:logError(77)): Executor self-exiting due to : Driver 172.16.47.104:34325 disassociated! Shutting down.
2023-10-11 16:25:20,887 INFO [dispatcher-Executor] executor.CoarseGrainedExecutorBackend (Logging.scala:logInfo(61)): Driver from 172.16.47.104:34325 disconnected during shutdown
2023-10-11 16:25:20,889 INFO [CoarseGrainedExecutorBackend-stop-executor] sink.GlueCloudwatchSink (GlueCloudwatchSink.scala:logInfo(22)): CloudwatchSink: SparkContext stopped - not reporting metrics now.
...

关机期间驱动程序分离和断开连接的错误消息是否是未完成日志的原因? 什么可能导致该错误?

编辑--------------

我尝试按照这个SO答案中的建议在工作结束时添加延迟,但这没有用。 添加

os._exit(0)
也没有,这是在 这个关于如何让工作优雅结束的答案中推荐的。

pyspark aws-glue
1个回答
0
投票
这最终对我有用,YMMV。

我在

job.commit()

之后将以下内容添加到我的工作中:

spark.stop() time.sleep(60)
两者本身似乎都不起作用,但两者的组合会导致在不使用 

inprogress

 扩展名的情况下编写另一个文件,并且我的 Spark UI 能够向我显示详细信息。

© www.soinside.com 2019 - 2024. All rights reserved.