Re: [PR] Add airflowctl tasks clear command [airflow]
FrankYang0529 commented on code in PR #69320:
URL: https://github.com/apache/airflow/pull/69320#discussion_r3576320609
##
airflow-ctl/src/airflowctl/ctl/cli_config.py:
##
@@ -581,30 +604,24 @@ def _create_arg_for_non_primitive_type(
continue
self.datamodels_extended_map[parameter_type].append(field)
if type(field_type.annotation) is type:
-commands.append(
-self._create_arg(
-arg_flags=("--" +
self._sanitize_arg_parameter_key(field),),
-
arg_type=self._python_type_from_string(field_type.annotation),
-arg_action=argparse.BooleanOptionalAction if
field_type.annotation is bool else None, # type: ignore
-arg_help=f"{field} for {parameter_key} operation",
-arg_default=False if field_type.annotation is bool
else None,
-)
-)
+annotation = field_type.annotation
else:
try:
annotation = field_type.annotation.__args__[0]
except AttributeError:
annotation = field_type.annotation
-commands.append(
-self._create_arg(
-arg_flags=("--" +
self._sanitize_arg_parameter_key(field),),
-arg_type=self._python_type_from_string(annotation),
-arg_action=argparse.BooleanOptionalAction if
annotation is bool else None, # type: ignore
-arg_help=f"{field} for {parameter_key} operation",
-arg_default=False if annotation is bool else None,
-)
+commands.append(
+self._create_arg(
+arg_flags=("--" +
self._sanitize_arg_parameter_key(field),),
Review Comment:
Updated it. Thanks.
--
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]
Re: [PR] Add airflowctl tasks clear command [airflow]
FrankYang0529 commented on code in PR #69320:
URL: https://github.com/apache/airflow/pull/69320#discussion_r3576319746
##
airflow-ctl/tests/airflow_ctl/ctl/test_cli_config.py:
##
@@ -737,11 +737,63 @@ def test_apply_datamodel_defaults_other_datamodel(self):
# Should return params unchanged for other datamodels
assert result == params, "Params should be unchanged for
non-TriggerDAGRunPostBody datamodels"
+def test_tasks_clear_args_follow_datamodel_defaults(self):
+"""Bool flags of ``tasks clear`` keep the ClearTaskInstancesBody
defaults so a bare invocation only dry-runs."""
+command_factory = CommandFactory()
+tasks_group = next(
+group_command for group_command in command_factory.group_commands
if group_command.name == "tasks"
+)
+clear_command = next(
+sub_command for sub_command in tasks_group.subcommands if
sub_command.name == "clear"
+)
+args_by_flag = {arg.flags[0]: arg for arg in clear_command.args}
+
+assert "dag_id" in args_by_flag, "required path parameter should be
positional"
+assert args_by_flag["--dry-run"].kwargs["action"] ==
BooleanOptionalAction
+assert args_by_flag["--dry-run"].kwargs["default"] is True
+assert args_by_flag["--only-failed"].kwargs["default"] is True
+assert args_by_flag["--reset-dag-runs"].kwargs["default"] is True
+assert args_by_flag["--only-running"].kwargs["default"] is False
+assert args_by_flag["--run-on-latest-version"].kwargs["default"] is
None
+assert args_by_flag["--task-ids"].kwargs["type"] is str
+assert "--output" in args_by_flag
+
[email protected](
+("raw_task_ids", "expected_task_ids"),
+[
+("task_1", ["task_1"]),
+("task_1,task_2", ["task_1", "task_2"]),
+(" task_1 , task_2 ,", ["task_1", "task_2"]),
+('["task_1", ["mapped_task", 0]]', ["task_1", ["mapped_task", 0]]),
+(None, None),
+],
+)
+def test_apply_datamodel_defaults_clear_task_instances_task_ids(self,
raw_task_ids, expected_task_ids):
+"""Test _apply_datamodel_defaults parses --task-ids strings for
ClearTaskInstancesBody."""
+from airflowctl.api.datamodels.generated import ClearTaskInstancesBody
Review Comment:
Moved it. Thanks.
##
airflow-ctl/tests/airflow_ctl/ctl/test_cli_config.py:
##
@@ -737,11 +737,63 @@ def test_apply_datamodel_defaults_other_datamodel(self):
# Should return params unchanged for other datamodels
assert result == params, "Params should be unchanged for
non-TriggerDAGRunPostBody datamodels"
+def test_tasks_clear_args_follow_datamodel_defaults(self):
+"""Bool flags of ``tasks clear`` keep the ClearTaskInstancesBody
defaults so a bare invocation only dry-runs."""
+command_factory = CommandFactory()
+tasks_group = next(
+group_command for group_command in command_factory.group_commands
if group_command.name == "tasks"
+)
+clear_command = next(
+sub_command for sub_command in tasks_group.subcommands if
sub_command.name == "clear"
+)
+args_by_flag = {arg.flags[0]: arg for arg in clear_command.args}
+
+assert "dag_id" in args_by_flag, "required path parameter should be
positional"
+assert args_by_flag["--dry-run"].kwargs["action"] ==
BooleanOptionalAction
+assert args_by_flag["--dry-run"].kwargs["default"] is True
+assert args_by_flag["--only-failed"].kwargs["default"] is True
+assert args_by_flag["--reset-dag-runs"].kwargs["default"] is True
+assert args_by_flag["--only-running"].kwargs["default"] is False
+assert args_by_flag["--run-on-latest-version"].kwargs["default"] is
None
+assert args_by_flag["--task-ids"].kwargs["type"] is str
+assert "--output" in args_by_flag
+
[email protected](
+("raw_task_ids", "expected_task_ids"),
+[
+("task_1", ["task_1"]),
+("task_1,task_2", ["task_1", "task_2"]),
+(" task_1 , task_2 ,", ["task_1", "task_2"]),
+('["task_1", ["mapped_task", 0]]', ["task_1", ["mapped_task", 0]]),
+(None, None),
+],
+)
+def test_apply_datamodel_defaults_clear_task_instances_task_ids(self,
raw_task_ids, expected_task_ids):
+"""Test _apply_datamodel_defaults parses --task-ids strings for
ClearTaskInstancesBody."""
+from airflowctl.api.datamodels.generated import ClearTaskInstancesBody
+
+command_factory = CommandFactory()
+result = command_factory._apply_datamodel_defaults(
+ClearTaskInstancesBody, {"task_ids": raw_task_ids, "dry_run": True}
+)
+
+assert result["task_ids"] == expected_task_ids
+assert result["dry_run"] is True
+
+def
test_apply_datamodel_defaults_clear_task
Re: [PR] Add airflowctl tasks clear command [airflow]
Lee-W commented on code in PR #69320:
URL: https://github.com/apache/airflow/pull/69320#discussion_r3558669260
##
airflow-ctl/tests/airflow_ctl/ctl/test_cli_config.py:
##
@@ -737,11 +737,63 @@ def test_apply_datamodel_defaults_other_datamodel(self):
# Should return params unchanged for other datamodels
assert result == params, "Params should be unchanged for
non-TriggerDAGRunPostBody datamodels"
+def test_tasks_clear_args_follow_datamodel_defaults(self):
+"""Bool flags of ``tasks clear`` keep the ClearTaskInstancesBody
defaults so a bare invocation only dry-runs."""
+command_factory = CommandFactory()
+tasks_group = next(
+group_command for group_command in command_factory.group_commands
if group_command.name == "tasks"
+)
+clear_command = next(
+sub_command for sub_command in tasks_group.subcommands if
sub_command.name == "clear"
+)
+args_by_flag = {arg.flags[0]: arg for arg in clear_command.args}
+
+assert "dag_id" in args_by_flag, "required path parameter should be
positional"
+assert args_by_flag["--dry-run"].kwargs["action"] ==
BooleanOptionalAction
+assert args_by_flag["--dry-run"].kwargs["default"] is True
+assert args_by_flag["--only-failed"].kwargs["default"] is True
+assert args_by_flag["--reset-dag-runs"].kwargs["default"] is True
+assert args_by_flag["--only-running"].kwargs["default"] is False
+assert args_by_flag["--run-on-latest-version"].kwargs["default"] is
None
+assert args_by_flag["--task-ids"].kwargs["type"] is str
+assert "--output" in args_by_flag
+
[email protected](
+("raw_task_ids", "expected_task_ids"),
+[
+("task_1", ["task_1"]),
+("task_1,task_2", ["task_1", "task_2"]),
+(" task_1 , task_2 ,", ["task_1", "task_2"]),
+('["task_1", ["mapped_task", 0]]', ["task_1", ["mapped_task", 0]]),
+(None, None),
+],
+)
+def test_apply_datamodel_defaults_clear_task_instances_task_ids(self,
raw_task_ids, expected_task_ids):
+"""Test _apply_datamodel_defaults parses --task-ids strings for
ClearTaskInstancesBody."""
+from airflowctl.api.datamodels.generated import ClearTaskInstancesBody
Review Comment:
let's move it to the top
##
airflow-ctl/tests/airflow_ctl/ctl/test_cli_config.py:
##
@@ -737,11 +737,63 @@ def test_apply_datamodel_defaults_other_datamodel(self):
# Should return params unchanged for other datamodels
assert result == params, "Params should be unchanged for
non-TriggerDAGRunPostBody datamodels"
+def test_tasks_clear_args_follow_datamodel_defaults(self):
+"""Bool flags of ``tasks clear`` keep the ClearTaskInstancesBody
defaults so a bare invocation only dry-runs."""
+command_factory = CommandFactory()
+tasks_group = next(
+group_command for group_command in command_factory.group_commands
if group_command.name == "tasks"
+)
+clear_command = next(
+sub_command for sub_command in tasks_group.subcommands if
sub_command.name == "clear"
+)
+args_by_flag = {arg.flags[0]: arg for arg in clear_command.args}
+
+assert "dag_id" in args_by_flag, "required path parameter should be
positional"
+assert args_by_flag["--dry-run"].kwargs["action"] ==
BooleanOptionalAction
+assert args_by_flag["--dry-run"].kwargs["default"] is True
+assert args_by_flag["--only-failed"].kwargs["default"] is True
+assert args_by_flag["--reset-dag-runs"].kwargs["default"] is True
+assert args_by_flag["--only-running"].kwargs["default"] is False
+assert args_by_flag["--run-on-latest-version"].kwargs["default"] is
None
+assert args_by_flag["--task-ids"].kwargs["type"] is str
+assert "--output" in args_by_flag
+
[email protected](
+("raw_task_ids", "expected_task_ids"),
+[
+("task_1", ["task_1"]),
+("task_1,task_2", ["task_1", "task_2"]),
+(" task_1 , task_2 ,", ["task_1", "task_2"]),
+('["task_1", ["mapped_task", 0]]', ["task_1", ["mapped_task", 0]]),
+(None, None),
+],
+)
+def test_apply_datamodel_defaults_clear_task_instances_task_ids(self,
raw_task_ids, expected_task_ids):
+"""Test _apply_datamodel_defaults parses --task-ids strings for
ClearTaskInstancesBody."""
+from airflowctl.api.datamodels.generated import ClearTaskInstancesBody
+
+command_factory = CommandFactory()
+result = command_factory._apply_datamodel_defaults(
+ClearTaskInstancesBody, {"task_ids": raw_task_ids, "dry_run": True}
+)
+
+assert result["task_ids"] == expected_task_ids
+assert result["dry_run"] is True
+
+def
test_apply_datamodel_defaults_clear_task_
Re: [PR] Add airflowctl tasks clear command [airflow]
FrankYang0529 commented on code in PR #69320: URL: https://github.com/apache/airflow/pull/69320#discussion_r3522574950 ## airflow-ctl/src/airflowctl/ctl/help_texts.yaml: ## @@ -85,6 +85,9 @@ pools: providers: list: "List all installed Airflow providers" +tasks: + clear: "Clear task instances of a Dag; dry run by default, pass --no-dry-run to actually clear" Review Comment: Thanks for the suggestion. Updated it. -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
justinpakzad commented on code in PR #69320: URL: https://github.com/apache/airflow/pull/69320#discussion_r3521273754 ## airflow-ctl/src/airflowctl/ctl/help_texts.yaml: ## @@ -85,6 +85,9 @@ pools: providers: list: "List all installed Airflow providers" +tasks: + clear: "Clear task instances of a Dag; dry run by default, pass --no-dry-run to actually clear" Review Comment: Nit: should we trim this to just be something like "Clear task instances of a Dag by its ID"? Similar to all the other ones. When you do `airflowctl tasks clear --help` the options are already displayed with their default values: https://github.com/user-attachments/assets/7c025e76-347b-48e5-a11c-6685b984736d"; /> -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
henry3260 commented on PR #69320: URL: https://github.com/apache/airflow/pull/69320#issuecomment-4875370614 reopen to trigger full ci test -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
henry3260 closed pull request #69320: Add airflowctl tasks clear command URL: https://github.com/apache/airflow/pull/69320 -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
potiuk closed pull request #66276: Add airflowctl tasks clear command URL: https://github.com/apache/airflow/pull/66276 -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
Bishesh-Shahi commented on code in PR #66926: URL: https://github.com/apache/airflow/pull/66926#discussion_r3436869696 ## airflow-ctl/src/airflowctl/ctl/help_texts.yaml: ## @@ -70,6 +70,9 @@ dagrun: get: "Retrieve a Dag run by Dag ID and run ID" list: "List Dag runs, optionally filtered by state and date range" +tasks: + clear: "Clear task instances for a DAG" Review Comment: Thanks for catching that! I have updated the spelling to 'Dag' in both operations.py and help_texts.yaml. I also ran the regeneration script to update the command hashes and SVG images accordingly, and pushed the updates. -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
henry3260 commented on code in PR #66926: URL: https://github.com/apache/airflow/pull/66926#discussion_r3426283888 ## airflow-ctl/src/airflowctl/api/operations.py: ## @@ -725,6 +727,25 @@ def list(self) -> ProviderCollectionResponse | ServerResponseError: return super().execute_list(path="providers", data_model=ProviderCollectionResponse) +class TasksOperations(BaseOperations): +"""Task operations.""" + +def clear( +self, +dag_id: str, +body: ClearTaskInstancesBody, +) -> TaskInstanceCollectionResponse | ServerResponseError: +"""Clear task instances for a DAG.""" Review Comment: ```suggestion """Clear task instances for a Dag.""" ``` ## airflow-ctl/src/airflowctl/ctl/help_texts.yaml: ## @@ -70,6 +70,9 @@ dagrun: get: "Retrieve a Dag run by Dag ID and run ID" list: "List Dag runs, optionally filtered by state and date range" +tasks: + clear: "Clear task instances for a DAG" Review Comment: ```suggestion clear: "Clear task instances for a Dag" ``` -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
Bishesh-Shahi commented on PR #66926: URL: https://github.com/apache/airflow/pull/66926#issuecomment-4687864100 > @Bishesh-Shahi could you please fix the static checks? The CI should be green, and pre-hooks should be passing to be able to merge unfortunately :( I've pushed the fix for the duplicate hash entry and rebased the branch onto the latest main. The ruff checks are passing locally. Could you please trigger the CI run for me so we can get it green? -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
Bishesh-Shahi commented on PR #66926: URL: https://github.com/apache/airflow/pull/66926#issuecomment-4687703176 Hi @potiuk, sorry for the delayed update, I've been away for a while! I've now: Rebased the branch onto the latest main Verified the code passes ruff check and ruff format locally (no changes needed) Force-pushed the updated branch The changes remain focused: adding TasksOperations.clear() in operations.py, registering it on the Client, adding help text in help_texts.yaml, updating the SVG generation script, and including unit + integration tests. Ready for CI approval and review whenever you get a chance. Thanks for your patience! 🙏 -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
potiuk commented on PR #66926: URL: https://github.com/apache/airflow/pull/66926#issuecomment-4657822282 @Bishesh-Shahi A few things need addressing before review — see our [Pull Request quality criteria](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-quality-criteria). - :x: **Pre-commit / static checks**. See [docs](https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst). No rush. _Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this [two-stage triage process](https://github.com/apache/airflow/blob/main/contributing-docs/25_maintainer_pr_triage.md#why-the-first-pass-is-automated) so that our maintainers' limited time is spent where it matters most: the conversation with you._ -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
potiuk commented on PR #66926: URL: https://github.com/apache/airflow/pull/66926#issuecomment-4617805446 @Bishesh-Shahi A few things need addressing before review — see our [Pull Request quality criteria](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-quality-criteria). - :x: **Pre-commit / static checks**. See [docs](https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst). - :x: **Other failing CI checks**. See [docs](https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst). No rush. --- _Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this [two-stage triage process](https://github.com/apache/airflow/blob/main/contributing-docs/25_maintainer_pr_triage.md#why-the-first-pass-is-automated) so that our maintainers' limited time is spent where it matters most: the conversation with you._ -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
potiuk commented on PR #66926: URL: https://github.com/apache/airflow/pull/66926#issuecomment-4538691776 @Bishesh-Shahi — This PR has new commits since the last review requesting changes from `bugraoz93`. Could you address the outstanding review comments and either push a fix or reply in each thread explaining why the feedback doesn't apply? When you believe the threads are resolved, please mark them as resolved and ping the reviewer (`bugraoz93`) — they'll either re-review or hand the PR back to the queue. Thanks! --- _Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this [two-stage triage process](https://github.com/apache/airflow/blob/main/contributing-docs/25_maintainer_pr_triage.md#why-the-first-pass-is-automated) so that our maintainers' limited time is spent where it matters most: the conversation with you._ --- Drafted-by: Claude Code (Opus 4.7); reviewed by @potiuk before posting -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
potiuk commented on PR #66276: URL: https://github.com/apache/airflow/pull/66276#issuecomment-4538556011 @NamanSinghai Converting to **draft** — this PR doesn't yet meet our [Pull Request quality criteria](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-quality-criteria). - :x: **Pre-commit / static checks**. See [docs](https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst). - :x: **Unresolved review comments**: 1 thread(s). See [docs](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-quality-criteria). See the linked criteria for how to fix each item, then mark the PR "Ready for review". This is **not** a rejection — just an invitation to bring the PR up to standard. No rush. --- _Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this [two-stage triage process](https://github.com/apache/airflow/blob/main/contributing-docs/25_maintainer_pr_triage.md#why-the-first-pass-is-automated) so that our maintainers' limited time is spent where it matters most: the conversation with you._ --- Drafted-by: Claude Code (Opus 4.7); reviewed by @potiuk before posting -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
potiuk commented on PR #66276: URL: https://github.com/apache/airflow/pull/66276#issuecomment-4529556817 @NamanSinghai A few things need addressing before review — see our [Pull Request quality criteria](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-quality-criteria). - :x: **CI fails**: `CI image checks / Static checks` (and possibly other checks — see the [Checks tab](https://github.com/apache/airflow/pull/66276/checks) for the full list). No rush. --- _Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this [two-stage triage process](https://github.com/apache/airflow/blob/main/contributing-docs/25_maintainer_pr_triage.md#why-the-first-pass-is-automated) so that our maintainers' limited time is spent where it matters most: the conversation with you._ --- Drafted-by: Claude Code (Opus 4.7); reviewed by @potiuk before posting -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
Bishesh-Shahi commented on code in PR #66926: URL: https://github.com/apache/airflow/pull/66926#discussion_r3277013344 ## airflow-ctl/docs/images/command_hashes.txt: ## @@ -12,4 +12,9 @@ providers:34502fe09dc0b8b0a13e7e46efdffda6 variables:f8fc76d3d398b2780f4e97f7cd816646 version:31f4efdf8de0dbaaa4fac71ff7efecc3 plugins:4864fd8f356704bd2b3cd1aec3567e35 +tasks:8ca7306be97d1c8788dbfbe4b0f8bf61 auth login:9fe2bb1dd5c602beea2eefb33a2b20a8 +tasks clear:151c473a0b6653553149513b46e58072 + Review Comment: Thank you for catching that @bugraoz93! You're right on both points:I had mistakenly added "tasks clear" to the SUBCOMMANDS list in run_capture_airflowctl_help.py, which caused the file to be generated with two entries (tasks and tasks clear) instead of just one.I've reverted that- only "tasks" is now registered under COMMANDS (matching the pattern used by all other top-level command groups). The command_hashes.txt now has a single correct entry for tasks, and output_tasks_clear.svg has been removed. The file has been regenerated correctly and both prek checks pass. Sorry for the noise! -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
bugraoz93 commented on code in PR #66926: URL: https://github.com/apache/airflow/pull/66926#discussion_r3276962007 ## airflow-ctl/docs/images/command_hashes.txt: ## @@ -12,4 +12,9 @@ providers:34502fe09dc0b8b0a13e7e46efdffda6 variables:f8fc76d3d398b2780f4e97f7cd816646 version:31f4efdf8de0dbaaa4fac71ff7efecc3 plugins:4864fd8f356704bd2b3cd1aec3567e35 +tasks:8ca7306be97d1c8788dbfbe4b0f8bf61 auth login:9fe2bb1dd5c602beea2eefb33a2b20a8 +tasks clear:151c473a0b6653553149513b46e58072 + Review Comment: We also have two entry should be one -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
bugraoz93 commented on code in PR #66926: URL: https://github.com/apache/airflow/pull/66926#discussion_r3276954274 ## airflow-ctl/docs/images/command_hashes.txt: ## @@ -12,4 +12,9 @@ providers:34502fe09dc0b8b0a13e7e46efdffda6 variables:f8fc76d3d398b2780f4e97f7cd816646 version:31f4efdf8de0dbaaa4fac71ff7efecc3 plugins:4864fd8f356704bd2b3cd1aec3567e35 +tasks:8ca7306be97d1c8788dbfbe4b0f8bf61 auth login:9fe2bb1dd5c602beea2eefb33a2b20a8 +tasks clear:151c473a0b6653553149513b46e58072 + Review Comment: This should be autogenerated, seems something went wrong -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
Bishesh-Shahi commented on PR #66926: URL: https://github.com/apache/airflow/pull/66926#issuecomment-4492879341 > Could you please also add def here https://github.com/apache/airflow/blob/main/airflow-ctl/src/airflowctl/ctl/help_texts.yaml? Hi @bugraoz93, Thank you for the catch! I have updated the PR to fully support help text definitions and help image generation for the new `tasks` command and `clear` subcommand: 1. Added the `tasks: clear: "Clear task instances"` definition to `airflow-ctl/src/airflowctl/ctl/help_texts.yaml`. 2. Updated the image generation script (`scripts/in_container/run_capture_airflowctl_help.py`) by adding `"tasks"` to `COMMANDS` and `"tasks clear"` to `SUBCOMMANDS`. 3. Generated and updated the MD5 hashes in `command_hashes.txt`. 4. Generated the preview SVGs `output_tasks.svg` and `output_tasks_clear.svg` under standard terminal configurations. 5. Verified that both `check_airflowctl_help_texts.py` and `check_airflowctl_command_coverage.py` pre-commit checks pass successfully. Please let me know if there's anything else that needs addressing before review! -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
bugraoz93 commented on code in PR #66276: URL: https://github.com/apache/airflow/pull/66276#discussion_r3269917818 ## airflow-ctl/src/airflowctl/ctl/commands/task_command.py: ## @@ -0,0 +1,44 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from __future__ import annotations + +from airflowctl.api.client import NEW_API_CLIENT, Client, ClientKind, provide_api_client +from airflowctl.ctl.console_formatting import AirflowConsole + + +@provide_api_client(kind=ClientKind.CLI) +def task_clear(args, api_client: Client = NEW_API_CLIENT) -> dict: Review Comment: We should move this to operations.py it is a single command good candidate for auto generation Then we should add here. https://github.com/apache/airflow/blob/main/airflow-ctl/src/airflowctl/ctl/help_texts.yaml -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
bugraoz93 commented on PR #66926: URL: https://github.com/apache/airflow/pull/66926#issuecomment-4492420926 Could you please also add def here https://github.com/apache/airflow/blob/main/airflow-ctl/src/airflowctl/ctl/help_texts.yaml? -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
bugraoz93 closed pull request #66926: Add airflowctl tasks clear command URL: https://github.com/apache/airflow/pull/66926 -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
Bishesh-Shahi commented on PR #66926: URL: https://github.com/apache/airflow/pull/66926#issuecomment-4491524022 Thanks for pointing that out! I've gone ahead and rebased the branch against `main` to get it fully up to date. I also investigated the CI failure and resolved the underlying issue (the new `clear` operation was missing from `output_command_list` in `cli_config.py`, causing `args.output` to crash the PROD integration test). The CI should now run cleanly. Let me know if anything else is needed before review! -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
potiuk commented on PR #66276: URL: https://github.com/apache/airflow/pull/66276#issuecomment-4483120309 @NamanSinghai A few things need addressing before review — see our [Pull Request quality criteria](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-quality-criteria). - :x: **Pre-commit / static checks** — Failing: `CI image checks / Static checks`. See [docs](https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst). > **Note:** Your branch is **402 commits behind `main`**. Please rebase and push again to get up-to-date CI results. No rush. --- _Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this [two-stage triage process](https://github.com/apache/airflow/blob/main/contributing-docs/25_maintainer_pr_triage.md#why-the-first-pass-is-automated) so that our maintainers' limited time is spent where it matters most: the conversation with you._ --- Drafted-by: Claude Code (Opus 4.7); reviewed by @potiuk before posting -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
potiuk commented on PR #66276: URL: https://github.com/apache/airflow/pull/66276#issuecomment-4475708806 @NamanSinghai A few things need addressing before review — see our [Pull Request quality criteria](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-quality-criteria). **Issues found:** - :x: **Pre-commit / static checks**: `CI image checks / Static checks` is failing. Run `prek run --from-ref main --stage pre-commit` locally and fix anything that flags. See the [static-checks docs](https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst). **What to do next:** - Push a fix for the static-check failure. No rush — take your time. We appreciate your contribution and are happy to wait for updates. If you have questions, feel free to ask on the [Airflow Slack](https://s.apache.org/airflow-slack). --- _Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this [two-stage triage process](https://github.com/apache/airflow/blob/main/contributing-docs/25_maintainer_pr_triage.md#why-the-first-pass-is-automated) so that our maintainers' limited time is spent where it matters most: the conversation with you._ -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
Bishesh-Shahi commented on PR #66926: URL: https://github.com/apache/airflow/pull/66926#issuecomment-4454469369 Thanks for the review @bugraoz93! I had actually already included the integration test for \ asks clear\ inside \irflow-ctl-tests/tests/airflowctl_tests/test_airflowctl_commands.py\ in the initial commit. However, I have now also added the requested unit test for \TasksOperations\ under \irflow-ctl/tests/airflow_ctl/api/test_operations.py\. Let me know if there's anything else needed! -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
Bishesh-Shahi commented on PR #66926: URL: https://github.com/apache/airflow/pull/66926#issuecomment-4454017565 Thanks for pointing that out @vincbeck! It was a formatting issue caused by my terminal escaping the markdown backticks during submission. I've just updated the PR title and description, and it should be properly formatted now. -- 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]
Re: [PR] Add airflowctl tasks clear command [airflow]
boring-cyborg[bot] commented on PR #66276: URL: https://github.com/apache/airflow/pull/66276#issuecomment-4363843385 Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our [Contributors' Guide](https://github.com/apache/airflow/blob/main/contributing-docs/README.rst) Here are some useful points: - Pay attention to the quality of your code (ruff, mypy and type annotations). Our [prek-hooks]( https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst#prerequisites-for-prek-hooks) will help you with that. - In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/main/airflow-core/docs/howto/custom-operator.rst) Consider adding an example Dag that shows how users should use it. - Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/dev/breeze/doc/README.rst) for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations. - Be patient and persistent. It might take some time to get a review or get the final approval from Committers. - Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack. - Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#coding-style-and-best-practices). - Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits. Apache Airflow is a community-driven project and together we are making it better 🚀. In case of doubts contact the developers at: Mailing List: [email protected] Slack: https://s.apache.org/airflow-slack -- 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]
