You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "peloyeje (via GitHub)" <gi...@apache.org> on 2023/09/21 21:10:45 UTC
[GitHub] [airflow] peloyeje commented on a diff in pull request #34529: Add ability to clear downstream tis in "List Task Instances" view
peloyeje commented on code in PR #34529:
URL: https://github.com/apache/airflow/pull/34529#discussion_r1333607409
##########
airflow/www/views.py:
##########
@@ -5803,21 +5853,42 @@ def duration_f(self):
@provide_session
@action_logging
def action_clear(self, task_instances, session: Session = NEW_SESSION):
- """Clears the action."""
+ """Clears an arbitrary number of task instances."""
try:
- dag_to_tis = collections.defaultdict(list)
-
- for ti in task_instances:
- dag = get_airflow_app().dag_bag.get_dag(ti.dag_id)
- dag_to_tis[dag].append(ti)
+ count = self._clear_task_instances(
+ task_instances=task_instances, session=session, clear_downstream=False
+ )
+ session.commit()
+ flash(f"{count} task instances have been cleared")
Review Comment:
Sure, good idea!
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org