You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "dstandish (via GitHub)" <gi...@apache.org> on 2024/07/11 22:28:25 UTC

[PR] Add try_number to log table [airflow]

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

   Needed in order to be able to associate log records with specific TI try.
   
   **NOTE** I'm actually somewhat tempted to just create a separate log table for this kind of thing, e.g. `task_instance_event_log`.  Being smaller and having a narrower focus has advantages.  WDYT?


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


Re: [PR] Add try_number to log table [airflow]

Posted by "dstandish (via GitHub)" <gi...@apache.org>.
dstandish commented on PR #40739:
URL: https://github.com/apache/airflow/pull/40739#issuecomment-2233943462

   the one static check failure is in main; merging


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


Re: [PR] Add try_number to log table [airflow]

Posted by "uranusjr (via GitHub)" <gi...@apache.org>.
uranusjr commented on code in PR #40739:
URL: https://github.com/apache/airflow/pull/40739#discussion_r1675042570


##########
airflow/models/log.py:
##########
@@ -40,11 +40,13 @@ class Log(Base):
     owner = Column(String(500))
     owner_display_name = Column(String(500))
     extra = Column(Text)
+    try_number = Column(Integer)
 
     __table_args__ = (
         Index("idx_log_dag", dag_id),
         Index("idx_log_dttm", dttm),
         Index("idx_log_event", event),
+        Index("idx_log_task_instance", dag_id, task_id, run_id, map_index, try_number),

Review Comment:
   Sorry I’ve lost context on this… did we make try_number a part of the ti’s pk? (And do we want to?) It does not look like to be the case from the current model definition, but `try_number` _is_ a part of TaskInstance’s `key`. And here we’re implying (at least from the name) that try_number is a part of the ti’s identifier.



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


Re: [PR] Add try_number to log table [airflow]

Posted by "dstandish (via GitHub)" <gi...@apache.org>.
dstandish merged PR #40739:
URL: https://github.com/apache/airflow/pull/40739


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


Re: [PR] Add try_number to log table [airflow]

Posted by "uranusjr (via GitHub)" <gi...@apache.org>.
uranusjr commented on code in PR #40739:
URL: https://github.com/apache/airflow/pull/40739#discussion_r1675044180


##########
airflow/models/log.py:
##########
@@ -40,11 +40,13 @@ class Log(Base):
     owner = Column(String(500))
     owner_display_name = Column(String(500))
     extra = Column(Text)
+    try_number = Column(Integer)

Review Comment:
   This should probably have nullable=False?



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


Re: [PR] Add try_number to log table [airflow]

Posted by "dstandish (via GitHub)" <gi...@apache.org>.
dstandish commented on code in PR #40739:
URL: https://github.com/apache/airflow/pull/40739#discussion_r1675315022


##########
airflow/models/log.py:
##########
@@ -40,11 +40,13 @@ class Log(Base):
     owner = Column(String(500))
     owner_display_name = Column(String(500))
     extra = Column(Text)
+    try_number = Column(Integer)
 
     __table_args__ = (
         Index("idx_log_dag", dag_id),
         Index("idx_log_dttm", dttm),
         Index("idx_log_event", event),
+        Index("idx_log_task_instance", dag_id, task_id, run_id, map_index, try_number),

Review Comment:
   i don't really see it as implying that, but if you want to use a different name I don't mind.  
   
   the PK of the TI table is what it is, and there's nothing changing that here.  
   
   But the fact remains that the purpose here is to be able to log events specific to a try, and to be able to expose them on the UI.
   
   But now I'm thinking we should probably just add a task_instance_event_log and put all TI-related events there, and get them out of the main log table.  this would be more efficient.  log table is already quite large.  and we could separate the events that have nothing to do with TIs from the ones that are specific to TIs.  WDYT?



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


Re: [PR] Add try_number to log table [airflow]

Posted by "dstandish (via GitHub)" <gi...@apache.org>.
dstandish commented on code in PR #40739:
URL: https://github.com/apache/airflow/pull/40739#discussion_r1675313089


##########
airflow/models/log.py:
##########
@@ -40,11 +40,13 @@ class Log(Base):
     owner = Column(String(500))
     owner_display_name = Column(String(500))
     extra = Column(Text)
+    try_number = Column(Integer)

Review Comment:
   all the TI attrs must be nullable because not every log record in this table has something to do with a TI



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


Re: [PR] Add try_number to log table [airflow]

Posted by "dstandish (via GitHub)" <gi...@apache.org>.
dstandish commented on PR #40739:
URL: https://github.com/apache/airflow/pull/40739#issuecomment-2233853810

   > Once comment I had before - this will likely get people some new/unexpected records if they are using the API, but the likeloihood of it is small, so that would not be too breaking (and it could be easily workarounded by try_number not set. If that does not bother others - I am fine with it too
   
   Yeah I think getting more information has to be expected on the part of users, and the other way around would probably be more breaking!


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