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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]