Flows and dashboards are created by POST under an issued or superuser-pinned id; PUT only updates; deleted flows leave a tombstone with their key; the controller stores by id and runs by key, hooks live under /hooks/<flow id>; a key with state or queued work behind it is refused until cleared
This commit is contained in:
@@ -89,9 +89,10 @@ def ensure_flow(api: Api) -> None:
|
||||
try:
|
||||
current = api.call("GET", f"/api/v1/flows/{BENCH_FLOW}")
|
||||
definition["version"] = current["definition"]["version"]
|
||||
api.call("PUT", f"/api/v1/flows/{BENCH_FLOW}", definition)
|
||||
except urllib.error.HTTPError:
|
||||
pass
|
||||
api.call("PUT", f"/api/v1/flows/{BENCH_FLOW}", definition)
|
||||
# Pinned to its key, so every path below can name it.
|
||||
api.call("POST", "/api/v1/flows/", {**definition, "id": BENCH_FLOW})
|
||||
api.call(
|
||||
"PUT", f"/api/v1/flows/{BENCH_FLOW}/nodes/noop/source", {"code": NODE_SOURCE}
|
||||
)
|
||||
|
||||
@@ -354,9 +354,13 @@ def create_flow(
|
||||
definition: dict[str, Any],
|
||||
sources: dict[str, str] | None = None,
|
||||
) -> None:
|
||||
"""Draft, node source, publish — the sequence the editor uses."""
|
||||
"""Draft, node source, publish — the sequence the editor uses.
|
||||
|
||||
Pinned to its key, which the superuser running this may, so the hooks and
|
||||
paths below can name it.
|
||||
"""
|
||||
name = definition["name"]
|
||||
response = client.put(f"/api/v1/flows/{name}", json=definition)
|
||||
response = client.post("/api/v1/flows/", json={**definition, "id": name})
|
||||
response.raise_for_status()
|
||||
version = response.json()["definition"]["version"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user