uranusjr commented on a change in pull request #16931:
URL: https://github.com/apache/airflow/pull/16931#discussion_r702607664



##########
File path: airflow/models/dag.py
##########
@@ -2521,6 +2521,10 @@ def __init__(self, concurrency=None, **kwargs):
     def __repr__(self):
         return f"<DAG: {self.dag_id}>"
 
+    @cached_property
+    def timetable(self) -> Timetable:
+        return create_timetable(self.schedule_interval, self.timezone)

Review comment:
       This is wrong. After #17414, a DAG instance now has a timetable 
_attribute_ and this is not needed (in fact this property will break existing 
code).

##########
File path: airflow/www/templates/airflow/dag.html
##########
@@ -91,11 +91,15 @@ <h4 class="pull-right" style="user-select: 
none;-moz-user-select: auto;">
       <a class="label label-default" href="{{ url_for('DagRunModelView.list') 
}}?_flt_3_dag_id={{ dag.dag_id }}">
         Schedule: {{ dag.schedule_interval }}
       </a>
+      {% if dag.timetable.interval_description is not none %}
+      <span id="schedule-description-{{ dag.safe_dag_id }}" 
class="material-icons text-muted js-tooltip" aria-hidden="true" 
data-original-title="Runs: {{ dag.timetable.interval_description|string 
}}">info</span>
+      {% endif %}

Review comment:
       `dag` here is not always a `DAG` object, but may be a `DagModel`. So 
this will not work. You need to introduce a common interface across `DAG` and 
`DagModel` instead of accessing `timetable` directly. See 
`DAG.bulk_write_to_db()` for how `DAG` attributes are written to corresponding 
`DagModel` attributes.




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