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



##########
File path: airflow/models/taskinstance.py
##########
@@ -2237,27 +2237,40 @@ def xcom_push(
         :param value: A value for the XCom. The value is pickled and stored
             in the database.
         :type value: any picklable object
-        :param execution_date: if provided, the XCom will not be visible until
-            this date. This can be used, for example, to send a message to a
-            task on a future date without it being immediately visible.
+        :param execution_date: Deprecated parameter.
         :type execution_date: datetime
         :param session: Sqlalchemy ORM Session
         :type session: Session
         """
-        self_execution_date = self.get_dagrun(session).execution_date
-        if execution_date and execution_date < self_execution_date:
-            raise ValueError(
-                f'execution_date can not be in the past (current 
execution_date is '
-                f'{self_execution_date}; received {execution_date})'
-            )
+        run_id = None
+        if execution_date:
+            self_execution_date = self.get_dagrun(session).execution_date
+            if execution_date < self_execution_date:
+                raise ValueError(
+                    f'execution_date can not be in the past (current 
execution_date is '
+                    f'{self_execution_date}; received {execution_date})'
+                )
+            elif execution_date != self_execution_date:
+                warnings.warn(
+                    "Passing `execution_date` parameter to xcom_push is 
deprecated.",
+                    DeprecationWarning,
+                    stacklevel=3,
+                )

Review comment:
       I made this unconditionally warn instead.




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