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/08/16 15:14:04 UTC

[GitHub] [airflow] kaxil commented on a change in pull request #17502: localize the run_id in dagrun

kaxil commented on a change in pull request #17502:
URL: https://github.com/apache/airflow/pull/17502#discussion_r689626038



##########
File path: airflow/models/dagrun.py
##########
@@ -286,7 +287,17 @@ def find(
     @staticmethod
     def generate_run_id(run_type: DagRunType, execution_date: datetime) -> str:
         """Generate Run ID based on Run Type and Execution Date"""
-        return f"{run_type}__{execution_date.isoformat()}"
+        from airflow.configuration import conf
+        local_run_id = conf.getboolean("core", "localize_dag_run_id", fallback=False)
+        if local_run_id:
+            local_time = pendulum.instance(execution_date).astimezone(tz=settings.TIMEZONE)
+            is_dst = local_time.is_dst()
+            if is_dst:
+                return f"{run_type}__{local_time.isoformat()}__DST"
+            else:
+                return f"{run_type}__{local_time.isoformat()}"
+        else:
+            return f"{run_type}__{execution_date.isoformat()}"

Review comment:
       This can have unintended consequences -- we will have to look closely.




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