cloudmesh.cc.workflow

Cloudmesh Workflow.

This class enables to manage dependencies between jobs. To specify dependencies we can use a string that includes comma separated names of jobs. The workflow can be stored into a yaml file:

g = Graph()
g.edges
g.nodes

g.add_edges("a,b,d")
g.add_edges("a,c,d") # will also add missing nodes

g.add_nodes("a", {"status"="ready"})
g.add_nodes("b", "status"="ready")    # will use dict update not eliminate other fields

g.add_nodes("a,b,d", "status"="ready")
    # will add the nodes, but also update the internal attributes for the nodes,
    eg sets state to ready

g.export("a.pdf")

A show function is available that allow the plotting of nodes with a default layout and color values defined by a color map. By default a colormap for status with:

ready = white
failed = red
running = blue
done= green

is used. One has the ability to define color maps for any key that contains strings.

To for example change the status colors you could use:

g.set_color("status",
            {"ready": "green",
             "failed": "yellow",
             "running": "orange",
             "done": "white"}
             "other": "grey"
            )

as you can see you can also define colors for other values that could be set in this case for the node status. To display the graph you can say:

g.show()

Classes

Graph([name, filename, clear])

The Graph class handles the generation of workflow diagrams.

Workflow([name, filename, runtime_dir, ...])

Workflow class that runs all jobs, handles dependencies, etc.