我正在运行glue ETL转换作业。此作业用于从s3读取数据并将其转换为parquet。
下面是胶水的来源...sourcePath是s3文件的位置。
在这个位置,我们有大约1亿个json文件。所有这些文件都嵌套在子文件夹中。
因此,这就是我应用exclusionPattern来排除以a开头的文件(大约有270万个文件)的原因,我相信只有以a开头的文件才会被处理。
val file_paths = Array(sourcePath)
val exclusionPattern = "\"" + sourcePath + "{[!a]}**" + "\""
glueContext
.getSourceWithFormat(connectionType = "s3",
options = JsonOptions(Map(
"paths" -> file_paths, "recurse" -> true, "groupFiles" -> "inPartition", "exclusions" -> s"[$exclusionPattern]"
)),
format = "json",
transformationContext = "sourceDF"
)
.getDynamicFrame()
.map(transformRow, "error in row")
.toDF()以标准工作进程类型和G2工作进程类型运行此作业后。我一直收到错误
#
# java.lang.OutOfMemoryError: Java heap space
# -XX:OnOutOfMemoryError="kill -9 %p"
# Executing /bin/sh -c "kill -9 27788"...在cloudwatch中,我可以看到驱动内存使用率达到100%,但执行器内存使用率几乎为零。
在运行作业时,我设置了spark.driver.memory=10g和spark.driver.memoryOverhead=4096以及--conf作业参数。
这是日志中的详细信息
--conf spark.hadoop.yarn.resourcemanager.connect.max-wait.ms=60000
--conf spark.hadoop.fs.defaultFS=hdfs://ip-myip.compute.internal:1111
--conf spark.hadoop.yarn.resourcemanager.address=ip-myip.compute.internal:1111
--conf spark.dynamicAllocation.enabled=true
--conf spark.shuffle.service.enabled=true
--conf spark.dynamicAllocation.minExecutors=1
--conf spark.dynamicAllocation.maxExecutors=4
--conf spark.executor.memory=20g
--conf spark.executor.cores=16
--conf spark.driver.memory=20g
--conf spark.default.parallelism=80
--conf spark.sql.shuffle.partitions=80
--conf spark.network.timeout=600
--job-bookmark-option job-bookmark-disable
--TempDir s3://my-location/admin
--class com.example.ETLJob
--enable-spark-ui true
--enable-metrics
--JOB_ID j_111...
--spark-event-logs-path s3://spark-ui
--conf spark.driver.memory=20g
--JOB_RUN_ID jr_111...
--conf spark.driver.memoryOverhead=4096
--scriptLocation s3://my-location/admin/Job/ETL
--SOURCE_DATA_LOCATION s3://xyz/
--job-language scala
--DESTINATION_DATA_LOCATION s3://xyz123/
--JOB_NAME ETL有什么想法可能是问题所在。
谢谢
发布于 2020-04-30 03:29:53
如果文件太多,您可能会压倒驱动程序。 尝试使用 useS3ListImplementation。 这是 Amazon S3 ListKeys 操作的实现,它将大型结果集拆分为多个响应。
尝试添加:
“useS3ListImplementation”-> ture
[1] https://aws.amazon.com/premiumsupport/knowledge-center/glue-oom-java-heap-space-error/
发布于 2020-05-13 23:47:56
正如@eman所建议的那样...
我应用了所有3个groupFiles,groupSize和useS3ListImplementation。如下所示
options = JsonOptions(Map(
"path" -> sourcePath,
"recurse" -> true,
"groupFiles" -> "inPartition",
"groupSize" -> 104857600,//100 mb
"useS3ListImplementation" -> true
))这对我很有效..。如果数据排列不正确,还有一个"acrossPartitions“选项。
https://stackoverflow.com/questions/61505071
复制相似问题