uranusjr commented on a change in pull request #16352: URL: https://github.com/apache/airflow/pull/16352#discussion_r679621592
########## File path: airflow/models/taskinstance.py ########## @@ -1670,37 +1667,97 @@ def get( except AirflowNotFoundException: return default_conn + def deprecated_proxy(func, *, key, replacement=None) -> lazy_object_proxy.Proxy: + def deprecated_func(): + message = ( + f"Accessing {key!r} from the template is deprecated and " + f"will be removed in a future version." + ) + if replacement: + message += f" Please use {replacement!r} instead." + warnings.warn(message, DeprecationWarning) + return func() + + return lazy_object_proxy.Proxy(deprecated_func) + + def get_previous_schedule_date() -> Optional[pendulum.DateTime]: + ti = self.get_previous_ti(None) + if ti is None: + return None + return timezone.coerce_datetime(ti.execution_date) + + def get_prev_execution_date(): + if dag_run.external_trigger: + dt = self.execution_date + else: + dt = task.dag.previous_schedule(self.execution_date) + return timezone.coerce_datetime(dt) Review comment: This function is used to populate `prev_execution_date`, `prev_ds`, etc., all of them also deprecated. If the user fixes them, this one will go away as well 🙂 But yeah it’s not a bad idea to suppress this, there’s no need to show two deprecation messages for one thing. -- 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-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org