Skip to content

create_training_plan async

create_training_plan(
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    training_plan_name: Optional[TrainingPlanName] = None,
    training_plan_offering_id: Optional[TrainingPlanOfferingId] = None,
    spare_instance_count_per_ultra_server: Optional[
        SpareInstanceCountPerUltraServer
    ] = None,
    tags: Optional[TagList] = None,
) -> CreateTrainingPlanResponse

Creates a new training plan in SageMaker to reserve compute capacity.

Amazon SageMaker Training Plan is a capability within SageMaker that allows customers to reserve and manage GPU capacity for large-scale AI model training. It provides a way to secure predictable access to computational resources within specific timelines and budgets, without the need to manage underlying infrastructure.

How it works

Plans can be created for specific resources such as SageMaker Training Jobs or SageMaker HyperPod clusters, automatically provisioning resources, setting up infrastructure, executing workloads, and handling infrastructure failures.

Plan creation workflow

  • Users search for available plan offerings based on their requirements (e.g., instance type, count, start time, duration) using the SearchTrainingPlanOfferings API operation.

  • They create a plan that best matches their needs using the ID of the plan offering they want to use.

  • After successful upfront payment, the plan's status becomes Scheduled.

  • The plan can be used to:

    • Queue training jobs.

    • Allocate to an instance group of a SageMaker HyperPod cluster.

  • When the plan start date arrives, it becomes Active. Based on available reserved capacity:

    • Training jobs are launched.

    • Instance groups are provisioned.

Plan composition

A plan can consist of one or more Reserved Capacities, each defined by a specific instance type, quantity, Availability Zone, duration, and start and end times. For more information about Reserved Capacity, see ReservedCapacitySummary .

Parameters:

  • training_plan_name (Optional[TrainingPlanName], default: None ) –

    The name of the training plan to create.

  • training_plan_offering_id (Optional[TrainingPlanOfferingId], default: None ) –

    The unique identifier of the training plan offering to use for creating this plan.

  • spare_instance_count_per_ultra_server (Optional[SpareInstanceCountPerUltraServer], default: None ) –

    Number of spare instances to reserve per UltraServer for enhanced resiliency. Default is 1.

  • tags (Optional[TagList], default: None ) –

    An array of key-value pairs to apply to this training plan.

Raises:

Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
async def create_training_plan(
    self,
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    training_plan_name: Optional[
        "capo_sagemaker.types.training_plan_name.TrainingPlanName"
    ] = None,
    training_plan_offering_id: Optional[
        "capo_sagemaker.types.training_plan_offering_id.TrainingPlanOfferingId"
    ] = None,
    spare_instance_count_per_ultra_server: Optional[
        "capo_sagemaker.types.spare_instance_count_per_ultra_server.SpareInstanceCountPerUltraServer"
    ] = None,
    tags: Optional["capo_sagemaker.types.tag_list.TagList"] = None,
) -> (
    "capo_sagemaker.types.create_training_plan_response.CreateTrainingPlanResponse"
):
    """<p>Creates a new training plan in SageMaker to reserve compute capacity.</p> <p>Amazon SageMaker Training Plan is a capability within SageMaker that allows customers to reserve and manage GPU capacity for large-scale AI model training. It provides a way to secure predictable access to computational resources within specific timelines and budgets, without the need to manage underlying infrastructure. </p> <p> <b>How it works</b> </p> <p>Plans can be created for specific resources such as SageMaker Training Jobs or SageMaker HyperPod clusters, automatically provisioning resources, setting up infrastructure, executing workloads, and handling infrastructure failures.</p> <p> <b>Plan creation workflow</b> </p> <ul> <li> <p>Users search for available plan offerings based on their requirements (e.g., instance type, count, start time, duration) using the <code> <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_SearchTrainingPlanOfferings.html">SearchTrainingPlanOfferings</a> </code> API operation.</p> </li> <li> <p>They create a plan that best matches their needs using the ID of the plan offering they want to use. </p> </li> <li> <p>After successful upfront payment, the plan's status becomes <code>Scheduled</code>. </p> </li> <li> <p>The plan can be used to:</p> <ul> <li> <p>Queue training jobs.</p> </li> <li> <p>Allocate to an instance group of a SageMaker HyperPod cluster. </p> </li> </ul> </li> <li> <p>When the plan start date arrives, it becomes <code>Active</code>. Based on available reserved capacity:</p> <ul> <li> <p>Training jobs are launched.</p> </li> <li> <p>Instance groups are provisioned.</p> </li> </ul> </li> </ul> <p> <b>Plan composition</b> </p> <p>A plan can consist of one or more Reserved Capacities, each defined by a specific instance type, quantity, Availability Zone, duration, and start and end times. For more information about Reserved Capacity, see <code> <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ReservedCapacitySummary.html">ReservedCapacitySummary</a> </code>.</p>

    Args:
        training_plan_name: <p>The name of the training plan to create.</p>
        training_plan_offering_id: <p>The unique identifier of the training plan offering to use for creating this plan.</p>
        spare_instance_count_per_ultra_server: <p>Number of spare instances to reserve per UltraServer for enhanced resiliency. Default is 1.</p>
        tags: <p>An array of key-value pairs to apply to this training plan.</p>

    Raises:
        capo_sagemaker.errors.resource_in_use.ResourceInUse: <p>Resource being accessed is in use.</p>
        capo_sagemaker.errors.resource_limit_exceeded.ResourceLimitExceeded: <p> You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created. </p>
        capo_sagemaker.errors.resource_not_found.ResourceNotFound: <p>Resource being access is not found.</p>
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sagemaker.types.create_training_plan_request.CreateTrainingPlanRequest]",
    ) -> AsyncOperationResponse[
        "capo_sagemaker.types.create_training_plan_response.CreateTrainingPlanResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.create_training_plan

        (
            output,
            http_response,
        ) = await capo_sagemaker._operations.sage_maker.create_training_plan.async_create_training_plan(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateTrainingPlan")
    )
    input_: capo_sagemaker.types.create_training_plan_request.CreateTrainingPlanRequest = {}
    if training_plan_name is not None:
        input_["training_plan_name"] = training_plan_name
    if training_plan_offering_id is not None:
        input_["training_plan_offering_id"] = training_plan_offering_id
    if spare_instance_count_per_ultra_server is not None:
        input_["spare_instance_count_per_ultra_server"] = (
            spare_instance_count_per_ultra_server
        )
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output