Use CLI JSON outputΒΆ
The Flower CLI can return JSON output for automation and integration with other tools.
Note
JSON output is available for the commands documented here because they operate through the SuperLink Control API. This includes remote SuperLinks as well as the managed local SuperLink used by local simulation profiles.
This guide shows JSON output for:
flwr runflwr listflwr stop
flwr run JSON outputΒΆ
The flwr run command submits a Flower App run. For a local app, the CLI first builds a
FAB and then starts the run through the Control API.
Representative default output:
$ flwr run . local --stream
Successfully built flwrlabs.myawesomeapp.1-0-0.014c8eb3.fab
Starting local SuperLink on 127.0.0.1:39093...
Successfully started run 1859953118041441032
...
To return structured JSON instead, use --format json:
$ flwr run . local --format json
{
"success": true,
"run-id": "1859953118041441032",
"fab-id": "flwrlabs/myawesomeapp",
"fab-name": "myawesomeapp",
"fab-version": "1.0.0",
"fab-hash": "014c8eb3",
"fab-filename": "flwrlabs.myawesomeapp.1-0-0.014c8eb3.fab"
}
The flwr run JSON output contains:
success:trueif the command succeededrun-id: the submitted run IDfab-id: the Flower App identifierfab-name: the Flower App namefab-version: the Flower App versionfab-hash: the short FAB hashfab-filename: the built FAB filename
If the command fails, the JSON output contains success: false and error-message.
flwr list JSON outputΒΆ
The flwr list command queries runs from the current SuperLink connection.
Representative default output:
$ flwr list
Listing all runs...
βββββββββββββββββββββββ³βββββββββββββββββββ³βββββββββββββββββββββ³βββββββββββ³βββββββββββββββββββββ³βββββββββββββββββββββ³βββββββββββββββββββββ
β Run ID β FAB β Status β Elapsed β Pending At β Running At β Finished At β
β‘ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ©
β 1859953118041441032 β flwrlabs/myawesβ¦ β finished:completed β 00:00:55 β 2024-12-16 β 2024-12-16 β 2024-12-16 β
β β (v1.0.0) β β β 11:12:33Z β 11:12:33Z β 11:13:28Z β
βββββββββββββββββββββββΌβββββββββββββββββββΌβββββββββββββββββββββΌβββββββββββΌβββββββββββββββββββββΌβββββββββββββββββββββΌβββββββββββββββββββββ€
β 1420074065701160142 β flwrlabs/myawesβ¦ β running β 00:00:09 β 2024-12-16 β 2024-12-16 β N/A β
β 0 β (v1.0.0) β β β 12:18:39Z β 12:18:39Z β β
βββββββββββββββββββββββ΄βββββββββββββββββββ΄βββββββββββββββββββββ΄βββββββββββ΄βββββββββββββββββββββ΄βββββββββββββββββββββ΄βββββββββββββββββββββ
To return structured JSON instead:
$ flwr list --format json
{
"success": true,
"runs": [
{
"run-id": "1859953118041441032",
"federation": "",
"fab-id": "flwrlabs/myawesomeapp",
"fab-name": "myawesomeapp",
"fab-version": "1.0.0",
"fab-hash": "014c8eb3",
"status": "finished:completed",
"elapsed": 55.0,
"pending-at": "2024-12-16 11:12:33Z",
"starting-at": "2024-12-16 11:12:33Z",
"running-at": "2024-12-16 11:12:33Z",
"finished-at": "2024-12-16 11:13:28Z",
"network-traffic": {
"inbound-bytes": 12345,
"outbound-bytes": 6789,
"total-bytes": 19134
},
"compute-time": {
"serverapp-seconds": 5.2,
"clientapp-seconds": 42.7,
"total-seconds": 47.9
}
},
{
"run-id": "14200740657011601420",
"federation": "",
"fab-id": "flwrlabs/myawesomeapp",
"fab-name": "myawesomeapp",
"fab-version": "1.0.0",
"fab-hash": "014c8eb3",
"status": "running",
"elapsed": 9.0,
"pending-at": "2024-12-16 12:18:39Z",
"starting-at": "2024-12-16 12:18:39Z",
"running-at": "2024-12-16 12:18:39Z",
"finished-at": "N/A",
"network-traffic": {
"inbound-bytes": 4567,
"outbound-bytes": 2345,
"total-bytes": 6912
},
"compute-time": {
"serverapp-seconds": 0.6,
"clientapp-seconds": 8.1,
"total-seconds": 8.7
}
}
]
}
Each entry under runs contains:
run-id: the run IDfederation: the federation identifier, if anyfab-id/fab-name/fab-version/fab-hash: Flower App metadatastatus: the current run statuselapsed: elapsed run time in secondspending-at/starting-at/running-at/finished-at: run timestampsnetwork-traffic: inbound, outbound, and total bytescompute-time: ServerApp, ClientApp, and total compute time in seconds
To return the detail view for a single run, use:
$ flwr list --run-id 1859953118041441032 --format json
This returns the same top-level structure with one entry in runs.
flwr stop JSON outputΒΆ
The flwr stop command stops a submitted or running run by run ID.
Representative default output:
$ flwr stop 1859953118041441032
Stopping run ID 1859953118041441032...
Run 1859953118041441032 successfully stopped.
To return structured JSON instead:
$ flwr stop 1859953118041441032 --format json
{
"success": true,
"run-id": "1859953118041441032"
}
If the command fails, the JSON output contains success: false and error-message.