Conversation
Adds `airflowctl tasks state`, the replacement for the deprecated
`airflow tasks state` command, which is already marked
`@deprecated_for_airflowctl("airflowctl tasks state")` but had no
airflowctl counterpart.
The command selects a Dag run with either `run_id` or `--logical-date`
and prints the state of the task instance, reusing the existing
`task_instances.get` endpoint. It follows the argument handling, error
messages and map-index reporting already used by `tasks failed-deps`,
and prints "None" for an unset state so scripts migrating off the
deprecated command keep working.
|
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
|
SameerMesiah97
left a comment
There was a problem hiding this comment.
Left some comments. Also, I believe this needs a newsfragment as it is in airflow core.
CI needs to be triggered too.
|
Thanks for the review @SameerMesiah97 — pushed 2e1d575 addressing both comments, replies inline.
On CI — the workflows are still awaiting approval, which I can't trigger myself as a first-time contributor. Could you kick that off when you get a chance? |
|
Pushed 0903e25 — this fixes the static-checks failure on the earlier run. The cause was the
The new image lists the command in its alphabetical slot: Workflows are showing |
I can’t trigger CI. I don’t have the privileges. @potiuk could you help with that? |
- Make the run_id / --logical-date validation explicit with named booleans and an if/else instead of the compact 'or' shortcut. - Note in the command description that --logical-date matches the Dag run with exactly that logical date. - Add the newsfragment for the new command. Co-authored-by: SameerMesiah97 <75502260+SameerMesiah97@users.noreply.github.com>
The generate-airflowctl-help-images prek hook regenerates the CLI help SVGs from cli_config.py, so adding the 'tasks state' command left the checked-in output_tasks.svg and its hash stale and failed static checks.
0903e25 to
9b6b10c
Compare
|
Heads up on a force-push just now ( Both commits are otherwise untouched, and the PR is still |
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds
airflowctl tasks state, the missing counterpart to the deprecatedairflow tasks state, which is already annotated@deprecated_for_airflowctl("airflowctl tasks state")inairflow-core/src/airflow/cli/commands/task_command.pybut had nothing to point at.The command selects a Dag run with either
run_idor--logical-dateand prints the state of the task instance. It goes through the existingtask_instances.getendpoint, so no change tooperations.pywas needed.To stay consistent with the sibling commands, it reuses the argument handling, validation and error wording already used by
tasks failed-deps:run_id/--logical-dateis required--logical-datemust be parseable and timezone-aware--map-indexis reported in the 404 message, so a missing mapped instance is distinguishable from a missing taskIt prints
Nonefor a task instance with no state, matching the output of the deprecated command so scripts migrating across keep working.closes: #66174
Tests
16 new tests in
TestStatecovering state values, unset state, map index, logical-date lookup, both argument-validation failures, bad logical dates, 404 handling with and without a map index, missing Dag run, and non-404 propagation.46 passedfor the fulltest_task_command.pyfile — no existing test was modified.ruff check,ruff format --checkandmypyare clean on the changed files.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Sonnet 5) following the guidelines