WorkflowAnalyzer
class provides tools to analyze and optimize workflows built using the Workflow
class. It offers insights into critical paths, parallel execution opportunities, and dependency visualizations, enabling you to fine-tune workflows for efficiency.
Parameters
workflow
(Workflow object): The workflow to be analyzed. This must be an instance of theWorkflow
class.size
(float): (Optional) The width of the component in a row. Defaults to1.0
(full row). See the Layout Guide for details.
Functions
preswald.Workflow
object to the WorkflowAnalyzer
.
get_critical_path
Returns:
graph
(nx.DiGraph): a NetworkX graph representation of the workflow.
Returns:
critical_path
(list): A list of atom names in the critical path, highlighting the workflow bottleneck.
Returns:
parallel_groups
(list of sets): Each subset contains atom names that can be computed simultaneously.
Parameters:
highlight_path
(list, optional): A list of atom names to highlight in the visualization (e.g., the critical path). If not provided, the entire DAG is displayed.title
(str, optional): The title of the visualization. Defaults to"Workflow Dependency Graph"
.
Returns:
- Plotly Chart: An interactive visualization of the workflow’s dependencies.
Usage Example
Key Features
-
Critical Path Analysis:
- Identify workflow bottlenecks.
- Optimize the sequence of computations.
-
Parallel Execution Groups:
- Highlight opportunities for parallel processing.
- Improve efficiency in workflows with independent atoms.
-
Interactive DAG Visualization:
- Explore dependencies visually.
- Highlight specific paths for focused analysis.
Why Use WorkflowAnalyzer
?
- Optimize Performance: Identify critical paths and parallelizable tasks.
- Visualize Complex Workflows: Clearly understand dependencies and bottlenecks.
- Fine-Tune Workflows: Gain actionable insights for optimization.
WorkflowAnalyzer
! 🔬