dstandish commented on a change in pull request #22260:
URL: https://github.com/apache/airflow/pull/22260#discussion_r830496651
##########
File path: airflow/models/taskfail.py
##########
@@ -28,22 +29,42 @@ class TaskFail(Base):
__tablename__ = "task_fail"
id = Column(Integer, primary_key=True)
- task_id = Column(String(ID_LEN, **COLLATION_ARGS), nullable=False)
- dag_id = Column(String(ID_LEN, **COLLATION_ARGS), nullable=False)
- execution_date = Column(UtcDateTime, nullable=False)
+ task_id = Column(StringID(), nullable=False)
+ dag_id = Column(StringID(), nullable=False)
+ run_id = Column(StringID(), nullable=False)
+ map_index = Column(Integer, server_default='-1', nullable=False)
start_date = Column(UtcDateTime)
end_date = Column(UtcDateTime)
duration = Column(Integer)
- __table_args__ = (Index('idx_task_fail_dag_task_date', dag_id, task_id,
execution_date, unique=False),)
+ __table_args__ = (
+ ForeignKeyConstraint(
+ [dag_id, task_id, run_id, map_index],
+ [
+ "task_instance.dag_id",
+ "task_instance.task_id",
+ "task_instance.run_id",
+ "task_instance.map_index",
+ ],
+ name='task_fail_ti_fkey',
+ ondelete="CASCADE",
+ ),
+ )
- def __init__(self, task, execution_date, start_date, end_date):
+ def __init__(self, task, run_id, start_date, end_date, map_index=None):
Review comment:
> Is a default needed here at all?
yeah was thinking that better to let it come from task instance.
--
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]