ccoliu opened a new pull request, #77580: URL: https://github.com/apache/airflow/pull/77580
closes: #77579 `airflowctl tasks state`, `tasks failed-deps` and `tasks logs` only take `--map-index`, but every iteration of a task loop shares the task id and map index; the API tells them apart by `region_id` and `region_index` and answers `400: Select a region and index for this task instance` without them. So these commands can't reach a task instance inside a loop: they print the generic "Please check the command and its parameters" error, but no parameter can select the iteration. ### Changes - **`TaskInstancesOperations.get`, `get_dependencies` and `logs`** take `region_id` and `region_index` and send them as query parameters. The auto-generated `airflowctl taskinstances get`, `get-dependencies` and `logs` commands pick them up as `--region-id` / `--region-index` too. - **`tasks state`, `tasks failed-deps` and `tasks logs`** get `--region-id` (validated as a UUID) and `--region-index`. Passing only one of them exits with an error before any request. - When the API answers "Select a region and index for this task instance", these commands say the task runs inside a task loop and point to the two options and to `states-for-dag-run`. Other 400 errors are re-raised as before. A 404 for a given region mentions it. - **`tasks states-for-dag-run`** adds `region_id` and `region_index` columns when the run has task instances in a loop, filled for those task instances only. A mapped task outside a loop has a region too, but is still selected by its map index, so it's left blank. Runs without loops print the same columns as before. ### Tests New tests in `test_task_command.py` and `test_operations.py` cover the region being passed by each command and operation, the loop error message, re-raising other 400s, the 404 message with a region, passing only one of the two options, and a malformed region id; 22 of them fail without the change. The airflowctl suite otherwise passes as before. Verified on `apache/airflow:3.4.0` with a loop of three iterations: `states-for-dag-run` shows each iteration's `region_id` and `region_index`; `tasks state`, `failed-deps` and `logs` with `--region-id ... --region-index 2` return iteration 2 (its log prints `running iteration 2`); without the options they print the loop message; and `taskinstances get` with the options returns that iteration. Before the change, the same commands printed the generic client error. --- ##### Was generative AI tooling used to co-author this PR? - [x] Yes — Claude Code (Claude Opus 5.5) -- 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]
