trustgraph/trustgraph-base/trustgraph/base/flow.py
cybermaggedon 9a34ab1b93
Complete remaining parameter work (#530)
* Fix CLI typo

* Complete flow parameters work, still needs implementation in LLMs
2025-09-24 13:58:34 +01:00

32 lines
789 B
Python

import asyncio
class Flow:
def __init__(self, id, flow, processor, defn):
self.id = id
self.name = flow
self.producer = {}
# Consumers and publishers. Is this a bit untidy?
self.consumer = {}
self.parameter = {}
for spec in processor.specifications:
spec.add(self, processor, defn)
async def start(self):
for c in self.consumer.values():
await c.start()
async def stop(self):
for c in self.consumer.values():
await c.stop()
def __call__(self, key):
if key in self.producer: return self.producer[key]
if key in self.consumer: return self.consumer[key]
if key in self.parameter: return self.parameter[key].value
return None