def restore_motif(self, wfdict): wf = bases.wfgraph('local_taskgraph') for k,v in wfdict.items(): tmpmod = bases.mod(k, v['res']) if v['host_id']!=None: tmpmod.host_id = v['host_id'] wf.add(tmpmod) for k,v in wfdict.items(): if len(v['suc'])>0: for l,c in v['suc'].items(): if l in wfdict.keys(): bases.mod_join(wf.get(k), wf.get(l), c) return wf
def taskgraph(name): wf = bases.wfgraph(name) w0 = bases.mod('w0', 25) w1 = bases.mod('w1', 12) w2 = bases.mod('w2', 24) w0.host_id = 'c0' w1.host_id = 'c1' w3 = bases.mod('w3', 20) w4 = bases.mod('w4', 64) bases.mod_join(w0, w2, 100) bases.mod_join(w1, w2, 200) bases.mod_join(w2, w3, 180) bases.mod_join(w2, w4, 400) wf.add(w0) wf.add(w1) wf.add(w2) wf.add(w3) wf.add(w4) return wf