Gabriel39 commented on a change in pull request #17181:
URL: https://github.com/apache/airflow/pull/17181#discussion_r678274216



##########
File path: airflow/models/event_note.py
##########
@@ -0,0 +1,190 @@
+#
+# 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.
+import logging
+from typing import Any, Iterable, Optional, Union
+
+import pendulum
+from sqlalchemy import Column, Integer, String, Text, and_
+from sqlalchemy.orm import Query, Session
+
+from airflow.models.base import COLLATION_ARGS, ID_LEN, Base
+from airflow.utils.helpers import is_container
+from airflow.utils.session import provide_session
+from airflow.utils.sqlalchemy import UtcDateTime
+
+log = logging.getLogger(__name__)
+
+
+class EventNote(Base):
+    """Model that stores a note for an event"""
+
+    __tablename__ = "event_note"
+
+    id = Column(Integer, primary_key=True)
+
+    dag_id = Column(String(ID_LEN, **COLLATION_ARGS))
+    task_id = Column(String(ID_LEN), nullable=True)
+    execution_date = Column(UtcDateTime, nullable=True)
+    timestamp = Column(UtcDateTime, nullable=True)
+    event = Column(String(30), nullable=True)
+    owner = Column(String(30), nullable=True)
+    event_note = Column(Text)
+
+    def __repr__(self):
+        return str(self.__key())
+
+    def __key(self):
+        return (
+            self.dag_id,
+            self.task_id,
+            self.execution_date,
+            self.timestamp,
+            self.owner,
+            self.event,
+            self.event_note,
+        )
+
+    @classmethod
+    @provide_session
+    def get_one(
+        cls,
+        execution_date: pendulum.DateTime = None,
+        timestamp: pendulum.DateTime = None,
+        owners: Optional[Union[str, Iterable[str]]] = None,
+        task_ids: Optional[Union[str, Iterable[str]]] = None,
+        events: Optional[Union[str, Iterable[str]]] = None,
+        dag_ids: Optional[Union[str, Iterable[str]]] = None,
+        session: Session = None,
+    ) -> Optional[Any]:
+        """
+        Retrieve a TaskNote value, optionally meeting certain criteria. 
Returns None
+        of there are no results.
+
+        :param execution_date: Execution date for the task
+        :type execution_date: pendulum.datetime
+        :param task_ids: Only TaskNotes from task with matching id will be

Review comment:
       I think reorder this comments according to parameters order is better

##########
File path: tests/www/views/test_views_event_note.py
##########
@@ -0,0 +1,172 @@
+#
+# 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.
+
+# import pytest
+#
+# from airflow.models import DagBag, DagRun, TaskInstance, EventNote
+# from airflow.utils import timezone
+# from airflow.utils.session import create_session
+# from airflow.utils.state import State
+# from tests.test_utils.www import check_content_in_response
+#
+#
+# @pytest.fixture(scope="module", autouse=True)

Review comment:
       why commented this file ?




-- 
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]


Reply via email to