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 2021/02/25 13:26:04 UTC

[GitHub] [airflow] RikHeijdens commented on a change in pull request #14452: Gracefully handle missing start_date and end_date for DagRun

RikHeijdens commented on a change in pull request #14452:
URL: https://github.com/apache/airflow/pull/14452#discussion_r582829692



##########
File path: airflow/www/views.py
##########
@@ -3302,7 +3302,7 @@ class DagRunModelView(AirflowModelView):
         'external_trigger',
         'conf',
     ]
-    edit_columns = ['state', 'dag_id', 'execution_date', 'run_id', 'conf']
+    edit_columns = ['state', 'dag_id', 'execution_date', 'start_date', 'end_date', 'run_id', 'conf']

Review comment:
       Sure! Happy to clarify why I choose to venture down this route.
   
   The [`DagRunEditForm`](https://github.com/apache/airflow/blob/master/airflow/www/forms.py#L172-L173) contains the `start_date` and `end_date` fields, and these are supposed to be "read-only" as they use [`AirflowDateTimePickerROWidget`](https://github.com/apache/airflow/blob/45e72ca83049a7db526b1f0fbd94c75f5f92cc75/airflow/www/widgets.py#L51).
   
   However, what would happen when I would use the `DagRunEditForm` through the Web UI is that the `start_date` and `end_date` would be set to `NULL` when submitting the form (even if they were set previously). This happened because `start_date` and `end_date` are not contained in the `edit_columns` list, and thus the form would not contain any data for them and overwrite old values.
   
   By adding `start_date` and `end_date` as entries to `edit_columns` columns, the widget displays them as "read-only" in the form, and no longer nulls them out when the form is submitted.
   
   Note that any DagRun that is in the `running` state, but does not have a `start_date` set may cause a scheduler crash. This crash is avoided by https://github.com/apache/airflow/pull/14452/commits/a780e8a029c3801cd60da784fcf0b7af2c58bf13.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org