fdq: fix datasets/jobs formatting
1 changed file +3 −2
modified
scripts/fdq
+3 −2
@@ -19,7 +19,8 @@ case "$cmd" in | ||
| 19 | 19 | health) curl -s -H "Authorization: Bearer $KEY" "$BASE/api/v1/health" | j ;; |
| 20 | 20 | datasets) curl -s -H "Authorization: Bearer $KEY" "$BASE/api/v1/catalog/datasets" | python3 -c 'import sys,json |
| 21 | 21 | for d in json.load(sys.stdin)["data"]: |
| 22 | − print(f"{d[\"id\"]:<44} {d[\"status\"]:<10} rows={(d.get(\"row_count\") or 0):>14,} {d.get(\"first_session\") or \"\"} -> {d.get(\"last_session\") or \"\"}")' ;; | |
| 22 | + i, st, rows, a, b = d["id"], d["status"], d.get("row_count") or 0, d.get("first_session") or "", d.get("last_session") or "" | |
| 23 | + print("%-44s %-10s rows=%14s %s -> %s" % (i, st, format(rows, ","), a, b))' ;; | |
| 23 | 24 | bars) curl -s -H "Authorization: Bearer $KEY" --get "$BASE/api/v1/market/bars" --data-urlencode "symbol=$1" --data-urlencode "interval=$2" --data-urlencode "start=$3" --data-urlencode "end=$4" --data-urlencode "adjustment=${5:-raw}" --data-urlencode "limit=${LIMIT:-10000}" | j ;; |
| 24 | 25 | sql) SQL="$1" MAXROWS="${2:-1000}" python3 -c ' |
| 25 | 26 | import os, sys, json, urllib.request |
@@ -49,7 +50,7 @@ with urllib.request.urlopen(urllib.request.Request(base + "/api/v1/exports/" + e | ||
| 49 | 50 | print(os.environ["OUT"] + ": " + str(st["row_count"]) + " rows, " + str(st["bytes"]) + " bytes, dataset v" + str(st["snapshot"].get("version")))' ;; |
| 50 | 51 | jobs) curl -s -H "Authorization: Bearer $KEY" "$BASE/api/v1/admin/jobs?limit=${LIMIT:-30}" | python3 -c 'import sys,json |
| 51 | 52 | for j in json.load(sys.stdin)["data"]: |
| 52 | − print(f"{j[\"id\"][:8]} {j[\"kind\"]:<12} {str(j[\"dataset_id\"]):<36} {j[\"status\"]:<9} {str(j[\"created_at\"])[:16]} {str(j.get(\"last_error\") or \"\")[:60]}")' ;; | |
| 53 | + print("%s %-12s %-36s %-9s %s %s" % (j["id"][:8], j["kind"], str(j["dataset_id"]), j["status"], str(j["created_at"])[:16], str(j.get("last_error") or "")[:60]))' ;; | |
| 53 | 54 | enqueue) curl -s -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d "$1" "$BASE/api/v1/admin/jobs" | j ;; |
| 54 | 55 | get) curl -s -H "Authorization: Bearer $KEY" "$BASE$1" | j ;; |
| 55 | 56 | post) curl -s -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d "${2:-{}}" "$BASE$1" | j ;; |
| 56 | 57 | |