listTrainingJobsForHyperParameterTuningJob method

Future<ListTrainingJobsForHyperParameterTuningJobResponse> listTrainingJobsForHyperParameterTuningJob({
  1. required String hyperParameterTuningJobName,
  2. int? maxResults,
  3. String? nextToken,
  4. TrainingJobSortByOptions? sortBy,
  5. SortOrder? sortOrder,
  6. TrainingJobStatus? statusEquals,
})

Gets a list of TrainingJobSummary objects that describe the training jobs that a hyperparameter tuning job launched.

May throw ResourceNotFound.

Parameter hyperParameterTuningJobName : The name of the tuning job whose training jobs you want to list.

Parameter maxResults : The maximum number of training jobs to return. The default value is 10.

Parameter nextToken : If the result of the previous ListTrainingJobsForHyperParameterTuningJob 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 Name.

If the value of this field is FinalObjectiveMetricValue, any training jobs that did not return an objective metric are not listed.

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

Parameter statusEquals : A filter that returns only training jobs with the specified status.

Implementation

Future<ListTrainingJobsForHyperParameterTuningJobResponse>
    listTrainingJobsForHyperParameterTuningJob({
  required String hyperParameterTuningJobName,
  int? maxResults,
  String? nextToken,
  TrainingJobSortByOptions? sortBy,
  SortOrder? sortOrder,
  TrainingJobStatus? statusEquals,
}) async {
  ArgumentError.checkNotNull(
      hyperParameterTuningJobName, 'hyperParameterTuningJobName');
  _s.validateStringLength(
    'hyperParameterTuningJobName',
    hyperParameterTuningJobName,
    1,
    32,
    isRequired: true,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    0,
    8192,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.ListTrainingJobsForHyperParameterTuningJob'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'HyperParameterTuningJobName': hyperParameterTuningJobName,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (sortBy != null) 'SortBy': sortBy.toValue(),
      if (sortOrder != null) 'SortOrder': sortOrder.toValue(),
      if (statusEquals != null) 'StatusEquals': statusEquals.toValue(),
    },
  );

  return ListTrainingJobsForHyperParameterTuningJobResponse.fromJson(
      jsonResponse.body);
}