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 2022/11/23 19:29:37 UTC

[GitHub] [airflow] dstandish opened a new pull request, #27867: Use "note" instead of "note" in API re dag run / task instance notes

dstandish opened a new pull request, #27867:
URL: https://github.com/apache/airflow/pull/27867

   This is a followup to https://github.com/apache/airflow/pull/27849, and it leaves just a tiny bit of room for adding multiple notes in the future (and is _marginally_ more accurate in the meantime)


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


[GitHub] [airflow] pierrejeambrun commented on a diff in pull request #27867: Use "note" instead of "notes" in API re dag run / task instance notes

Posted by GitBox <gi...@apache.org>.
pierrejeambrun commented on code in PR #27867:
URL: https://github.com/apache/airflow/pull/27867#discussion_r1031159928


##########
airflow/models/taskinstance.py:
##########
@@ -313,6 +313,17 @@ def key(self) -> TaskInstanceKey:
         return self
 
 
+def _creator_note(val):
+    """Custom creator for the ``note`` association proxy."""
+    # breakpoint()

Review Comment:
   Vestige of debugging session I guess :p 



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


[GitHub] [airflow] dstandish commented on a diff in pull request #27867: Use "note" instead of "notes" in API re dag run / task instance notes

Posted by GitBox <gi...@apache.org>.
dstandish commented on code in PR #27867:
URL: https://github.com/apache/airflow/pull/27867#discussion_r1031235863


##########
airflow/models/dagrun.py:
##########
@@ -1295,3 +1307,41 @@ def get_log_filename_template(self, *, session: Session = NEW_SESSION) -> str:
             stacklevel=2,
         )
         return self.get_log_template(session=session).filename
+
+
+class DagRunNote(Base):
+    """For storage of arbitrary notes concerning the dagrun instance."""
+
+    __tablename__ = "dag_run_note"
+
+    user_id = Column(Integer, nullable=True)
+    dag_run_id = Column(Integer, primary_key=True, nullable=False)
+    content = Column(String(1000).with_variant(Text(1000), "mysql"))
+    created_at = Column(UtcDateTime, default=timezone.utcnow, nullable=False)
+    updated_at = Column(UtcDateTime, default=timezone.utcnow, onupdate=timezone.utcnow, nullable=False)
+
+    dag_run = relationship("DagRun", back_populates="dag_run_note")
+
+    __table_args__ = (
+        ForeignKeyConstraint(
+            (dag_run_id,),
+            ["dag_run.id"],
+            name="dag_run_note_dr_fkey",
+            ondelete="CASCADE",
+        ),
+        ForeignKeyConstraint(
+            (user_id,),
+            ["ab_user.id"],
+            name="dag_run_note_user_fkey",
+        ),
+    )
+
+    def __init__(self, content, user_id=None):

Review Comment:
   Required for creator



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


[GitHub] [airflow] pierrejeambrun commented on a diff in pull request #27867: Use "note" instead of "notes" in API re dag run / task instance notes

Posted by GitBox <gi...@apache.org>.
pierrejeambrun commented on code in PR #27867:
URL: https://github.com/apache/airflow/pull/27867#discussion_r1031159928


##########
airflow/models/taskinstance.py:
##########
@@ -313,6 +313,17 @@ def key(self) -> TaskInstanceKey:
         return self
 
 
+def _creator_note(val):
+    """Custom creator for the ``note`` association proxy."""
+    # breakpoint()

Review Comment:
   Vestige or debugging session I guess :p 



##########
airflow/models/dagrun.py:
##########
@@ -1295,3 +1307,41 @@ def get_log_filename_template(self, *, session: Session = NEW_SESSION) -> str:
             stacklevel=2,
         )
         return self.get_log_template(session=session).filename
+
+
+class DagRunNote(Base):
+    """For storage of arbitrary notes concerning the dagrun instance."""
+
+    __tablename__ = "dag_run_note"
+
+    user_id = Column(Integer, nullable=True)
+    dag_run_id = Column(Integer, primary_key=True, nullable=False)
+    content = Column(String(1000).with_variant(Text(1000), "mysql"))
+    created_at = Column(UtcDateTime, default=timezone.utcnow, nullable=False)
+    updated_at = Column(UtcDateTime, default=timezone.utcnow, onupdate=timezone.utcnow, nullable=False)
+
+    dag_run = relationship("DagRun", back_populates="dag_run_note")
+
+    __table_args__ = (
+        ForeignKeyConstraint(
+            (dag_run_id,),
+            ["dag_run.id"],
+            name="dag_run_note_dr_fkey",
+            ondelete="CASCADE",
+        ),
+        ForeignKeyConstraint(
+            (user_id,),
+            ["ab_user.id"],
+            name="dag_run_note_user_fkey",
+        ),
+    )
+
+    def __init__(self, content, user_id=None):

Review Comment:
   Just wondering, why do we need a custom constructor here? 



##########
airflow/models/dagrun.py:
##########
@@ -85,6 +87,17 @@ class TISchedulingDecision(NamedTuple):
     finished_tis: list[TI]
 
 
+def _creator_note(val):
+    """Custom creator for the ``note`` association proxy."""
+    # breakpoint()

Review Comment:
   Same for the breakpoint comment. Should the name be reversed _note_creator ?



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


[GitHub] [airflow] ephraimbuddy merged pull request #27867: Use "note" instead of "notes" in API re dag run / task instance notes

Posted by GitBox <gi...@apache.org>.
ephraimbuddy merged PR #27867:
URL: https://github.com/apache/airflow/pull/27867


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


[GitHub] [airflow] dstandish commented on a diff in pull request #27867: Use "note" instead of "notes" in API re dag run / task instance notes

Posted by GitBox <gi...@apache.org>.
dstandish commented on code in PR #27867:
URL: https://github.com/apache/airflow/pull/27867#discussion_r1031235523


##########
airflow/models/dagrun.py:
##########
@@ -85,6 +87,17 @@ class TISchedulingDecision(NamedTuple):
     finished_tis: list[TI]
 
 
+def _creator_note(val):
+    """Custom creator for the ``note`` association proxy."""
+    # breakpoint()

Review Comment:
   <general>_<specific>



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


[GitHub] [airflow] dstandish commented on a diff in pull request #27867: Use "note" instead of "notes" in API re dag run / task instance notes

Posted by GitBox <gi...@apache.org>.
dstandish commented on code in PR #27867:
URL: https://github.com/apache/airflow/pull/27867#discussion_r1031235523


##########
airflow/models/dagrun.py:
##########
@@ -85,6 +87,17 @@ class TISchedulingDecision(NamedTuple):
     finished_tis: list[TI]
 
 
+def _creator_note(val):
+    """Custom creator for the ``note`` association proxy."""
+    # breakpoint()

Review Comment:
   `<general>_<specific>`



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