Skip to content

create_app

create_app(
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    domain_id: Optional[DomainId] = None,
    user_profile_name: Optional[UserProfileName] = None,
    space_name: Optional[SpaceName] = None,
    app_type: Optional[AppType] = None,
    app_name: Optional[AppName] = None,
    tags: Optional[TagList] = None,
    resource_spec: Optional[ResourceSpec] = None,
    recovery_mode: Optional[Boolean] = None,
) -> CreateAppResponse

Creates a running app for the specified UserProfile. This operation is automatically invoked by Amazon SageMaker AI upon access to the associated Domain, and when new kernel configurations are selected by the user. A user may have multiple Apps active simultaneously.

Parameters:

  • domain_id (Optional[DomainId], default: None ) –

    The domain ID.

  • user_profile_name (Optional[UserProfileName], default: None ) –

    The user profile name. If this value is not set, then SpaceName must be set.

  • space_name (Optional[SpaceName], default: None ) –

    The name of the space. If this value is not set, then UserProfileName must be set.

  • app_type (Optional[AppType], default: None ) –

    The type of app.

  • app_name (Optional[AppName], default: None ) –

    The name of the app.

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

    Each tag consists of a key and an optional value. Tag keys must be unique per resource.

  • resource_spec (Optional[ResourceSpec], default: None ) –

    The instance type and the Amazon Resource Name (ARN) of the SageMaker AI image created on the instance.

    The value of InstanceType passed as part of the ResourceSpec in the CreateApp call overrides the value passed as part of the ResourceSpec configured for the user profile or the domain. If InstanceType is not specified in any of those three ResourceSpec values for a KernelGateway app, the CreateApp call fails with a request validation error.

  • recovery_mode (Optional[Boolean], default: None ) –

    Indicates whether the application is launched in recovery mode.

Raises:

  • ResourceInUse –

    Resource being accessed is in use.

  • ResourceLimitExceeded –

    You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_sagemaker/_services/sage_maker.py
def create_app(
    self,
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    domain_id: Optional["capo_sagemaker.types.domain_id.DomainId"] = None,
    user_profile_name: Optional[
        "capo_sagemaker.types.user_profile_name.UserProfileName"
    ] = None,
    space_name: Optional["capo_sagemaker.types.space_name.SpaceName"] = None,
    app_type: Optional["capo_sagemaker.types.app_type.AppType"] = None,
    app_name: Optional["capo_sagemaker.types.app_name.AppName"] = None,
    tags: Optional["capo_sagemaker.types.tag_list.TagList"] = None,
    resource_spec: Optional[
        "capo_sagemaker.types.resource_spec.ResourceSpec"
    ] = None,
    recovery_mode: Optional["capo_sagemaker.types.boolean.Boolean"] = None,
) -> "capo_sagemaker.types.create_app_response.CreateAppResponse":
    """<p>Creates a running app for the specified UserProfile. This operation is automatically invoked by Amazon SageMaker AI upon access to the associated Domain, and when new kernel configurations are selected by the user. A user may have multiple Apps active simultaneously.</p>

    Args:
        domain_id: <p>The domain ID.</p>
        user_profile_name: <p>The user profile name. If this value is not set, then <code>SpaceName</code> must be set.</p>
        space_name: <p>The name of the space. If this value is not set, then <code>UserProfileName</code> must be set.</p>
        app_type: <p>The type of app.</p>
        app_name: <p>The name of the app.</p>
        tags: <p>Each tag consists of a key and an optional value. Tag keys must be unique per resource.</p>
        resource_spec: <p>The instance type and the Amazon Resource Name (ARN) of the SageMaker AI image created on the instance.</p> <note> <p>The value of <code>InstanceType</code> passed as part of the <code>ResourceSpec</code> in the <code>CreateApp</code> call overrides the value passed as part of the <code>ResourceSpec</code> configured for the user profile or the domain. If <code>InstanceType</code> is not specified in any of those three <code>ResourceSpec</code> values for a <code>KernelGateway</code> app, the <code>CreateApp</code> call fails with a request validation error.</p> </note>
        recovery_mode: <p> Indicates whether the application is launched in recovery mode. </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.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_sagemaker.types.create_app_request.CreateAppRequest]",
    ) -> OperationResponse[
        "capo_sagemaker.types.create_app_response.CreateAppResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.create_app

        output, http_response = (
            capo_sagemaker._operations.sage_maker.create_app.create_app(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateApp")
    )
    input_: capo_sagemaker.types.create_app_request.CreateAppRequest = {}
    if domain_id is not None:
        input_["domain_id"] = domain_id
    if user_profile_name is not None:
        input_["user_profile_name"] = user_profile_name
    if space_name is not None:
        input_["space_name"] = space_name
    if app_type is not None:
        input_["app_type"] = app_type
    if app_name is not None:
        input_["app_name"] = app_name
    if tags is not None:
        input_["tags"] = tags
    if resource_spec is not None:
        input_["resource_spec"] = resource_spec
    if recovery_mode is not None:
        input_["recovery_mode"] = recovery_mode

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output