:doc:`SageMaker <../../sagemaker>` / Client / list_training_jobs

******************
list_training_jobs
******************



.. py:method:: SageMaker.Client.list_training_jobs(**kwargs)

  

  Lists training jobs.

   

  .. note::

    

    When ``StatusEquals`` and ``MaxResults`` are set at the same time, the ``MaxResults`` number of training jobs are first retrieved ignoring the ``StatusEquals`` parameter and then they are filtered by the ``StatusEquals`` parameter, which is returned as a response.

     

    For example, if ``ListTrainingJobs`` is invoked with the following parameters:

     

    ``{ ... MaxResults: 100, StatusEquals: InProgress ... }``

     

    First, 100 trainings jobs with any status, including those other than ``InProgress``, are selected (sorted according to the creation time, from the most current to the oldest). Next, those with a status of ``InProgress`` are returned.

     

    You can quickly test the API using the following Amazon Web Services CLI code.

     

    ``aws sagemaker list-training-jobs --max-results 100 --status-equals InProgress``

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/sagemaker-2017-07-24/ListTrainingJobs>`_  


  **Request Syntax**
  ::

    response = client.list_training_jobs(
        NextToken='string',
        MaxResults=123,
        CreationTimeAfter=datetime(2015, 1, 1),
        CreationTimeBefore=datetime(2015, 1, 1),
        LastModifiedTimeAfter=datetime(2015, 1, 1),
        LastModifiedTimeBefore=datetime(2015, 1, 1),
        NameContains='string',
        StatusEquals='InProgress'|'Completed'|'Failed'|'Stopping'|'Stopped'|'Deleting',
        SortBy='Name'|'CreationTime'|'Status',
        SortOrder='Ascending'|'Descending',
        WarmPoolStatusEquals='Available'|'Terminated'|'Reused'|'InUse',
        TrainingPlanArnEquals='string'
    )
    
  :type NextToken: string
  :param NextToken: 

    If the result of the previous ``ListTrainingJobs`` request was truncated, the response includes a ``NextToken``. To retrieve the next set of training jobs, use the token in the next request.

    

  
  :type MaxResults: integer
  :param MaxResults: 

    The maximum number of training jobs to return in the response.

    

  
  :type CreationTimeAfter: datetime
  :param CreationTimeAfter: 

    A filter that returns only training jobs created after the specified time (timestamp).

    

  
  :type CreationTimeBefore: datetime
  :param CreationTimeBefore: 

    A filter that returns only training jobs created before the specified time (timestamp).

    

  
  :type LastModifiedTimeAfter: datetime
  :param LastModifiedTimeAfter: 

    A filter that returns only training jobs modified after the specified time (timestamp).

    

  
  :type LastModifiedTimeBefore: datetime
  :param LastModifiedTimeBefore: 

    A filter that returns only training jobs modified before the specified time (timestamp).

    

  
  :type NameContains: string
  :param NameContains: 

    A string in the training job name. This filter returns only training jobs whose name contains the specified string.

    

  
  :type StatusEquals: string
  :param StatusEquals: 

    A filter that retrieves only training jobs with a specific status.

    

  
  :type SortBy: string
  :param SortBy: 

    The field to sort results by. The default is ``CreationTime``.

    

  
  :type SortOrder: string
  :param SortOrder: 

    The sort order for results. The default is ``Ascending``.

    

  
  :type WarmPoolStatusEquals: string
  :param WarmPoolStatusEquals: 

    A filter that retrieves only training jobs with a specific warm pool status.

    

  
  :type TrainingPlanArnEquals: string
  :param TrainingPlanArnEquals: 

    The Amazon Resource Name (ARN); of the training plan to filter training jobs by. For more information about reserving GPU capacity for your SageMaker training jobs using Amazon SageMaker Training Plan, see ``CreateTrainingPlan ``.

    

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

    
    ::

      {
          'TrainingJobSummaries': [
              {
                  'TrainingJobName': 'string',
                  'TrainingJobArn': 'string',
                  'CreationTime': datetime(2015, 1, 1),
                  'TrainingEndTime': datetime(2015, 1, 1),
                  'LastModifiedTime': datetime(2015, 1, 1),
                  'TrainingJobStatus': 'InProgress'|'Completed'|'Failed'|'Stopping'|'Stopped'|'Deleting',
                  'SecondaryStatus': 'Starting'|'LaunchingMLInstances'|'PreparingTrainingStack'|'Downloading'|'DownloadingTrainingImage'|'Training'|'Uploading'|'Stopping'|'Stopped'|'MaxRuntimeExceeded'|'Completed'|'Failed'|'Interrupted'|'MaxWaitTimeExceeded'|'Updating'|'Restarting'|'Pending',
                  'WarmPoolStatus': {
                      'Status': 'Available'|'Terminated'|'Reused'|'InUse',
                      'ResourceRetainedBillableTimeInSeconds': 123,
                      'ReusedByJob': 'string'
                  },
                  'TrainingPlanArn': 'string'
              },
          ],
          'NextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **TrainingJobSummaries** *(list) --* 

        An array of ``TrainingJobSummary`` objects, each listing a training job.

        
        

        - *(dict) --* 

          Provides summary information about a training job.

          
          

          - **TrainingJobName** *(string) --* 

            The name of the training job that you want a summary for.

            
          

          - **TrainingJobArn** *(string) --* 

            The Amazon Resource Name (ARN) of the training job.

            
          

          - **CreationTime** *(datetime) --* 

            A timestamp that shows when the training job was created.

            
          

          - **TrainingEndTime** *(datetime) --* 

            A timestamp that shows when the training job ended. This field is set only if the training job has one of the terminal statuses ( ``Completed``, ``Failed``, or ``Stopped``).

            
          

          - **LastModifiedTime** *(datetime) --* 

            Timestamp when the training job was last modified.

            
          

          - **TrainingJobStatus** *(string) --* 

            The status of the training job.

            
          

          - **SecondaryStatus** *(string) --* 

            The secondary status of the training job.

            
          

          - **WarmPoolStatus** *(dict) --* 

            The status of the warm pool associated with the training job.

            
            

            - **Status** *(string) --* 

              The status of the warm pool.

               

              
              * ``InUse``: The warm pool is in use for the training job.
               
              * ``Available``: The warm pool is available to reuse for a matching training job.
               
              * ``Reused``: The warm pool moved to a matching training job for reuse.
               
              * ``Terminated``: The warm pool is no longer available. Warm pools are unavailable if they are terminated by a user, terminated for a patch update, or terminated for exceeding the specified ``KeepAlivePeriodInSeconds``.
              

              
            

            - **ResourceRetainedBillableTimeInSeconds** *(integer) --* 

              The billable time in seconds used by the warm pool. Billable time refers to the absolute wall-clock time.

               

              Multiply ``ResourceRetainedBillableTimeInSeconds`` by the number of instances ( ``InstanceCount``) in your training cluster to get the total compute time SageMaker bills you if you run warm pool training. The formula is as follows: ``ResourceRetainedBillableTimeInSeconds * InstanceCount``.

              
            

            - **ReusedByJob** *(string) --* 

              The name of the matching training job that reused the warm pool.

              
        
          

          - **TrainingPlanArn** *(string) --* 

            The Amazon Resource Name (ARN); of the training plan associated with this training job.

             

            For more information about how to reserve GPU capacity for your SageMaker HyperPod clusters using Amazon SageMaker Training Plan, see ``CreateTrainingPlan ``.

            
      
    
      

      - **NextToken** *(string) --* 

        If the response is truncated, SageMaker returns this token. To retrieve the next set of training jobs, use it in the subsequent request.

        
  