mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 08:26:21 +02:00
Add class-level docstrings to five public classes in trustgraph-base: Flow, LlmService, ConsumerMetrics, ToolClient, and TriplesStoreService. Each docstring summarises the class's role in the system to aid discoverability for new contributors. Signed-off-by: Jenkins, Kenneth Alexander <kjenkins60@gatech.edu>
39 lines
1 KiB
Python
39 lines
1 KiB
Python
|
|
import asyncio
|
|
|
|
class Flow:
|
|
"""
|
|
Runtime representation of a deployed flow process.
|
|
|
|
This class maintains internal processor states and orchestrates
|
|
lifecycles (start, stop) for inputs (consumers) and parameters
|
|
that drive data flowing across linked nodes.
|
|
"""
|
|
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
|