Add task instance management commands to airflowctl CLI#67947
Add task instance management commands to airflowctl CLI#67947Suraj-kumar00 wants to merge 10 commits into
Conversation
bfb913a to
193ed6a
Compare
|
Hello @potiuk, Also could you help me get this that do i have to do the testing manually on local? This is taking so much time locally!!! |
bugraoz93
left a comment
There was a problem hiding this comment.
There are some foundational things needs changing, thanks for the PR!
| "taskinstance clear --dag-id=example_bash_operator --dry-run", | ||
| 'taskinstance update --dag-id=example_bash_operator --dag-run-id="manual__{date_param}" --task-id=runme_0 --new-state=success', | ||
| # XCom commands - need a DAG run with completed tasks | ||
| 'xcom add --dag-id=example_bash_operator --dag-run-id="manual__{date_param}" --task-id=runme_0 --key={xcom_key} --value=\'{{"test": "value"}}\'', |
There was a problem hiding this comment.
I think if fields are mandatory they should be path parameter without any param name to be optional. Can you rebase? Maybe you don't have those. Because we shouldn't update old commands in this work, they should work as is and we should ensure required fields are not passed as optional for taskinstance commands too
There was a problem hiding this comment.
Fixed, all required params (dag_id, dag_run_id, task_id, key, value) are now positional args in the test commands, matching how CommandFactory generates them. Rebased on main.
|
|
||
|
|
||
|
|
||
| class TaskInstanceOperations(BaseOperations): |
There was a problem hiding this comment.
Operations name shpuld be tasks as this auto generated should be same as Airlfow core cli
This creating is correct even though the static checks failing and PR not finished. Please check the operation class naming
https://github.com/apache/airflow/pull/66926/changes
| return False | ||
|
|
||
|
|
||
| def _parse_task_ids_cli_arg(value: str) -> list: |
There was a problem hiding this comment.
This looks bespoke to me, I don't think we should put task base exceptional bespoke implementations here. We should add them to operation side if needed, I assume we shouldn't have this much changes here
0b76de6 to
400f426
Compare
…tanceOperations - Remove bare re-raise try/except from get, clear, and update methods - Fix ruff E302: add missing blank line before TaskInstanceOperations class - Fix ruff F841: remove unused variable in pool command export test - Run ruff format on operations.py, cli_config.py, test_operations.py
…task_ids validation
…onal args Required path params (dag_id, dag_run_id, task_id, key, value) are generated as positional CLI arguments by CommandFactory, not optional --flags. Also fix ruff-format: remove extra blank lines before TaskInstanceOperations and TestTaskInstanceOperations class definitions.
4da1910 to
a584bd1
Compare
Adds Task Instance management support to the airflowctl CLI, enabling users to get, list, clear, and update task instances directly from the terminal.
Closes: #61547
Related: #66173
Changes
airflowctl/api/operations.py
TaskInstanceOperationsclass with get, list, clear, update methods_parse_task_instance_responsehelper to handle the different response shapes (single instance, list, or collection) from the APIPluginsOperationsclass that was lost during merge with main (Added plugins command to airflowctl #64935)airflowctl/api/client.py
task_instancesproperty to the Client for auto-generated CLI command wiringpluginsproperty that was lost during merge with mainairflowctl/ctl/cli_config.py
"clear"tooutput_command_listfor correct CLI output handling_is_list_annotation()helper that properly unwrapsAnnotated[list[...] | None, Field(...)]to convert comma-separated CLI inputs into lists when the Pydantic model expects a list field(e.g.
--task-ids t1,t2 → ["t1", "t2"])_parse_task_instance_responsefrom auto-generated CLI commandstests/airflow_ctl/api/test_operations.py
TestTaskInstanceOperationswith 10 unit tests covering all response shapes for get, list, clear, and updateTestPluginsOperationstests lost during mergetests/airflow_ctl/ctl/commands/test_pool_command.py
import reto module scopeairflow-ctl-tests/tests/airflowctl_tests/test_airflowctl_commands.py
New CLI Commands
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.