History is kept by flow id: runs, cascades, rollups and events file the id in their flow column and nodes as <flow id>.<node>, the API answers flow plus flow_name and shows and takes nodes as <key>.<node>; events carry flow_id from the moment they are published; run queue items, the stage cache and cached curves keep ids and keys apart; endpoints, the brain graph, device bindings and search name the id to open
This commit is contained in:
@@ -110,19 +110,20 @@ async def delete_flavor(
|
||||
|
||||
|
||||
def _usages(controller: FlowControllerDep, name: str) -> list[str]:
|
||||
"""Which nodes name this flavor, published or in a draft."""
|
||||
"""Which nodes name this flavor, published or in a draft, as
|
||||
``<key>.<node>``."""
|
||||
used: list[str] = []
|
||||
for flow_name in controller.store.list_flows():
|
||||
for flow_id in controller.store.list_flows():
|
||||
seen = set()
|
||||
for draft in (False, True):
|
||||
if draft and not controller.store.has_draft(flow_name):
|
||||
if draft and not controller.store.has_draft(flow_id):
|
||||
continue
|
||||
try:
|
||||
flow = controller.store.read_flow(flow_name, draft=draft)
|
||||
flow = controller.store.read_flow(flow_id, draft=draft)
|
||||
except Exception:
|
||||
continue
|
||||
for node in flow.nodes:
|
||||
if node.resources is not None and node.resources.flavor == name:
|
||||
seen.add(f"{flow_name}.{node.id}")
|
||||
seen.add(f"{flow.name}.{node.id}")
|
||||
used.extend(sorted(seen))
|
||||
return used
|
||||
|
||||
Reference in New Issue
Block a user