uranusjr commented on a change in pull request #18084:
URL: https://github.com/apache/airflow/pull/18084#discussion_r704870357
##########
File path: airflow/models/xcom.py
##########
@@ -221,28 +267,51 @@ def delete(cls, xcoms, session=None):
@provide_session
def clear(
cls,
- execution_date: pendulum.DateTime,
- dag_id: str,
- task_id: str,
+ execution_date: Optional[pendulum.DateTime] = None,
+ dag_id: str = None,
+ task_id: str = None,
+ run_id: str = None,
session: Session = None,
) -> None:
"""
Clears all XCom data from the database for the task instance
+ ``run_id`` and ``execution_date`` are mutually exclusive.
+
:param execution_date: Execution date for the task
- :type execution_date: pendulum.datetime
+ :type execution_date: pendulum.datetime or None
:param dag_id: ID of DAG to clear the XCom for.
:type dag_id: str
:param task_id: Only XComs from task with matching id will be cleared.
:type task_id: str
+ :param run_id: Dag run id for the task
+ :type run_id: str or None
:param session: database session
:type session: sqlalchemy.orm.session.Session
"""
- session.query(cls).filter(
+ # Given the historic order of this function (execution_date was first
argument) to add a new optional
+ # param we need to add default values for everything :(
+ if not dag_id:
+ raise TypeError("clear() missing required argument: dag_id")
Review comment:
I think these should all be TypeError.
--
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]