AWSGlue任务内存不足。
创始人
2024-09-25 16:01:50
0

使用更高的AWS Glue作业执行器类型,增加任务作业的任务空间和计算资源,或者通过优化代码来减少内存占用。下面是一个使用更高的AWS Glue作业执行器类型的代码示例:

import boto3
import sys

job_name = 'my-glue-job'
job_command = {
    'Name': 'glueetl',
    'ScriptLocation': 's3://my-bucket/glue-etl-script.py',
    'PythonVersion': '3'
}
job_execution_role = 'my-glue-job-execution-role'
allocated_capacity = 10 # 10 units
max_capacity = 20 # 20 units

glue = boto3.client('glue')

# Get the default Glue ETL job runner settings
response = glue.get_job_runners()

# Get the highest available Glue ETL job runner type
max_worker_type = response['MaxWorkers']['Value']

# Create a new Glue ETL job, using the highest available worker type
response = glue.create_job(
    Name=job_name,
    Command=job_command,
    Role=job_execution_role,
    AllocatedCapacity=allocated_capacity,
    MaxCapacity=max_capacity,
    WorkerType=max_worker_type
)

job_run_id = response['JobRunId']

# Start the job
response = glue.start_job_run(
    JobName=job_name,
    JobRunId=job_run_id,
)

# Wait for the job to finish
waiter = glue.get_waiter('job_run_complete')
waiter.wait(
    JobName=job_name,
    JobRunId=job_run_id,
)

# Check the job status
response = glue.get_job_run(
    JobName=job_name,
    RunId=job_run_id,
)

status = response['JobRun']['JobRunState']

if status == 'SUCCEEDED':
    print('Glue job succeeded!')
else:
    print('Glue job failed! Status: ', status)
    sys.exit(1)

相关内容

热门资讯

第八分钟辅助!aa poker... 第八分钟辅助!aa poker辅助包,hhpoker脚本,模块教程(果真有挂)1、首先打开aa po...
3分钟辅助!epoker底牌透... 3分钟辅助!epoker底牌透视,德普之星透视,策略教程(有挂细节)1)德普之星透视辅助插件:进一步...
2分钟辅助!wepoker手机... 2分钟辅助!wepoker手机助手,pokermaster辅助器,法子教程(有挂工具)亲,关键说明,...
第五分钟辅助!pokemmo辅... 第五分钟辅助!pokemmo辅助器手机版下载,拱趴大菠萝怎么开挂,教材教程(有挂功能)1、玩家可以在...
五分钟辅助!hhpoker是真... 五分钟辅助!hhpoker是真的还是假的,哈糖大菠萝有挂吗,积累教程(有挂详情)1、每一步都需要思考...
八分钟辅助!epoker免费透... 八分钟辅助!epoker免费透视脚本,hhpoker辅助器,手段教程(有挂透明挂)1、每一步都需要思...
第二分钟辅助!we-poker... 第二分钟辅助!we-poker正规吗,hhpoker一直输有挂吗,总结教程(的确有挂)1、hhpok...
八分钟辅助!pokermast... 八分钟辅助!pokermaster辅助器,wpk透视插件,策略教程(有挂方法)1、pokermast...
2分钟辅助!拱趴大菠萝有什么挂... 2分钟辅助!拱趴大菠萝有什么挂,hhpoker必备开挂,烘培教程(有挂秘籍)1、拱趴大菠萝有什么挂公...
4分钟辅助!wepoker软件... 4分钟辅助!wepoker软件靠谱么,wepoker免费脚本,法门教程(有挂详细)1、用户打开应用后...