list_training_jobs(
*,
config_overrides: Optional[AsyncSageMakerClientConfig] = None,
next_token: Optional[NextToken] = None,
max_results: Optional[MaxResults] = None,
creation_time_after: Optional[Timestamp] = None,
creation_time_before: Optional[Timestamp] = None,
last_modified_time_after: Optional[Timestamp] = None,
last_modified_time_before: Optional[Timestamp] = None,
name_contains: Optional[NameContains] = None,
status_equals: Optional[TrainingJobStatus] = None,
sort_by: Optional[SortBy] = None,
sort_order: Optional[SortOrder] = None,
warm_pool_status_equals: Optional[WarmPoolResourceStatus] = None,
training_plan_arn_equals: Optional[TrainingPlanArn] = None,
) -> ListTrainingJobsResponse
Lists training jobs.
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
Parameters:
-
next_token
(Optional[NextToken], default:
None
)
–
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.
-
max_results
(Optional[MaxResults], default:
None
)
–
The maximum number of training jobs to return in the response.
-
creation_time_after
(Optional[Timestamp], default:
None
)
–
A filter that returns only training jobs created after the specified time (timestamp).
-
creation_time_before
(Optional[Timestamp], default:
None
)
–
A filter that returns only training jobs created before the specified time (timestamp).
-
last_modified_time_after
(Optional[Timestamp], default:
None
)
–
A filter that returns only training jobs modified after the specified time (timestamp).
-
last_modified_time_before
(Optional[Timestamp], default:
None
)
–
A filter that returns only training jobs modified before the specified time (timestamp).
-
name_contains
(Optional[NameContains], default:
None
)
–
A string in the training job name. This filter returns only training jobs whose name contains the specified string.
-
status_equals
(Optional[TrainingJobStatus], default:
None
)
–
A filter that retrieves only training jobs with a specific status.
-
sort_by
(Optional[SortBy], default:
None
)
–
The field to sort results by. The default is CreationTime.
-
sort_order
(Optional[SortOrder], default:
None
)
–
The sort order for results. The default is Ascending.
-
warm_pool_status_equals
(Optional[WarmPoolResourceStatus], default:
None
)
–
A filter that retrieves only training jobs with a specific warm pool status.
-
training_plan_arn_equals
(Optional[TrainingPlanArn], default:
None
)
–
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 .
Raises:
Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
| async def list_training_jobs(
self,
*,
config_overrides: Optional[AsyncSageMakerClientConfig] = None,
next_token: Optional["capo_sagemaker.types.next_token.NextToken"] = None,
max_results: Optional["capo_sagemaker.types.max_results.MaxResults"] = None,
creation_time_after: Optional[
"capo_sagemaker.types.timestamp.Timestamp"
] = None,
creation_time_before: Optional[
"capo_sagemaker.types.timestamp.Timestamp"
] = None,
last_modified_time_after: Optional[
"capo_sagemaker.types.timestamp.Timestamp"
] = None,
last_modified_time_before: Optional[
"capo_sagemaker.types.timestamp.Timestamp"
] = None,
name_contains: Optional[
"capo_sagemaker.types.name_contains.NameContains"
] = None,
status_equals: Optional[
"capo_sagemaker.types.training_job_status.TrainingJobStatus"
] = None,
sort_by: Optional["capo_sagemaker.types.sort_by.SortBy"] = None,
sort_order: Optional["capo_sagemaker.types.sort_order.SortOrder"] = None,
warm_pool_status_equals: Optional[
"capo_sagemaker.types.warm_pool_resource_status.WarmPoolResourceStatus"
] = None,
training_plan_arn_equals: Optional[
"capo_sagemaker.types.training_plan_arn.TrainingPlanArn"
] = None,
) -> "capo_sagemaker.types.list_training_jobs_response.ListTrainingJobsResponse":
"""<p>Lists training jobs.</p> <note> <p>When <code>StatusEquals</code> and <code>MaxResults</code> are set at the same time, the <code>MaxResults</code> number of training jobs are first retrieved ignoring the <code>StatusEquals</code> parameter and then they are filtered by the <code>StatusEquals</code> parameter, which is returned as a response.</p> <p>For example, if <code>ListTrainingJobs</code> is invoked with the following parameters:</p> <p> <code>{ ... MaxResults: 100, StatusEquals: InProgress ... }</code> </p> <p>First, 100 trainings jobs with any status, including those other than <code>InProgress</code>, are selected (sorted according to the creation time, from the most current to the oldest). Next, those with a status of <code>InProgress</code> are returned.</p> <p>You can quickly test the API using the following Amazon Web Services CLI code.</p> <p> <code>aws sagemaker list-training-jobs --max-results 100 --status-equals InProgress</code> </p> </note>
Args:
next_token: <p>If the result of the previous <code>ListTrainingJobs</code> request was truncated, the response includes a <code>NextToken</code>. To retrieve the next set of training jobs, use the token in the next request. </p>
max_results: <p>The maximum number of training jobs to return in the response.</p>
creation_time_after: <p>A filter that returns only training jobs created after the specified time (timestamp).</p>
creation_time_before: <p>A filter that returns only training jobs created before the specified time (timestamp).</p>
last_modified_time_after: <p>A filter that returns only training jobs modified after the specified time (timestamp).</p>
last_modified_time_before: <p>A filter that returns only training jobs modified before the specified time (timestamp).</p>
name_contains: <p>A string in the training job name. This filter returns only training jobs whose name contains the specified string.</p>
status_equals: <p>A filter that retrieves only training jobs with a specific status.</p>
sort_by: <p>The field to sort results by. The default is <code>CreationTime</code>.</p>
sort_order: <p>The sort order for results. The default is <code>Ascending</code>.</p>
warm_pool_status_equals: <p>A filter that retrieves only training jobs with a specific warm pool status.</p>
training_plan_arn_equals: <p>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 <code> <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateTrainingPlan.html">CreateTrainingPlan</a> </code>.</p>
Raises:
capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_sagemaker.types.list_training_jobs_request.ListTrainingJobsRequest]",
) -> AsyncOperationResponse[
"capo_sagemaker.types.list_training_jobs_response.ListTrainingJobsResponse"
]:
import capo_sagemaker._operations.sage_maker.list_training_jobs
(
output,
http_response,
) = await capo_sagemaker._operations.sage_maker.list_training_jobs.async_list_training_jobs(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("ListTrainingJobs")
)
input_: capo_sagemaker.types.list_training_jobs_request.ListTrainingJobsRequest = {}
if next_token is not None:
input_["next_token"] = next_token
if max_results is not None:
input_["max_results"] = max_results
if creation_time_after is not None:
input_["creation_time_after"] = creation_time_after
if creation_time_before is not None:
input_["creation_time_before"] = creation_time_before
if last_modified_time_after is not None:
input_["last_modified_time_after"] = last_modified_time_after
if last_modified_time_before is not None:
input_["last_modified_time_before"] = last_modified_time_before
if name_contains is not None:
input_["name_contains"] = name_contains
if status_equals is not None:
input_["status_equals"] = status_equals
if sort_by is not None:
input_["sort_by"] = sort_by
if sort_order is not None:
input_["sort_order"] = sort_order
if warm_pool_status_equals is not None:
input_["warm_pool_status_equals"] = warm_pool_status_equals
if training_plan_arn_equals is not None:
input_["training_plan_arn_equals"] = training_plan_arn_equals
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|