labscheduler.dev_tools.visualization module

labscheduler.dev_tools.visualization.visualize_workflow(operations: list[Operation]) None[source]

Visualizes a directed graph of operations using Graphviz.

Node properties:

  • Color:
    • Red if both start and finish are None.

    • Yellow if start is not None but finish is None.

    • Green if neither start nor finish are None.

  • Label:
    • The first line is taken from operation.main_machine.preferred if it exists; otherwise, operation.main_machine.type is used.

    • The second line shows the duration.

    • If no main_machine is provided, the operation’s name is used as a fallback.

Edge properties:

  • For each edge from a preceding operation to an operation, the label is constructed from:
    • “Min:” from min_wait if the value exists and is non-zero.

    • “Max:” from max_wait if the value exists and is not infinity.

    • “Cost:” from wait_cost if the value exists.

    The three parts are concatenated together with commas. If none of the values are relevant, the edge is unlabeled.

The graph is oriented top-to-bottom (TB) and is saved locally as “workflow_graph.png”, which will be overwritten each time. The image is opened in the default viewer.