def showAllConnections(): mods = _vistle.getRunning() for m in mods: ports = _vistle.getOutputPorts(m) ports.extend(getParameters(m)) for p in ports: conns = _vistle.getConnections(m, p) for c in conns: print("%s:%s -> %s:%s" % (m, p, c[0], c[1]))
def saveWorkflow(f, mods, numSlaves, remote): f.write("\n") if remote: f.write("# spawn all remote modules\n") else: f.write("# spawn all local modules\n") for m in mods: hub = _vistle.getHub(m) if (remote and hub == _vistle.getMasterHub()) or ( not remote and hub != _vistle.getMasterHub()): continue #f.write(modvar(m)+" = spawn('"+_vistle.getModuleName(m)+"')\n") f.write("u" + modvar(m) + " = spawnAsync(" + hubVarForModule(m, numSlaves) + ", '" + _vistle.getModuleName(m) + "')\n") f.write("\n") for m in mods: hub = _vistle.getHub(m) if (remote and hub == _vistle.getMasterHub()) or ( not remote and hub != _vistle.getMasterHub()): continue f.write(modvar(m) + " = waitForSpawn(u" + modvar(m) + ")\n") saveParameters(f, m) if remote: f.write("# connections between local and remote\n") else: f.write("# all local connections\n") writtenConns = [] for m in mods: hub = _vistle.getHub(m) if (not remote and hub != _vistle.getMasterHub()): continue ports = _vistle.getOutputPorts(m) params = _vistle.getParameters(m) all = ports + params for p in all: conns = _vistle.getConnections(m, p) for c in conns: hub2 = _vistle.getHub(c[0]) if (remote and hub == _vistle.getMasterHub() and hub2 == _vistle.getMasterHub()) or ( not remote and (hub != _vistle.getMasterHub() or hub2 != _vistle.getMasterHub())): continue if [str(m), p] in writtenConns: continue else: f.write("connect(" + modvar(m) + ",'" + str(p) + "', " + modvar(c[0]) + ",'" + str(c[1]) + "')\n") writtenConns.append([str(c[0]), c[1]])
def showConnections(id, port): conns = _vistle.getConnections(id, port) print("id\tportname") for c in conns: print("%s\t%s" % (c[0], c[1]))
def showConnections(id, port): conns = _vistle.getConnections(id, port) print("id\tportname") for c in conns: print("%s\t%s" % (c.first, c.second))