ashb commented on a change in pull request #18084:
URL: https://github.com/apache/airflow/pull/18084#discussion_r705205014



##########
File path: airflow/models/xcom.py
##########
@@ -68,12 +80,22 @@ def __repr__(self):
 
     @classmethod
     @provide_session
-    def set(cls, key, value, execution_date, task_id, dag_id, session=None):
+    def set(cls, key, value, task_id, dag_id, execution_date=None, 
run_id=None, session=None):
         """
         Store an XCom value.
 
         :return: None
         """
+        if not (execution_date is None) ^ (run_id is None):
+            raise ValueError("Exactly one of execution_date or run_id must be 
passed")
+
+        if run_id:
+            from airflow.models.dagrun import DagRun
+
+            dag_run = session.query(DagRun).filter_by(dag_id=dag_id, 
run_id=run_id).one()
+
+            execution_date = dag_run.execution_date
+
         session.expunge_all()

Review comment:
       Yuuuup. I wasn't touching it on purpose in this PR.




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