listTrainingJobs method

Future<ListTrainingJobsResponse> listTrainingJobs({
  1. DateTime? creationTimeAfter,
  2. DateTime? creationTimeBefore,
  3. DateTime? lastModifiedTimeAfter,
  4. DateTime? lastModifiedTimeBefore,
  5. int? maxResults,
  6. String? nameContains,
  7. String? nextToken,
  8. SortBy? sortBy,
  9. SortOrder? sortOrder,
  10. TrainingJobStatus? statusEquals,
  11. String? trainingPlanArnEquals,
  12. WarmPoolResourceStatus? warmPoolStatusEquals,
})

Lists training jobs.

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

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

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

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

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

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

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

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

Parameter sortBy : The field to sort results by. The default is CreationTime.

Parameter sortOrder : The sort order for results. The default is Ascending.

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

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

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

Implementation

Future<ListTrainingJobsResponse> listTrainingJobs({
  DateTime? creationTimeAfter,
  DateTime? creationTimeBefore,
  DateTime? lastModifiedTimeAfter,
  DateTime? lastModifiedTimeBefore,
  int? maxResults,
  String? nameContains,
  String? nextToken,
  SortBy? sortBy,
  SortOrder? sortOrder,
  TrainingJobStatus? statusEquals,
  String? trainingPlanArnEquals,
  WarmPoolResourceStatus? warmPoolStatusEquals,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.ListTrainingJobs'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (creationTimeAfter != null)
        'CreationTimeAfter': unixTimestampToJson(creationTimeAfter),
      if (creationTimeBefore != null)
        'CreationTimeBefore': unixTimestampToJson(creationTimeBefore),
      if (lastModifiedTimeAfter != null)
        'LastModifiedTimeAfter': unixTimestampToJson(lastModifiedTimeAfter),
      if (lastModifiedTimeBefore != null)
        'LastModifiedTimeBefore': unixTimestampToJson(lastModifiedTimeBefore),
      if (maxResults != null) 'MaxResults': maxResults,
      if (nameContains != null) 'NameContains': nameContains,
      if (nextToken != null) 'NextToken': nextToken,
      if (sortBy != null) 'SortBy': sortBy.value,
      if (sortOrder != null) 'SortOrder': sortOrder.value,
      if (statusEquals != null) 'StatusEquals': statusEquals.value,
      if (trainingPlanArnEquals != null)
        'TrainingPlanArnEquals': trainingPlanArnEquals,
      if (warmPoolStatusEquals != null)
        'WarmPoolStatusEquals': warmPoolStatusEquals.value,
    },
  );

  return ListTrainingJobsResponse.fromJson(jsonResponse.body);
}