Open abrookins opened 6 months ago
Makes sense to me. I can implement a POC with the work I'm currently building in the global concurrency limit CLI.
Unassigned myself for now as this a variety of PRs may help close this issue.
The POC has been created in the above PR, so anyone can contribute easily to this!
Hi @abrookins! I would like to be assigned this issue.
IMO all CLI commands that output anything should support JSON output to allow scripting.
Currently, the issue is not only that output has to be parsed (so eg. a change in formatting of the output could break scripts), but that it can also be trimmed by Rich. So for semi-reliability, all scripts using Prefect CLI's output must currently set the COLUMNS
env var to a high value (eg. 200) to ensure output is not trimmed in some environments (eg. GitHub Actions' default shell width is 80). Or just use the REST API instead.
First check
Prefect Version
2.x
Describe the current behavior
Running a command like
prefect work-pool inspect <name>
always outputs object representations in Python objects.Describe the proposed behavior
Running a command like
prefect work-pool inspect <name>
should support a flag to output the result in JSON.Example Use
prefect work-pool inspect <name> --output=json
prefect work-pool inspect <name> -o json
Additional context
There are times when it can be useful to save JSON representations to use as subsequent input to commands that expect JSON, such as
prefect work-pool update <name> --base-job-template <file.json>
.