Skip to content

Error while clearing a task via CLI - AttributeError: 'DAG' object has no attribute 'clear' #63817

Description

@atul-astronomer

Apache Airflow version

main (development)

If "Other Airflow 3 version" selected, which one?

No response

What happened?

Getting error while clearing a task via CLI

Traceback (most recent call last):
  File "/usr/python/bin/airflow", line 10, in <module>
    sys.exit(main())
  File "/opt/airflow/airflow-core/src/airflow/__main__.py", line 55, in main
    args.func(args)
  File "/opt/airflow/airflow-core/src/airflow/cli/cli_config.py", line 49, in command
    return func(*args, **kwargs)
  File "/opt/airflow/airflow-core/src/airflow/utils/cli.py", line 113, in wrapper
    return f(*args, **kwargs)
  File "/opt/airflow/airflow-core/src/airflow/utils/providers_configuration_loader.py", line 54, in wrapped_function
    return func(*args, **kwargs)
  File "/opt/airflow/airflow-core/src/airflow/cli/commands/task_command.py", line 514, in task_clear
    tis = SerializedDAG.clear_dags(
  File "/opt/airflow/airflow-core/src/airflow/serialization/definitions/dag.py", line 1118, in clear_dags
    return list(tis)
  File "/opt/airflow/airflow-core/src/airflow/serialization/definitions/dag.py", line 1108, in <genexpr>
    dag.clear(
AttributeError: 'DAG' object has no attribute 'clear'

What you think should happen instead?

No response

How to reproduce

  1. Start airflow instance on main branch, create a dagrun for any dag.
  2. Clear Task using CLI by running command airflow tasks clear <dag_id>
  3. Notice the error

Operating System

Linux

Versions of Apache Airflow Providers

No response

Deployment

Other

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Labels

affected_version:3.2Use for reporting issues with 3.2priority:mediumBug that should be fixed before next release but would not block a release

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions