henry3260 commented on code in PR #72941:
URL: https://github.com/apache/airflow/pull/72941#discussion_r4336407603
##########
airflow-core/src/airflow/cli/commands/task_command.py:
##########
@@ -600,9 +601,13 @@ def task_clear(args) -> None:
dags = get_dags(args.bundle_name, args.dag_id,
use_regex=args.dag_regex, from_db=True)
if args.task_regex:
+ try:
+ task_pattern = re.compile(args.task_regex)
+ except re.error as e:
+ raise SystemExit(f"Invalid --task-regex {args.task_regex!r}:
{e}")
for idx, dag in enumerate(dags):
dags[idx] = dag.partial_subset(
- task_ids=args.task_regex,
+ task_ids={task_id for task_id in dag.task_ids if
task_pattern.search(task_id)},
Review Comment:
Make sense :)
--
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]