You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2023/01/11 17:52:16 UTC

[GitHub] [airflow] vandonr-amz commented on a diff in pull request #28837: new operator to create a sagemaker experiment

vandonr-amz commented on code in PR #28837:
URL: https://github.com/apache/airflow/pull/28837#discussion_r1067292233


##########
airflow/providers/amazon/aws/operators/sagemaker.py:
##########
@@ -1049,3 +1050,54 @@ def execute(self, context: Context) -> dict | None:
             self.check_interval,
         )
         return best
+
+
+class SageMakerCreateExperimentOperator(SageMakerBaseOperator):
+    """
+    Creates a SageMaker experiment, to be then associated to jobs etc.
+
+    .. seealso::
+        For more information on how to use this operator, take a look at the guide:
+        :ref:`howto/operator:SageMakerCreateExperimentOperator`
+
+    :param name: name of the experiment, must be unique within the AWS account
+    :param description: description of the experiment, optional
+    :param tags: tags to attach to the experiment, optional
+
+    :returns: the ARN of the experiment created, though experiments are referred to by name
+    """
+
+    template_fields: Sequence[str] = (
+        "name",
+        "description",
+        "tags",
+    )
+
+    def __init__(
+        self,
+        *,
+        name: str,
+        description: str | None = None,
+        tags: dict | None = None,
+        aws_conn_id: str = DEFAULT_CONN_ID,
+        **kwargs,
+    ):
+        super().__init__(config={}, aws_conn_id=aws_conn_id, **kwargs)
+        self.name = name
+        self.description = description
+        if tags:
+            self.tags_set = [{"Key": kvp[0], "Value": kvp[1]} for kvp in tags.items()]
+        else:
+            self.tags_set = []

Review Comment:
   ah good point, I'll change that (and in the other PR as you mentioned)



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org