Skip to content

Conversation

@ambika-garg
Copy link
Contributor

related: #45647

@ambika-garg
Copy link
Contributor Author

Hey @jedcunningham, should we remove the get_dags function in task_clear, since the task_clear command only accepts a single dag_id?

to have succeeded, but found 1 non-success(es).
"""
dag = get_dag(args.subdir, args.dag_id)
dag = _parse_and_get_dag(args.dag_id)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should just use serialized dag from the db, not reparse it on the fly like this.

success
"""
dag = get_dag(args.subdir, args.dag_id)
dag = _parse_and_get_dag(args.dag_id)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

def task_list(args, dag: DAG | None = None) -> None:
"""List the tasks within a DAG at the command line."""
dag = dag or get_dag(args.subdir, args.dag_id)
dag = dag or _parse_and_get_dag(args.dag_id)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here.

@providers_configuration_loaded
def task_render(args, dag: DAG | None = None) -> None:
"""Render and displays templated fields for a given task."""
dag = dag or _parse_and_get_dag(args.dag_id)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here.

@jedcunningham
Copy link
Member

should we remove the get_dags function in task_clear, since the task_clear command only accepts a single dag_id?

Not sure without digging in more. Might be some leftover cruft from subdags possibly?

@ambika-garg
Copy link
Contributor Author

should we remove the get_dags function in task_clear, since the task_clear command only accepts a single dag_id?

Not sure without digging in more. Might be some leftover cruft from subdags possibly?

I was referring to this function.
https://github.com/apache/airflow/blob/main/airflow/cli/commands/remote_commands/task_command.py#L446

if args.dag_id and not args.dag_regex and not args.task_regex:
dags = [get_dag_by_file_location(args.dag_id)]
else:
# todo clear command only accepts a single dag_id. no reason for get_dags with 's' except regex?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this function should be maintained because if the user wants to use regex, dag_id is treated as a regex.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I made the changes accordingly.

@ambika-garg ambika-garg force-pushed the remove-subarg-task-command branch from 0a9c459 to 6ac6d36 Compare March 23, 2025 18:29
@ambika-garg
Copy link
Contributor Author

Hey @jedcunningham, can you please take a look and help me understand why the test case is failing?

Copy link
Member

@jason810496 jason810496 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Roughly tracing all the way down, it seems that the task_to_execute we pass to ExecutionCallableRunner

https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/models/taskinstance.py#L610

is a BaseOperator instead of a PythonOperator (or another Python-based operator inheriting from BaseOperator). Compared to the example_python_operator DAG

https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/example_dags/example_python_operator.py

this results in a NotImplementedError being raised from BaseOperator.execute

https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/models/baseoperator.py#L441-L449

@@ -1,4 +1,4 @@
#
# No code was selected, so we can't improve anything.#
Copy link
Member

@jason810496 jason810496 Mar 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Seems like your colleague has left here xD

@ambika-garg
Copy link
Contributor Author

Roughly tracing all the way down, it seems that the task_to_execute we pass to ExecutionCallableRunner

https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/models/taskinstance.py#L610

is a BaseOperator instead of a PythonOperator (or another Python-based operator inheriting from BaseOperator). Compared to the example_python_operator DAG

https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/example_dags/example_python_operator.py

this results in a NotImplementedError being raised from BaseOperator.execute

https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/models/baseoperator.py#L441-L449

Thanks for the amazing insights, @jason810496! I’m wondering why these are failing since nothing related to them is being changed in the PR.

@jason810496
Copy link
Member

Thanks for the amazing insights, @jason810496! I’m wondering why these are failing since nothing related to them is being changed in the PR.

I'm not sure at the moment, so we need to dig along the path I described to find out.

@ambika-garg ambika-garg force-pushed the remove-subarg-task-command branch from 7833efd to 0e644d7 Compare March 26, 2025 14:12
@potiuk
Copy link
Member

potiuk commented Mar 31, 2025

Always rebase and solve conflicts first.

Screenshot 2025-03-31 at 02 05 08

@ambika-garg ambika-garg force-pushed the remove-subarg-task-command branch from 0e644d7 to bb1fb08 Compare April 6, 2025 17:46
@ambika-garg ambika-garg marked this pull request as ready for review April 15, 2025 22:22
Copy link
Member

@jason810496 jason810496 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think #49317 will include the scope of this PR right ?

cc @ephraimbuddy

@ephraimbuddy
Copy link
Contributor

I think #49317 will include the scope of this PR right ?

cc @ephraimbuddy

Yeah.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants