Skip to content

submit_service_job

submit_service_job(
    *,
    config_overrides: Optional[BatchClientConfig] = None,
    job_name: Optional[String] = None,
    job_queue: Optional[String] = None,
    retry_strategy: Optional[ServiceJobRetryStrategy] = None,
    scheduling_priority: Optional[Integer] = None,
    service_request_payload: Optional[String] = None,
    service_job_type: Optional[ServiceJobType] = None,
    share_identifier: Optional[String] = None,
    quota_share_name: Optional[String] = None,
    preemption_configuration: Optional[ServiceJobPreemptionConfiguration] = None,
    timeout_config: Optional[ServiceJobTimeout] = None,
    tags: Optional[TagrisTagsMap] = None,
    client_token: Optional[ClientRequestToken] = None,
) -> SubmitServiceJobResponse

Submits a service job to a specified job queue to run on SageMaker AI. A service job is a unit of work that you submit to Batch for execution on SageMaker AI.

Parameters:

  • job_name (Optional[String], default: None ) –

    The name of the service job. It can be up to 128 characters long. It can contain uppercase and lowercase letters, numbers, hyphens (-), and underscores (_).

  • job_queue (Optional[String], default: None ) –

    The job queue into which the service job is submitted. You can specify either the name or the ARN of the queue. The job queue must have the type SAGEMAKER_TRAINING.

  • retry_strategy (Optional[ServiceJobRetryStrategy], default: None ) –

    The retry strategy to use for failed service jobs that are submitted with this service job request.

  • scheduling_priority (Optional[Integer], default: None ) –

    The scheduling priority of the service job. Valid values are integers between 0 and 9999.

  • service_request_payload (Optional[String], default: None ) –

    The request, in JSON, for the service that the SubmitServiceJob operation is queueing.

  • service_job_type (Optional[ServiceJobType], default: None ) –

    The type of service job. For SageMaker Training jobs, specify SAGEMAKER_TRAINING.

  • share_identifier (Optional[String], default: None ) –

    The share identifier for the service job. Don't specify this parameter if the job queue doesn't have a fair-share scheduling policy. If the job queue has a fair-share scheduling policy, then this parameter must be specified.

  • quota_share_name (Optional[String], default: None ) –

    The quota share for the service job. Don't specify this parameter if the job queue doesn't have a quota share scheduling policy. If the job queue has a quota share scheduling policy, then this parameter must be specified.

  • preemption_configuration (Optional[ServiceJobPreemptionConfiguration], default: None ) –

    Specifies the service job behavior when preempted.

  • timeout_config (Optional[ServiceJobTimeout], default: None ) –

    The timeout configuration for the service job. If none is specified, Batch defers to the default timeout of the underlying service handling the job.

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

    The tags that you apply to the service job request. Each tag consists of a key and an optional value. For more information, see Tagging your Batch resources.

  • client_token (Optional[ClientRequestToken], default: None ) –

    A unique identifier for the request. This token is used to ensure idempotency of requests. If this parameter is specified and two submit requests with identical payloads and clientTokens are received, these requests are considered the same request and the second request is rejected.

Raises:

  • ClientException –

    These errors are usually caused by a client action. One example cause is using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Another cause is specifying an identifier that's not valid.

  • ServerException –

    These errors are usually caused by a server issue.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_batch/_services/batch.py
def submit_service_job(
    self,
    *,
    config_overrides: Optional[BatchClientConfig] = None,
    job_name: Optional["capo_batch.types.string.String"] = None,
    job_queue: Optional["capo_batch.types.string.String"] = None,
    retry_strategy: Optional[
        "capo_batch.types.service_job_retry_strategy.ServiceJobRetryStrategy"
    ] = None,
    scheduling_priority: Optional["capo_batch.types.integer.Integer"] = None,
    service_request_payload: Optional["capo_batch.types.string.String"] = None,
    service_job_type: Optional[
        "capo_batch.types.service_job_type.ServiceJobType"
    ] = None,
    share_identifier: Optional["capo_batch.types.string.String"] = None,
    quota_share_name: Optional["capo_batch.types.string.String"] = None,
    preemption_configuration: Optional[
        "capo_batch.types.service_job_preemption_configuration.ServiceJobPreemptionConfiguration"
    ] = None,
    timeout_config: Optional[
        "capo_batch.types.service_job_timeout.ServiceJobTimeout"
    ] = None,
    tags: Optional["capo_batch.types.tagris_tags_map.TagrisTagsMap"] = None,
    client_token: Optional[
        "capo_batch.types.client_request_token.ClientRequestToken"
    ] = None,
) -> "capo_batch.types.submit_service_job_response.SubmitServiceJobResponse":
    """<p>Submits a service job to a specified job queue to run on SageMaker AI. A service job is a unit of work that you submit to Batch for execution on SageMaker AI.</p>

    Args:
        job_name: <p>The name of the service job. It can be up to 128 characters long. It can contain uppercase and lowercase letters, numbers, hyphens (-), and underscores (_).</p>
        job_queue: <p>The job queue into which the service job is submitted. You can specify either the name or the ARN of the queue. The job queue must have the type <code>SAGEMAKER_TRAINING</code>.</p>
        retry_strategy: <p>The retry strategy to use for failed service jobs that are submitted with this service job request. </p>
        scheduling_priority: <p>The scheduling priority of the service job. Valid values are integers between 0 and 9999.</p>
        service_request_payload: <p>The request, in JSON, for the service that the SubmitServiceJob operation is queueing. </p>
        service_job_type: <p>The type of service job. For SageMaker Training jobs, specify <code>SAGEMAKER_TRAINING</code>.</p>
        share_identifier: <p>The share identifier for the service job. Don't specify this parameter if the job queue doesn't have a fair-share scheduling policy. If the job queue has a fair-share scheduling policy, then this parameter must be specified.</p>
        quota_share_name: <p>The quota share for the service job. Don't specify this parameter if the job queue doesn't have a quota share scheduling policy. If the job queue has a quota share scheduling policy, then this parameter must be specified.</p>
        preemption_configuration: <p>Specifies the service job behavior when preempted.</p>
        timeout_config: <p>The timeout configuration for the service job. If none is specified, Batch defers to the default timeout of the underlying service handling the job.</p>
        tags: <p>The tags that you apply to the service job request. Each tag consists of a key and an optional value. For more information, see <a href="https://docs.aws.amazon.com/batch/latest/userguide/using-tags.html">Tagging your Batch resources</a>.</p>
        client_token: <p>A unique identifier for the request. This token is used to ensure idempotency of requests. If this parameter is specified and two submit requests with identical payloads and <code>clientToken</code>s are received, these requests are considered the same request and the second request is rejected.</p>

    Raises:
        capo_batch.errors.client_exception.ClientException: <p>These errors are usually caused by a client action. One example cause is using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Another cause is specifying an identifier that's not valid.</p>
        capo_batch.errors.server_exception.ServerException: <p>These errors are usually caused by a server issue.</p>
        capo_batch.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_batch.types.submit_service_job_request.SubmitServiceJobRequest]",
    ) -> OperationResponse[
        "capo_batch.types.submit_service_job_response.SubmitServiceJobResponse"
    ]:
        import capo_batch._operations.aws_batch_v20160810.submit_service_job

        output, http_response = (
            capo_batch._operations.aws_batch_v20160810.submit_service_job.submit_service_job(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SubmitServiceJob")
    )
    input_: capo_batch.types.submit_service_job_request.SubmitServiceJobRequest = {}
    if job_name is not None:
        input_["job_name"] = job_name
    if job_queue is not None:
        input_["job_queue"] = job_queue
    if retry_strategy is not None:
        input_["retry_strategy"] = retry_strategy
    if scheduling_priority is not None:
        input_["scheduling_priority"] = scheduling_priority
    if service_request_payload is not None:
        input_["service_request_payload"] = service_request_payload
    if service_job_type is not None:
        input_["service_job_type"] = service_job_type
    if share_identifier is not None:
        input_["share_identifier"] = share_identifier
    if quota_share_name is not None:
        input_["quota_share_name"] = quota_share_name
    if preemption_configuration is not None:
        input_["preemption_configuration"] = preemption_configuration
    if timeout_config is not None:
        input_["timeout_config"] = timeout_config
    if tags is not None:
        input_["tags"] = tags
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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