【发布时间】:2020-03-23 02:58:55
【问题描述】:
我在 AWS Glue 中使用 pyspark 来读取 ETL 100K S3 文件,但是,我没有读取数十个文件的权限。
我使用了以下代码:
datasource0 = glueContext.create_dynamic_frame_from_options("s3",
{'paths': ["s3://mykkkk-test"],
'recurse':True,
'groupFiles': 'inPartition',
'groupSize': '10485760'},
format="json",
transformation_ctx = "datasource0")
## @type: toDF
## @args: []
## @return: df
## @inputs: [frame = datasource0]
df = datasource0.toDF()
它说
An error occurred while calling o70.toDF. java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
...
Caused by: java.io.FileNotFoundException: No such file or directory
s3://mykkkk-test/1111/2222/3333.json
我没有读取 3333.json 的权限,然后整个作业停止了。
有没有办法捕获异常并跳过文件,让脚本继续处理其他文件?
【问题讨论】: