Skip to content

start_job_run

start_job_run(
    job_name: NameString,
    *,
    config_overrides: Optional[GlueClientConfig] = None,
    job_run_queuing_enabled: Optional[NullableBoolean] = None,
    job_run_id: Optional[IdString] = None,
    arguments: Optional[GenericMap] = None,
    allocated_capacity: Optional[IntegerValue] = None,
    timeout: Optional[Timeout] = None,
    max_capacity: Optional[NullableDouble] = None,
    security_configuration: Optional[NameString] = None,
    notification_property: Optional[NotificationProperty] = None,
    worker_type: Optional[WorkerType] = None,
    number_of_workers: Optional[NullableInteger] = None,
    execution_class: Optional[ExecutionClass] = None,
    execution_role_session_policy: Optional[OrchestrationPolicyJsonString] = None,
) -> StartJobRunResponse

Starts a job run using a job definition.

Parameters:

  • job_name (NameString) –

    The name of the job definition to use.

  • job_run_queuing_enabled (Optional[NullableBoolean], default: None ) –

    Specifies whether job run queuing is enabled for the job run.

    A value of true means job run queuing is enabled for the job run. If false or not populated, the job run will not be considered for queueing.

  • job_run_id (Optional[IdString], default: None ) –

    The ID of a previous JobRun to retry.

  • arguments (Optional[GenericMap], default: None ) –

    The job arguments associated with this run. For this job run, they replace the default arguments set in the job definition itself.

    You can specify arguments here that your own job-execution script consumes, as well as arguments that Glue itself consumes.

    Job arguments may be logged. Do not pass plaintext secrets as arguments. Retrieve secrets from a Glue Connection, Secrets Manager or other secret management mechanism if you intend to keep them within the Job.

    For information about how to specify and consume your own Job arguments, see the Calling Glue APIs in Python topic in the developer guide.

    For information about the arguments you can provide to this field when configuring Spark jobs, see the Special Parameters Used by Glue topic in the developer guide.

    For information about the arguments you can provide to this field when configuring Ray jobs, see Using job parameters in Ray jobs in the developer guide.

  • allocated_capacity (Optional[IntegerValue], default: None ) –

    This field is deprecated. Use MaxCapacity instead.

    The number of Glue data processing units (DPUs) to allocate to this JobRun. You can allocate a minimum of 2 DPUs; the default is 10. A DPU is a relative measure of processing power that consists of 4 vCPUs of compute capacity and 16 GB of memory. For more information, see the Glue pricing page.

  • timeout (Optional[Timeout], default: None ) –

    The JobRun timeout in minutes. This is the maximum time that a job run can consume resources before it is terminated and enters TIMEOUT status. This value overrides the timeout value set in the parent job.

    Jobs must have timeout values less than 7 days or 10080 minutes. Otherwise, the jobs will throw an exception.

    When the value is left blank, the timeout is defaulted to 2,880 minutes for Glue version 4.0 and earlier, or 480 minutes for Glue version 5.0 and later.

    Any existing Glue jobs that had a timeout value greater than 7 days will be defaulted to 7 days. For instance if you have specified a timeout of 20 days for a batch job, it will be stopped on the 7th day.

    For streaming jobs, if you have set up a maintenance window, it will be restarted during the maintenance window after 7 days.

  • max_capacity (Optional[NullableDouble], default: None ) –

    For Glue version 1.0 or earlier jobs, using the standard worker type, the number of Glue data processing units (DPUs) that can be allocated when this job runs. A DPU is a relative measure of processing power that consists of 4 vCPUs of compute capacity and 16 GB of memory. For more information, see the Glue pricing page.

    For Glue version 2.0+ jobs, you cannot specify a Maximum capacity. Instead, you should specify a Worker type and the Number of workers.

    Do not set MaxCapacity if using WorkerType and NumberOfWorkers.

    The value that can be allocated for MaxCapacity depends on whether you are running a Python shell job, an Apache Spark ETL job, or an Apache Spark streaming ETL job:

    • When you specify a Python shell job (JobCommand.Name="pythonshell"), you can allocate either 0.0625 or 1 DPU. The default is 0.0625 DPU.

    • When you specify an Apache Spark ETL job (JobCommand.Name="glueetl") or Apache Spark streaming ETL job (JobCommand.Name="gluestreaming"), you can allocate from 2 to 100 DPUs. The default is 10 DPUs. This job type cannot have a fractional DPU allocation.

  • security_configuration (Optional[NameString], default: None ) –

    The name of the SecurityConfiguration structure to be used with this job run.

  • notification_property (Optional[NotificationProperty], default: None ) –

    Specifies configuration properties of a job run notification.

  • worker_type (Optional[WorkerType], default: None ) –

    The type of predefined worker that is allocated when a job runs. Accepts a value of G.1X, G.2X, G.4X, G.8X or G.025X for Spark jobs. Accepts the value Z.2X for Ray jobs.

    • For the G.1X worker type, each worker maps to 1 DPU (4 vCPUs, 16 GB of memory) with 94GB disk, and provides 1 executor per worker. We recommend this worker type for workloads such as data transforms, joins, and queries, to offers a scalable and cost effective way to run most jobs.

    • For the G.2X worker type, each worker maps to 2 DPU (8 vCPUs, 32 GB of memory) with 138GB disk, and provides 1 executor per worker. We recommend this worker type for workloads such as data transforms, joins, and queries, to offers a scalable and cost effective way to run most jobs.

    • For the G.4X worker type, each worker maps to 4 DPU (16 vCPUs, 64 GB of memory) with 256GB disk, and provides 1 executor per worker. We recommend this worker type for jobs whose workloads contain your most demanding transforms, aggregations, joins, and queries. This worker type is available only for Glue version 3.0 or later Spark ETL jobs in the following Amazon Web Services Regions: US East (Ohio), US East (N. Virginia), US West (Oregon), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo), Canada (Central), Europe (Frankfurt), Europe (Ireland), and Europe (Stockholm).

    • For the G.8X worker type, each worker maps to 8 DPU (32 vCPUs, 128 GB of memory) with 512GB disk, and provides 1 executor per worker. We recommend this worker type for jobs whose workloads contain your most demanding transforms, aggregations, joins, and queries. This worker type is available only for Glue version 3.0 or later Spark ETL jobs, in the same Amazon Web Services Regions as supported for the G.4X worker type.

    • For the G.025X worker type, each worker maps to 0.25 DPU (2 vCPUs, 4 GB of memory) with 84GB disk, and provides 1 executor per worker. We recommend this worker type for low volume streaming jobs. This worker type is only available for Glue version 3.0 or later streaming jobs.

    • For the Z.2X worker type, each worker maps to 2 M-DPU (8vCPUs, 64 GB of memory) with 128 GB disk, and provides up to 8 Ray workers based on the autoscaler.

  • number_of_workers (Optional[NullableInteger], default: None ) –

    The number of workers of a defined workerType that are allocated when a job runs.

  • execution_class (Optional[ExecutionClass], default: None ) –

    Indicates whether the job is run with a standard or flexible execution class. The standard execution-class is ideal for time-sensitive workloads that require fast job startup and dedicated resources.

    The flexible execution class is appropriate for time-insensitive jobs whose start and completion times may vary.

    Only jobs with Glue version 3.0 and above and command type glueetl will be allowed to set ExecutionClass to FLEX. The flexible execution class is available for Spark jobs.

  • execution_role_session_policy (Optional[OrchestrationPolicyJsonString], default: None ) –

    This inline session policy to the StartJobRun API allows you to dynamically restrict the permissions of the specified execution role for the scope of the job, without requiring the creation of additional IAM roles.

Raises:

Source code in docs_src/capo_glue/_services/glue.py
def start_job_run(
    self,
    job_name: "capo_glue.types.name_string.NameString",
    *,
    config_overrides: Optional[GlueClientConfig] = None,
    job_run_queuing_enabled: Optional[
        "capo_glue.types.nullable_boolean.NullableBoolean"
    ] = None,
    job_run_id: Optional["capo_glue.types.id_string.IdString"] = None,
    arguments: Optional["capo_glue.types.generic_map.GenericMap"] = None,
    allocated_capacity: Optional[
        "capo_glue.types.integer_value.IntegerValue"
    ] = None,
    timeout: Optional["capo_glue.types.timeout.Timeout"] = None,
    max_capacity: Optional["capo_glue.types.nullable_double.NullableDouble"] = None,
    security_configuration: Optional[
        "capo_glue.types.name_string.NameString"
    ] = None,
    notification_property: Optional[
        "capo_glue.types.notification_property.NotificationProperty"
    ] = None,
    worker_type: Optional["capo_glue.types.worker_type.WorkerType"] = None,
    number_of_workers: Optional[
        "capo_glue.types.nullable_integer.NullableInteger"
    ] = None,
    execution_class: Optional[
        "capo_glue.types.execution_class.ExecutionClass"
    ] = None,
    execution_role_session_policy: Optional[
        "capo_glue.types.orchestration_policy_json_string.OrchestrationPolicyJsonString"
    ] = None,
) -> "capo_glue.types.start_job_run_response.StartJobRunResponse":
    """<p>Starts a job run using a job definition.</p>

    Args:
        job_name: <p>The name of the job definition to use.</p>
        job_run_queuing_enabled: <p>Specifies whether job run queuing is enabled for the job run.</p> <p>A value of true means job run queuing is enabled for the job run. If false or not populated, the job run will not be considered for queueing.</p>
        job_run_id: <p>The ID of a previous <code>JobRun</code> to retry.</p>
        arguments: <p>The job arguments associated with this run. For this job run, they replace the default arguments set in the job definition itself.</p> <p>You can specify arguments here that your own job-execution script consumes, as well as arguments that Glue itself consumes.</p> <p>Job arguments may be logged. Do not pass plaintext secrets as arguments. Retrieve secrets from a Glue Connection, Secrets Manager or other secret management mechanism if you intend to keep them within the Job. </p> <p>For information about how to specify and consume your own Job arguments, see the <a href="https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python-calling.html">Calling Glue APIs in Python</a> topic in the developer guide.</p> <p>For information about the arguments you can provide to this field when configuring Spark jobs, see the <a href="https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html">Special Parameters Used by Glue</a> topic in the developer guide.</p> <p>For information about the arguments you can provide to this field when configuring Ray jobs, see <a href="https://docs.aws.amazon.com/glue/latest/dg/author-job-ray-job-parameters.html">Using job parameters in Ray jobs</a> in the developer guide.</p>
        allocated_capacity: <p>This field is deprecated. Use <code>MaxCapacity</code> instead.</p> <p>The number of Glue data processing units (DPUs) to allocate to this JobRun. You can allocate a minimum of 2 DPUs; the default is 10. A DPU is a relative measure of processing power that consists of 4 vCPUs of compute capacity and 16 GB of memory. For more information, see the <a href="https://aws.amazon.com/glue/pricing/">Glue pricing page</a>.</p>
        timeout: <p>The <code>JobRun</code> timeout in minutes. This is the maximum time that a job run can consume resources before it is terminated and enters <code>TIMEOUT</code> status. This value overrides the timeout value set in the parent job. </p> <p>Jobs must have timeout values less than 7 days or 10080 minutes. Otherwise, the jobs will throw an exception.</p> <p>When the value is left blank, the timeout is defaulted to 2,880 minutes for Glue version 4.0 and earlier, or 480 minutes for Glue version 5.0 and later.</p> <p>Any existing Glue jobs that had a timeout value greater than 7 days will be defaulted to 7 days. For instance if you have specified a timeout of 20 days for a batch job, it will be stopped on the 7th day.</p> <p>For streaming jobs, if you have set up a maintenance window, it will be restarted during the maintenance window after 7 days.</p>
        max_capacity: <p>For Glue version 1.0 or earlier jobs, using the standard worker type, the number of Glue data processing units (DPUs) that can be allocated when this job runs. A DPU is a relative measure of processing power that consists of 4 vCPUs of compute capacity and 16 GB of memory. For more information, see the <a href="https://aws.amazon.com/glue/pricing/"> Glue pricing page</a>.</p> <p>For Glue version 2.0+ jobs, you cannot specify a <code>Maximum capacity</code>. Instead, you should specify a <code>Worker type</code> and the <code>Number of workers</code>.</p> <p>Do not set <code>MaxCapacity</code> if using <code>WorkerType</code> and <code>NumberOfWorkers</code>.</p> <p>The value that can be allocated for <code>MaxCapacity</code> depends on whether you are running a Python shell job, an Apache Spark ETL job, or an Apache Spark streaming ETL job:</p> <ul> <li> <p>When you specify a Python shell job (<code>JobCommand.Name</code>="pythonshell"), you can allocate either 0.0625 or 1 DPU. The default is 0.0625 DPU.</p> </li> <li> <p>When you specify an Apache Spark ETL job (<code>JobCommand.Name</code>="glueetl") or Apache Spark streaming ETL job (<code>JobCommand.Name</code>="gluestreaming"), you can allocate from 2 to 100 DPUs. The default is 10 DPUs. This job type cannot have a fractional DPU allocation.</p> </li> </ul>
        security_configuration: <p>The name of the <code>SecurityConfiguration</code> structure to be used with this job run.</p>
        notification_property: <p>Specifies configuration properties of a job run notification.</p>
        worker_type: <p>The type of predefined worker that is allocated when a job runs. Accepts a value of G.1X, G.2X, G.4X, G.8X or G.025X for Spark jobs. Accepts the value Z.2X for Ray jobs.</p> <ul> <li> <p>For the <code>G.1X</code> worker type, each worker maps to 1 DPU (4 vCPUs, 16 GB of memory) with 94GB disk, and provides 1 executor per worker. We recommend this worker type for workloads such as data transforms, joins, and queries, to offers a scalable and cost effective way to run most jobs.</p> </li> <li> <p>For the <code>G.2X</code> worker type, each worker maps to 2 DPU (8 vCPUs, 32 GB of memory) with 138GB disk, and provides 1 executor per worker. We recommend this worker type for workloads such as data transforms, joins, and queries, to offers a scalable and cost effective way to run most jobs.</p> </li> <li> <p>For the <code>G.4X</code> worker type, each worker maps to 4 DPU (16 vCPUs, 64 GB of memory) with 256GB disk, and provides 1 executor per worker. We recommend this worker type for jobs whose workloads contain your most demanding transforms, aggregations, joins, and queries. This worker type is available only for Glue version 3.0 or later Spark ETL jobs in the following Amazon Web Services Regions: US East (Ohio), US East (N. Virginia), US West (Oregon), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo), Canada (Central), Europe (Frankfurt), Europe (Ireland), and Europe (Stockholm).</p> </li> <li> <p>For the <code>G.8X</code> worker type, each worker maps to 8 DPU (32 vCPUs, 128 GB of memory) with 512GB disk, and provides 1 executor per worker. We recommend this worker type for jobs whose workloads contain your most demanding transforms, aggregations, joins, and queries. This worker type is available only for Glue version 3.0 or later Spark ETL jobs, in the same Amazon Web Services Regions as supported for the <code>G.4X</code> worker type.</p> </li> <li> <p>For the <code>G.025X</code> worker type, each worker maps to 0.25 DPU (2 vCPUs, 4 GB of memory) with 84GB disk, and provides 1 executor per worker. We recommend this worker type for low volume streaming jobs. This worker type is only available for Glue version 3.0 or later streaming jobs.</p> </li> <li> <p>For the <code>Z.2X</code> worker type, each worker maps to 2 M-DPU (8vCPUs, 64 GB of memory) with 128 GB disk, and provides up to 8 Ray workers based on the autoscaler.</p> </li> </ul>
        number_of_workers: <p>The number of workers of a defined <code>workerType</code> that are allocated when a job runs.</p>
        execution_class: <p>Indicates whether the job is run with a standard or flexible execution class. The standard execution-class is ideal for time-sensitive workloads that require fast job startup and dedicated resources.</p> <p>The flexible execution class is appropriate for time-insensitive jobs whose start and completion times may vary. </p> <p>Only jobs with Glue version 3.0 and above and command type <code>glueetl</code> will be allowed to set <code>ExecutionClass</code> to <code>FLEX</code>. The flexible execution class is available for Spark jobs.</p>
        execution_role_session_policy: <p>This inline session policy to the StartJobRun API allows you to dynamically restrict the permissions of the specified execution role for the scope of the job, without requiring the creation of additional IAM roles.</p>

    Raises:
        capo_glue.errors.concurrent_runs_exceeded_exception.ConcurrentRunsExceededException: <p>Too many jobs are being run concurrently.</p>
        capo_glue.errors.entity_not_found_exception.EntityNotFoundException: <p>A specified entity does not exist</p>
        capo_glue.errors.internal_service_exception.InternalServiceException: <p>An internal service error occurred.</p>
        capo_glue.errors.invalid_input_exception.InvalidInputException: <p>The input provided was not valid.</p>
        capo_glue.errors.operation_timeout_exception.OperationTimeoutException: <p>The operation timed out.</p>
        capo_glue.errors.resource_number_limit_exceeded_exception.ResourceNumberLimitExceededException: <p>A resource numerical limit was exceeded.</p>
        capo_glue.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_glue.types.start_job_run_request.StartJobRunRequest]",
    ) -> OperationResponse[
        "capo_glue.types.start_job_run_response.StartJobRunResponse"
    ]:
        import capo_glue._operations.aws_glue.start_job_run

        output, http_response = (
            capo_glue._operations.aws_glue.start_job_run.start_job_run(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartJobRun")
    )
    input_: capo_glue.types.start_job_run_request.StartJobRunRequest = {
        "job_name": job_name
    }
    if job_run_queuing_enabled is not None:
        input_["job_run_queuing_enabled"] = job_run_queuing_enabled
    if job_run_id is not None:
        input_["job_run_id"] = job_run_id
    if arguments is not None:
        input_["arguments"] = arguments
    if allocated_capacity is not None:
        input_["allocated_capacity"] = allocated_capacity
    if timeout is not None:
        input_["timeout"] = timeout
    if max_capacity is not None:
        input_["max_capacity"] = max_capacity
    if security_configuration is not None:
        input_["security_configuration"] = security_configuration
    if notification_property is not None:
        input_["notification_property"] = notification_property
    if worker_type is not None:
        input_["worker_type"] = worker_type
    if number_of_workers is not None:
        input_["number_of_workers"] = number_of_workers
    if execution_class is not None:
        input_["execution_class"] = execution_class
    if execution_role_session_policy is not None:
        input_["execution_role_session_policy"] = execution_role_session_policy

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output