feat: add --output json support to task-run ls command#20755
Open
cluster2600 wants to merge 3 commits intoPrefectHQ:mainfrom
Open
feat: add --output json support to task-run ls command#20755cluster2600 wants to merge 3 commits intoPrefectHQ:mainfrom
cluster2600 wants to merge 3 commits intoPrefectHQ:mainfrom
Conversation
Adds machine-readable JSON output to the command, following the same pattern established in and . - Add / option accepting format - When is set, serialize flows with orjson and print - Preserve existing Rich table rendering when flag is not provided - Add tests for JSON output, empty list, short flag (-o), and invalid format error Closes PrefectHQ#20752
Adds machine-readable JSON output to the `prefect work-pool ls` command, following the same pattern established in `flow-run ls`, `deployment ls`, and `work-pool inspect`. - Add `--output`/`-o` option accepting `"json"` format - When `--output json` is set, serialize work pools with orjson and print - Preserve existing Rich table rendering when flag is not provided - Add tests for JSON output, empty list, short flag (-o), and invalid format error Related to PrefectHQ#19483
Adds machine-readable JSON output to the `prefect task-run ls` command, following the same pattern established in `flow-run ls`, `deployment ls`, and `task-run inspect`. - Add `--output`/`-o` option accepting `"json"` format - When `--output json` is set, serialize task runs with orjson and print - Empty result returns JSON empty array `[]` instead of "No task runs found" - Preserve existing Rich table rendering when flag is not provided - Add tests for JSON output, empty list, and invalid format error Related to PrefectHQ#19483
Merging this PR will not alter performance
Comparing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds machine-readable JSON output to the
prefect task-run lscommand, following the existing pattern established intask-run inspect,flow-run ls, anddeployment ls.Changes
--output/-ooption totask-run lsaccepting"json"format--output jsonis set, task runs are serialized viaorjsonwith pretty-printing and printed to stdout[]instead of the human-readable "No task runs found." messageUsage
Related
Related to #19483 (checks off
task-run lsfrom the list)Checklist
task_run.py inspect,flow_run.py,deployment.py)