AWS胶水需要很长的时间才能完成
问题描述:
我只是运行一个非常简单的工作如下AWS胶水需要很长的时间才能完成
glueContext = GlueContext(SparkContext.getOrCreate())
l_table = glueContext.create_dynamic_frame.from_catalog(
database="gluecatalog",
table_name="fctable")
l_table = l_table.drop_fields(['seq','partition_0','partition_1','partition_2','partition_3']).rename_field('tbl_code','table_code')
print "Count: ", l_table.count()
l_table.printSchema()
l_table.select_fields(['trans_time']).toDF().distinct().show()
dfc = l_table.relationalize("table_root", "s3://my-bucket/temp/")
print "Before keys() call "
dfc.keys()
print "After keys() call "
l_table.select_fields('table').printSchema()
dfc.select('table_root_table').toDF().where("id = 1 or id = 2").orderBy(['id','index']).show()
dfc.select('table_root').toDF().where("table = 1 or table = 2").show()
的数据结构也很简单
root
|-- table: array
| |-- element: struct
| | |-- trans_time: string
| | |-- seq: null
| | |-- operation: string
| | |-- order_date: string
| | |-- order_code: string
| | |-- tbl_code: string
| | |-- ship_plant_code: string
|-- partition_0
|-- partition_1
|-- partition_2
|-- partition_3
当我运行作业测试,它从任何地方了12到16分钟完成。但云观察日志显示,该作业花费了2秒钟来显示我的所有数据。
所以我的问题是: AWS Glue工作花费超出日志记录的时间可以显示,并且它是在日志记录期外进行的工作?
答
需要花时间设置允许代码运行的环境。我遇到了同样的问题,联系了AWS GLUE团队,他们很有帮助。这需要很长时间的原因是,如果您在一小时内运行同一个脚本两次或运行其他任何脚本,则当您运行第一个作业(保持活动1小时)时,GLUE会构建一个环境,下一个作业将花费大量时间。当你运行第一个脚本时,他们称之为冷启动,第一个工作花了17分钟,第一个工作完成后我又跑了同样的工作,只花了3分钟。
答
在执行编辑作业的操作时,可以在“脚本库和作业参数(可选)”部分下添加更多的DPU。它有助于一些,但不要指望有任何重大改进,我的经验。