示例#1
0
def main():
    """
    Just runs some example code.
    """

    # setup the flow
    flow = Flow(name="math expression")

    outer = ForLoop()
    outer.config["max"] = 100
    flow.actors.append(outer)

    expr = MathExpression()
    expr.config["expression"] = "math.sqrt({X})"
    flow.actors.append(expr)

    console = Console()
    flow.actors.append(console)

    # run the flow
    msg = flow.setup()
    if msg is None:
        print("\n" + flow.tree + "\n")
        msg = flow.execute()
        if msg is not None:
            print("Error executing flow:\n" + msg)
    else:
        print("Error setting up flow:\n" + msg)
    flow.wrapup()
    flow.cleanup()
def main():
    """
    Just runs some example code.
    """

    # setup the flow
    flow = Flow(name="math expression")

    outer = ForLoop()
    outer.config["max"] = 100
    flow.actors.append(outer)

    expr = MathExpression()
    expr.config["expression"] = "math.sqrt({X})"
    flow.actors.append(expr)

    console = Console()
    flow.actors.append(console)

    # run the flow
    msg = flow.setup()
    if msg is None:
        print("\n" + flow.tree + "\n")
        msg = flow.execute()
        if msg is not None:
            print("Error executing flow:\n" + msg)
    else:
        print("Error setting up flow:\n" + msg)
    flow.wrapup()
    flow.cleanup()
def main():
    """
    Just runs some example code.
    """

    # setup the flow
    flow = Flow(name="update storage value")

    start = Start()
    flow.actors.append(start)

    init = InitStorageValue()
    init.config["storage_name"] = "max"
    init.config["value"] = "int(1)"
    flow.actors.append(init)

    trigger = Trigger()
    flow.actors.append(trigger)

    outer = ForLoop()
    outer.name = "outer"
    outer.config["max"] = 3
    trigger.actors.append(outer)

    trigger2 = Trigger()
    trigger.actors.append(trigger2)

    inner = ForLoop()
    inner.name = "inner"
    inner.config["max"] = "@{max}"
    trigger2.actors.append(inner)

    console = Console()
    trigger2.actors.append(console)

    update = UpdateStorageValue()
    update.config["storage_name"] = "max"
    update.config["expression"] = "{X} + 2"
    trigger.actors.append(update)

    # run the flow
    msg = flow.setup()
    if msg is None:
        print("\n" + flow.tree + "\n")
        msg = flow.execute()
        if msg is not None:
            print("Error executing flow:\n" + msg)
    else:
        print("Error setting up flow:\n" + msg)
    flow.wrapup()
    flow.cleanup()
示例#4
0
def main():
    """
    Just runs some example code.
    """

    # setup the flow
    flow = Flow(name="combine storage")

    outer = ForLoop()
    outer.name = "outer"
    outer.config["max"] = 3
    flow.actors.append(outer)

    ssv = SetStorageValue()
    ssv.config["storage_name"] = "max"
    flow.actors.append(ssv)

    trigger = Trigger()
    flow.actors.append(trigger)

    inner = ForLoop()
    inner.name = "inner"
    inner.config["max"] = "@{max}"
    trigger.actors.append(inner)

    ssv2 = SetStorageValue()
    ssv2.config["storage_name"] = "inner"
    trigger.actors.append(ssv2)

    trigger2 = Trigger()
    trigger.actors.append(trigger2)

    combine = CombineStorage()
    combine.config["format"] = "@{max} / @{inner}"
    trigger2.actors.append(combine)

    console = Console()
    trigger2.actors.append(console)

    # run the flow
    msg = flow.setup()
    if msg is None:
        print("\n" + flow.tree + "\n")
        msg = flow.execute()
        if msg is not None:
            print("Error executing flow:\n" + msg)
    else:
        print("Error setting up flow:\n" + msg)
    flow.wrapup()
    flow.cleanup()
def main():
    """
    Just runs some example code.
    """

    # setup the flow
    flow = Flow(name="init storage value")

    start = Start()
    flow.actors.append(start)

    init = InitStorageValue()
    init.config["storage_name"] = "max"
    init.config["value"] = "int(3)"
    flow.actors.append(init)

    trigger = Trigger()
    flow.actors.append(trigger)

    inner = ForLoop()
    inner.name = "inner"
    inner.config["max"] = "@{max}"
    trigger.actors.append(inner)

    console = Console()
    trigger.actors.append(console)

    # run the flow
    msg = flow.setup()
    if msg is None:
        print("\n" + flow.tree + "\n")
        msg = flow.execute()
        if msg is not None:
            print("Error executing flow:\n" + msg)
    else:
        print("Error setting up flow:\n" + msg)
    flow.wrapup()
    flow.cleanup()
示例#6
0
def main():
    """
    Just runs some example code.
    """

    # setup the flow
    flow = Flow(name="stopping the flow")

    outer = ForLoop()
    outer.config["max"] = 10
    flow.actors.append(outer)

    ssv = SetStorageValue()
    ssv.config["storage_name"] = "current"
    flow.actors.append(ssv)

    tee = Tee()
    tee.config["condition"] = "@{current} == 7"
    flow.actors.append(tee)

    stop = Stop()
    tee.actors.append(stop)

    console = Console()
    flow.actors.append(console)

    # run the flow
    msg = flow.setup()
    if msg is None:
        print("\n" + flow.tree + "\n")
        msg = flow.execute()
        if msg is not None:
            print("Error executing flow:\n" + msg)
    else:
        print("Error setting up flow:\n" + msg)
    flow.wrapup()
    flow.cleanup()
def main():
    """
    Just runs some example code.
    """

    # setup the flow
    flow = Flow(name="stopping the flow")

    outer = ForLoop()
    outer.config["max"] = 10
    flow.actors.append(outer)

    ssv = SetStorageValue()
    ssv.config["storage_name"] = "current"
    flow.actors.append(ssv)

    tee = Tee()
    tee.config["condition"] = "@{current} == 7"
    flow.actors.append(tee)

    stop = Stop()
    tee.actors.append(stop)

    console = Console()
    flow.actors.append(console)

    # run the flow
    msg = flow.setup()
    if msg is None:
        print("\n" + flow.tree + "\n")
        msg = flow.execute()
        if msg is not None:
            print("Error executing flow:\n" + msg)
    else:
        print("Error setting up flow:\n" + msg)
    flow.wrapup()
    flow.cleanup()
def main():
    """
    Just runs some example code.
    """

    # setup the flow
    flow = Flow(name="combine storage")

    outer = ForLoop()
    outer.name = "outer"
    outer.config["max"] = 3
    flow.actors.append(outer)

    ssv = SetStorageValue()
    ssv.config["storage_name"] = "max"
    flow.actors.append(ssv)

    trigger = Trigger()
    flow.actors.append(trigger)

    inner = ForLoop()
    inner.name = "inner"
    inner.config["max"] = "@{max}"
    trigger.actors.append(inner)

    ssv2 = SetStorageValue()
    ssv2.config["storage_name"] = "inner"
    trigger.actors.append(ssv2)

    trigger2 = Trigger()
    trigger.actors.append(trigger2)

    combine = CombineStorage()
    combine.config["format"] = "@{max} / @{inner}"
    trigger2.actors.append(combine)

    console = Console()
    trigger2.actors.append(console)

    # run the flow
    msg = flow.setup()
    if msg is None:
        print("\n" + flow.tree + "\n")
        msg = flow.execute()
        if msg is not None:
            print("Error executing flow:\n" + msg)
    else:
        print("Error setting up flow:\n" + msg)
    flow.wrapup()
    flow.cleanup()