Skip to content

start_job_run

start_job_run(
    application_id: ApplicationId,
    client_token: ClientToken,
    execution_role_arn: IAMRoleArn,
    *,
    config_overrides: Optional[EMRServerlessClientConfig] = None,
    execution_iam_policy: Optional[JobRunExecutionIamPolicy] = None,
    job_driver: Optional[JobDriver] = None,
    configuration_overrides: Optional[ConfigurationOverrides] = None,
    tags: Optional[TagMap] = None,
    execution_timeout_minutes: Optional[Duration] = None,
    name: Optional[String256] = None,
    mode: Optional[JobRunMode] = None,
    retry_policy: Optional[RetryPolicy] = None,
) -> StartJobRunResponse

Starts a job run.

Parameters:

  • application_id (ApplicationId) –

    The ID of the application on which to run the job.

  • client_token (ClientToken) –

    The client idempotency token of the job run to start. Its value must be unique for each request.

  • execution_role_arn (IAMRoleArn) –

    The execution role ARN for the job run.

  • execution_iam_policy (Optional[JobRunExecutionIamPolicy], default: None ) –

    You can pass an optional IAM policy. The resulting job IAM role permissions will be an intersection of this policy and the policy associated with your job execution role.

  • job_driver (Optional[JobDriver], default: None ) –

    The job driver for the job run.

  • configuration_overrides (Optional[ConfigurationOverrides], default: None ) –

    The configuration overrides for the job run.

  • tags (Optional[TagMap], default: None ) –

    The tags assigned to the job run.

  • execution_timeout_minutes (Optional[Duration], default: None ) –

    The maximum duration, in minutes, for the job run. If the job run exceeds this duration, Amazon EMR Serverless cancels it automatically.

    For BATCH mode job runs, the maximum value is 10080 minutes (7 days) starting with Amazon EMR release 7.11. Setting a value of 0 to disable the timeout is no longer supported for BATCH mode job runs.

  • name (Optional[String256], default: None ) –

    The optional job run name. This doesn't have to be unique.

  • mode (Optional[JobRunMode], default: None ) –

    The mode of the job run when it starts.

  • retry_policy (Optional[RetryPolicy], default: None ) –

    The retry policy when job run starts.

Raises:

Source code in docs_src/capo_emr_serverless/_services/emr_serverless.py
def start_job_run(
    self,
    application_id: "capo_emr_serverless.types.application_id.ApplicationId",
    client_token: "capo_emr_serverless.types.client_token.ClientToken",
    execution_role_arn: "capo_emr_serverless.types.iam_role_arn.IAMRoleArn",
    *,
    config_overrides: Optional[EMRServerlessClientConfig] = None,
    execution_iam_policy: Optional[
        "capo_emr_serverless.types.job_run_execution_iam_policy.JobRunExecutionIamPolicy"
    ] = None,
    job_driver: Optional["capo_emr_serverless.types.job_driver.JobDriver"] = None,
    configuration_overrides: Optional[
        "capo_emr_serverless.types.configuration_overrides.ConfigurationOverrides"
    ] = None,
    tags: Optional["capo_emr_serverless.types.tag_map.TagMap"] = None,
    execution_timeout_minutes: Optional[
        "capo_emr_serverless.types.duration.Duration"
    ] = None,
    name: Optional["capo_emr_serverless.types.string256.String256"] = None,
    mode: Optional["capo_emr_serverless.types.job_run_mode.JobRunMode"] = None,
    retry_policy: Optional[
        "capo_emr_serverless.types.retry_policy.RetryPolicy"
    ] = None,
) -> "capo_emr_serverless.types.start_job_run_response.StartJobRunResponse":
    """<p>Starts a job run.</p>

    Args:
        application_id: <p>The ID of the application on which to run the job.</p>
        client_token: <p>The client idempotency token of the job run to start. Its value must be unique for each request.</p>
        execution_role_arn: <p>The execution role ARN for the job run.</p>
        execution_iam_policy: <p>You can pass an optional IAM policy. The resulting job IAM role permissions will be an intersection of this policy and the policy associated with your job execution role.</p>
        job_driver: <p>The job driver for the job run.</p>
        configuration_overrides: <p>The configuration overrides for the job run.</p>
        tags: <p>The tags assigned to the job run.</p>
        execution_timeout_minutes: <p>The maximum duration, in minutes, for the job run. If the job run exceeds this duration, Amazon EMR Serverless cancels it automatically.</p> <p>For BATCH mode job runs, the maximum value is 10080 minutes (7 days) starting with Amazon EMR release 7.11. Setting a value of 0 to disable the timeout is no longer supported for BATCH mode job runs.</p>
        name: <p>The optional job run name. This doesn't have to be unique.</p>
        mode: <p>The mode of the job run when it starts.</p>
        retry_policy: <p>The retry policy when job run starts.</p>

    Raises:
        capo_emr_serverless.errors.conflict_exception.ConflictException: <p>The request could not be processed because of conflict in the current state of the resource.</p>
        capo_emr_serverless.errors.internal_server_exception.InternalServerException: <p>Request processing failed because of an error or failure with the service.</p>
        capo_emr_serverless.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_emr_serverless.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_emr_serverless.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        output, http_response = (
            capo_emr_serverless._operations.aws_toledo_web_service.start_job_run.start_job_run(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_emr_serverless.types.start_job_run_request.StartJobRunRequest",
    ) -> dict[str, Any]:
        import capo_emr_serverless.types.start_job_run_request

        return capo_emr_serverless.types.start_job_run_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("StartJobRun", redact_input=_redact_input),
    )
    input_: capo_emr_serverless.types.start_job_run_request.StartJobRunRequest = {
        "application_id": application_id,
        "client_token": client_token,
        "execution_role_arn": execution_role_arn,
    }
    if execution_iam_policy is not None:
        input_["execution_iam_policy"] = execution_iam_policy
    if job_driver is not None:
        input_["job_driver"] = job_driver
    if configuration_overrides is not None:
        input_["configuration_overrides"] = configuration_overrides
    if tags is not None:
        input_["tags"] = tags
    if execution_timeout_minutes is not None:
        input_["execution_timeout_minutes"] = execution_timeout_minutes
    if name is not None:
        input_["name"] = name
    if mode is not None:
        input_["mode"] = mode
    if retry_policy is not None:
        input_["retry_policy"] = retry_policy

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