uranusjr commented on code in PR #41803:
URL: https://github.com/apache/airflow/pull/41803#discussion_r1737866406
##########
airflow/models/xcom.py:
##########
@@ -163,67 +154,14 @@ def set(
:param session: Database session. If not given, a new session will be
created for this function.
"""
-
- @overload
- @classmethod
- def set(
- cls,
- key: str,
- value: Any,
- task_id: str,
- dag_id: str,
- execution_date: datetime.datetime,
- session: Session = NEW_SESSION,
- ) -> None:
- """
- Store an XCom value.
-
- :sphinx-autoapi-skip:
- """
-
- @classmethod
- @internal_api_call
- @provide_session
- def set(
- cls,
- key: str,
- value: Any,
- task_id: str,
- dag_id: str,
- execution_date: datetime.datetime | None = None,
- session: Session = NEW_SESSION,
- *,
- run_id: str | None = None,
- map_index: int = -1,
- ) -> None:
- """
- Store an XCom value.
-
- :sphinx-autoapi-skip:
- """
from airflow.models.dagrun import DagRun
- if not exactly_one(execution_date is not None, run_id is not None):
- raise ValueError(
- f"Exactly one of run_id or execution_date must be passed. "
- f"Passed execution_date={execution_date}, run_id={run_id}"
- )
+ if not run_id:
+ raise ValueError(f"run_id must be passed. Passed run_id={run_id}")
Review Comment:
Why not just remove `= None` from the argument to make it required?
--
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]