Пример #1
0
def showAllParameters():
    mods = _vistle.getRunning()
    print("id\tmodule\tname\ttype\tvalue")
    for m in mods:
        name = _vistle.getModuleName(m)
        params = _vistle.getParameters(m)
        for p in params:
            print("%s\t%s\t%s\t%s\t%s" %
                  (m, name, p, _vistle.getParameterType(
                      m, p), getSavableParam(m, p)))
Пример #2
0
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]])
Пример #3
0
def saveParameters(f, mod):
    params = _vistle.getParameters(mod)
    paramChanges = False
    for p in params:
        if not _vistle.isParameterDefault(mod, p):
            f.write("set" + getParameterType(mod, p) + "Param(" + modvar(mod) +
                    ", '" + p + "', " + str(getSavableParam(mod, p)) +
                    ", True)\n")
            paramChanges = True
    if paramChanges:
        f.write("applyParameters(" + modvar(mod) + ")\n")
    f.write("\n")
Пример #4
0
def showParameters(id):
    params = _vistle.getParameters(id)
    print("name\ttype\tvalue")
    for p in params:
        print("%s\t%s\t%s" %
              (p, _vistle.getParameterType(id, p), getParameter(id, p)))