def init_supervisor_data(dotfile, sample_sets):
with open(dotfile) as wf:<EOL><INDENT>graph_data = wf.read()<EOL><DEDENT>graph = pydot.graph_from_dot_data(graph_data)[<NUM_LIT:0>]<EOL>nodes = [n.get_name().strip('<STR_LIT:">') for n in graph.get_nodes()]<EOL>monitor_data = dict()<EOL>dependencies = {n:[] for n in nodes}<EOL>for n in nodes:<EOL><INDENT>monitor_data[n] = dict()<EOL>for sset in sample_sets:<EOL><INDENT>monitor_data[n][sset] = {<EOL>'<STR_LIT:state>'        : "<STR_LIT>",<EOL>'<STR_LIT>'    : False,<EOL>'<STR_LIT>'    : False<EOL>}<EOL><DEDENT><DEDENT>edges = graph.get_edges()<EOL>for e in edges:<EOL><INDENT>source = e.get_source().strip('<STR_LIT:">')<EOL>dest = e.get_destination().strip('<STR_LIT:">')<EOL>dep = e.get_attributes()<EOL>dep['<STR_LIT>'] = source<EOL>dependencies[dest].append(dep)<EOL><DEDENT>return monitor_data, dependencies<EOL>
Parse a workflow description written in DOT (like Firehose)