简体   繁体   English

使用 boto3 创建粘合作业时指定作业类型

[英]Specify job type when creating glue job with boto3

I'm trying to create a glue etl job.我正在尝试创建一个胶水等工作。 I'm using boto3.我正在使用boto3。 I'm using the script below.我正在使用下面的脚本。 I want to create it as type=Spark, but the script below creates a type=Python Shell.我想将它创建为 type=Spark,但下面的脚本创建了一个 type=Python Shell。 Also it doesn't disable bookmarks.它也不会禁用书签。 Does anyone know what I need to add to make it a type Spark and disable bookmarks?有谁知道我需要添加什么才能使其成为 Spark 类型并禁用书签?

script:脚本:

response = glue_assumed_client.create_job(
    Name='mlxxxx',
    Role='Awsxxxx',
    Command={
        'Name': 'mlxxxx',
        'ScriptLocation': 's3://aws-glue-scripts-xxxxx-us-west-2/xxxx',
        'PythonVersion': '3'
    },

    Connections={
        'Connections': [
            'sxxxx',
'spxxxxxx',
        ]
    },

    Timeout=2880,
    MaxCapacity=10
)

See the documentation .请参阅文档

Command (dict) -- [REQUIRED] The JobCommand that executes this job. Command (dict) -- [REQUIRED] 执行此作业的 JobCommand。

Name (string) -- The name of the job command. Name (string) -- 作业命令的名称。 For an Apache Spark ETL job, this must be glueetl .对于 Apache Spark ETL 作业,这必须是geletl For a Python shell job, it must be pythonshell.对于 Python shell 作业,它必须是 pythonshell。

You may reset the bookmark by using the function您可以使用 function 重置书签

client.reset_job_bookmark(
    JobName='string',
    RunId='string'
)

where the JobName is required.需要JobName的地方。 It can be obtained from the response['Name'] of the command create_job()可以从命令create_job()response['Name']中获取

To create Spark jobs, you would have to mention the name of the command as 'glueetl' as described below and if you are not running a python shell job you need not specify the python version in the Command parameters要创建 Spark 作业,您必须将命令的名称称为“glueetl”,如下所述,如果您没有运行 python shell 作业,则无需在参数中指定 Z23EEEB4347BDD26BFC6B7EE9A3B75

response = client.create_job(
    Name='mlxxxyu',
    Role='Awsxxxx',
    Command={
        'Name': 'glueetl',     # <——   mention the name as glueetl to create spark job
        'ScriptLocation': 's3://aws-glue-scripts-xxxxx-us-west-2/xxxx'
    },
    Connections={
        'Connections': [
            'sxxxx',
'spxxxxxx',
        ]
    },

    Timeout=2880,
    MaxCapacity=10
)

Regarding job bookmarks, job bookmarks are disabled by default, so if you don't specify a parameter for a job bookmarks then the job created would have bookmarks disabled.关于作业书签,作业书签在默认情况下是禁用的,因此如果您没有为作业书签指定参数,那么创建的作业将禁用书签。

If you want to explicitly disable bookmarks, then you can specify the same in the Default Arguments[1] as shown below.如果要显式禁用书签,则可以在 Default Arguments[1] 中指定相同的内容,如下所示。

response = client.create_job(
    Name='mlxxxyu',
    Role='Awsxxxx',
    Command={
        'Name': 'glueetl',
        'ScriptLocation': ‘s3://aws-glue-scripts-xxxxx-us-west-2/xxxx'
    },
    DefaultArguments={
        '--job-bookmark-option': 'job-bookmark-disable'
    },
    Timeout=2880,
    MaxCapacity=10
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AWS Glue 作业错误 boto3 版本 - AWS Glue Job Wrong boto3 Version 如何以编程方式使用boto3 create_job将参数传递给粘合作业 - how to pass parameter to glue job using boto3 create_job programmatically boto3 胶水 get_job_runs - 检查响应中是否存在特定日期的执行 object - boto3 glue get_job_runs - check execution with certain date exists in the response object 如何使用当前版本的 boto3 运行 AWS Glue 1.0 Python Shell 作业? - How to run an AWS Glue 1.0 Python Shell Job with the Current Version of boto3? 如何通过 boto3 python 调用具有一定数量 DPU 的 AWS Glue 作业? - How to call AWS Glue Job with certain amount of DPU's by boto3 python? Boto3 Glue客户端create_job()模块路径错误`ModuleNotFoundError` - Boto3 Glue client create_job() module path error `ModuleNotFoundError` 如何使用 Boto3 SDK 为 SageMaker 训练作业指定源目录和入口点? 用例是通过 Lambda 调用开始训练 - How to specify source directory and entry point for a SageMaker training job using Boto3 SDK? The use case is start training via Lambda call 使用Boto3创建SQS队列时指定死信队列 - Specify a dead letter queue when creating an SQS queue using Boto3 如何在空运行中运行boto3运行作业流程 - How to run boto3 run job flow in a dry run boto3 如何从 sagemaker 转换作业中获取日志流? - boto3 how to get the logstream form a sagemaker transform job?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM