:doc:`Batch <../../batch>` / Client / submit_service_job

******************
submit_service_job
******************



.. py:method:: Batch.Client.submit_service_job(**kwargs)

  

  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.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/SubmitServiceJob>`_  


  **Request Syntax**
  ::

    response = client.submit_service_job(
        jobName='string',
        jobQueue='string',
        retryStrategy={
            'attempts': 123,
            'evaluateOnExit': [
                {
                    'action': 'RETRY'|'EXIT',
                    'onStatusReason': 'string'
                },
            ]
        },
        schedulingPriority=123,
        serviceRequestPayload='string',
        serviceJobType='SAGEMAKER_TRAINING',
        shareIdentifier='string',
        timeoutConfig={
            'attemptDurationSeconds': 123
        },
        tags={
            'string': 'string'
        },
        clientToken='string'
    )
    
  :type jobName: string
  :param jobName: **[REQUIRED]** 

    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 (_).

    

  
  :type jobQueue: string
  :param jobQueue: **[REQUIRED]** 

    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``.

    

  
  :type retryStrategy: dict
  :param retryStrategy: 

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

    

  
    - **attempts** *(integer) --* **[REQUIRED]** 

      The number of times to move a service job to ``RUNNABLE`` status. You can specify between 1 and 10 attempts.

      

    
    - **evaluateOnExit** *(list) --* 

      Array of ``ServiceJobEvaluateOnExit`` objects that specify conditions under which the service job should be retried or failed.

      

    
      - *(dict) --* 

        Specifies conditions for when to exit or retry a service job based on the exit status or status reason.

        

      
        - **action** *(string) --* 

          The action to take if the service job exits with the specified condition. Valid values are ``RETRY`` and ``EXIT``.

          

        
        - **onStatusReason** *(string) --* 

          Contains a glob pattern to match against the StatusReason returned for a job. The pattern can contain up to 512 characters and can contain all printable characters. It can optionally end with an asterisk (*) so that only the start of the string needs to be an exact match.

          

        
      
  
  
  :type schedulingPriority: integer
  :param schedulingPriority: 

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

    

  
  :type serviceRequestPayload: string
  :param serviceRequestPayload: **[REQUIRED]** 

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

    

  
  :type serviceJobType: string
  :param serviceJobType: **[REQUIRED]** 

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

    

  
  :type shareIdentifier: string
  :param shareIdentifier: 

    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.

    

  
  :type timeoutConfig: dict
  :param timeoutConfig: 

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

    

  
    - **attemptDurationSeconds** *(integer) --* 

      The maximum duration in seconds that a service job attempt can run. After this time is reached, Batch terminates the service job attempt.

      

    
  
  :type tags: dict
  :param tags: 

    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 <https://docs.aws.amazon.com/batch/latest/userguide/using-tags.html>`__.

    

  
    - *(string) --* 

    
      - *(string) --* 

      


  :type clientToken: string
  :param clientToken: 

    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 ``clientToken``s are received, these requests are considered the same request and the second request is rejected.

    This field is autopopulated if not provided.

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'jobArn': 'string',
          'jobName': 'string',
          'jobId': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **jobArn** *(string) --* 

        The Amazon Resource Name (ARN) for the service job.

        
      

      - **jobName** *(string) --* 

        The name of the service job.

        
      

      - **jobId** *(string) --* 

        The unique identifier for the service job.

        
  
  **Exceptions**
  
  *   :py:class:`Batch.Client.exceptions.ClientException`

  
  *   :py:class:`Batch.Client.exceptions.ServerException`

  