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)

相关内容

热门资讯

第3分钟辅助!we poker... 第3分钟辅助!we poker辅助器v3.3,wepoker透视功能下载,机巧教程(有挂透视)1、超...
第8分钟辅助!wepoker怎... 第8分钟辅助!wepoker怎么开辅助,黑侠破解wepoker,课程教程(今日头条)1、上手简单,内...
第十分钟辅助!如何下载wpk透... 第十分钟辅助!如何下载wpk透视版,pokerworld软件,策略教程(有挂分享)如何下载wpk透视...
九分钟辅助!wepoker辅助... 九分钟辅助!wepoker辅助真的假的,cloudpoker作弊,手筋教程(证实有挂)1、每一步都需...
第十分钟辅助!wejoker辅... 第十分钟辅助!wejoker辅助器怎么卖,wepoker免费透视脚本,窍门教程(有挂方式)1、进入游...
十分钟辅助!wepoker-h... 十分钟辅助!wepoker-h5下载,pokernow辅助控制,绝活教程(有挂实锤)1、点击下载安装...
5分钟辅助!aapoker辅助... 5分钟辅助!aapoker辅助器怎么用,wepoker模拟器哪个好用,模板教程(有挂辅助)wepok...
八分钟辅助!wpk官网下载链接... 八分钟辅助!wpk官网下载链接,wpk透视怎么安装,教程书教程(有挂分享)该软件可以轻松地帮助玩家将...
9分钟辅助!wepoker怎么... 9分钟辅助!wepoker怎么买辅助,wepoker安装教程,课程教程(有挂方略)1、wepoker...
第七分钟辅助!hh poker... 第七分钟辅助!hh poker插件下载,wepoker科技辅助器,教程书教程(有挂教程)wepoke...