Executing workflows in GenSphere is straightforward using the GenFlow
class. This section explains how to execute your workflow and handle outputs.
Ensure that:
yaml
, functions.py
, schemas.py
) are available.Use the GenFlow
class to execute your workflow.
Example:
from gensphere.genflow import GenFlow
flow = GenFlow(
yaml_file='combined.yaml',
functions_filepath='functions.py',
structured_output_schema_filepath='schemas.py'
)
flow.parse_yaml()
flow.run()
After execution, outputs from each node are accessible via the outputs
attribute.
Example:
# Access all outputs
outputs = flow.outputs
# Access specific node outputs
data_collection_output = outputs.get('data_collection').get('collected_data')
# Print the outputs
print("Collected Data:")
print(data_collection_output)
If an error occurs during execution:
GenSphere uses Python’s logging module to log execution details.
import logging
logging.getLogger('gensphere').setLevel(logging.DEBUG)
app.log
or the console.The execution order of nodes is determined by their dependencies: