ellisms commented on code in PR #33219: URL: https://github.com/apache/airflow/pull/33219#discussion_r1293625104
########## airflow/providers/amazon/aws/operators/sagemaker_notebook.py: ########## @@ -0,0 +1,287 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from __future__ import annotations + +from functools import cached_property +from typing import TYPE_CHECKING, Sequence + +from airflow.models import BaseOperator +from airflow.providers.amazon.aws.hooks.sagemaker_notebook import SageMakerNotebookHook + +if TYPE_CHECKING: + pass + + +class SageMakerCreateNotebookOperator(BaseOperator): + """ + Create a SageMaker notebook. + More information regarding parameters of this operator can be found here + https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sagemaker/client/create_notebook_instance.html. + + .. seealso: + For more information on how to use this operator, take a look at the guide: + :ref:`howto/operator:SageMakerCreateNotebookOperator` + + :param instance_name: The name of the notebook instance. + :param instance_type: The type of instance to create. + :param role_arn: The Amazon Resource Name (ARN) of the IAM role that SageMaker can assume to access + :param volume_size_in_gb: Size in GB of the EBS root device volume of the notebook instance. + :param volume_kms_key_id: The KMS key ID for the EBS root device volume. + :param tags: A list of tags to associate with the notebook instance. + :param subnet_id: The ID of the subnet in which to launch the instance. + :param security_group_ids: A list of security groups to associate with the notebook instance. + :param lifecycle_config_name: The name of the lifecycle configuration to associate with the notebook + :param direct_internet_access: Whether to enable direct internet access for the notebook instance. + :param accelerator_types: The list of Elastic Inference (EI) accelerator types to associate with the + :param default_code_repo: The URL of the Git repository that contains the default code for a notebook + :param additional_code_repos: A list of URLs for Git repositories that contain custom code for a notebook + :param root_access: Whether to give the notebook instance root access to the Amazon S3 bucket. + :param platform_id: The ID of the platform. + :param imds_config: The configuration for the instance metadata service. + :param wait_for_completion: Whether or not to wait for the notebook to be InService before returning + :param config: Additional configuration options for the create call. + :param aws_conn_id: The AWS connection ID to use. + + This operator returns The ARN of the created notebook. + """ + + template_fields: Sequence[str] = ("instance_name", "instance_type", "role_arn", "config") + + ui_color = "#ff7300" + + def __init__( Review Comment: I cutback the list of args to a much smaller list. Open to any feedback on the remaining items. I created a newcreate_instance_kwargs arg to supply additional args to boto3. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
