Пример #1
0
 def makeplasm():
     plasm = ecto.Plasm()
     ping = ecto_test.Ping("Ping")
     sleeps = [ecto_test.Sleep("Sleep_0", seconds=0.1) for x in range(20)]
     plasm.connect(ping[:] >> sleeps[0][:])
     for i in range(1, 19):
         print "i=", i
         plasm.connect(sleeps[i][:] >> sleeps[i + 1][:])
     return plasm
Пример #2
0
def makeplasm():
    plasm = ecto.Plasm()

    ping = ecto_test.Ping("Ping")
    startstop = ecto_test.StartStopCounter()

    plasm.connect(ping[:] >> startstop[:])

    return (plasm, startstop)
Пример #3
0
def makeplasm():
    plasm = ecto.Plasm()

    ping = ecto_test.Ping("Ping")
    sleep0 = ecto_test.Sleep("Sleep_0", seconds=0.1)
    sleep1 = ecto_test.Sleep("Sleep_1", seconds=0.1)

    plasm.connect(ping[:] >> sleep0[:], sleep0[:] >> sleep1[:])

    return plasm
def makeplasm():
    plasm = ecto.Plasm()

    ping = ecto_test.Ping("Ping")
    sleep0 = ecto_test.SleepPyObjectAbuser(
        list_o_sleeps=[random.random() * 0.1 for i in range(1, 10)])
    sleep1 = ecto_test.SleepPyObjectAbuser(
        list_o_sleeps=[random.random() * 0.1 for i in range(1, 10)])

    plasm.connect(ping[:] >> sleep0[:], sleep0[:] >> sleep1[:])

    return plasm
Пример #5
0
def test_nodelay():
    plasm = ecto.Plasm()

    ping = ecto_test.Ping("Ping")
    metrics = ecto_test.Metrics("Metrics", queue_size=10)
    plasm.connect(ping[:] >> metrics[:])

    sched = ecto.Scheduler(plasm)
    sched.execute(niter=10000)
    print "Hz:", metrics.outputs.hz, " Latency in seconds: %f" % metrics.outputs.latency_seconds

    # these are kinda loose
    assert metrics.outputs.hz > 5000
    assert metrics.outputs.latency_seconds < 0.0001
Пример #6
0
def test_20hz():
    plasm = ecto.Plasm()

    ping = ecto_test.Ping("Ping")
    throttle = ecto_test.Throttle("Throttle", rate=20)
    metrics = ecto_test.Metrics("Metrics", queue_size=10)
    plasm.connect(ping[:] >> throttle[:], throttle[:] >> metrics[:])

    sched = ecto.Scheduler(plasm)
    sched.execute(niter=100)
    print "Hz:", metrics.outputs.hz, " Latency in seconds: %f" % metrics.outputs.latency_seconds

    # these are kinda loose
    assert 19 < metrics.outputs.hz < 21
    assert 0.04 < metrics.outputs.latency_seconds < 0.06
Пример #7
0
def makeplasm(n_nodes):
    plasm = ecto.Plasm()

    ping = ecto_test.Ping("Ping")
    throttle = ecto_test.Sleep("Sleep_0", seconds=1.0 / n_nodes)

    plasm.connect(ping[:] >> throttle[:])

    for j in range(n_nodes - 1):  # one has already been added
        throttle_next = ecto_test.Sleep("Sleep_%u" % (j + 1),
                                        seconds=1.0 / n_nodes)
        plasm.connect(throttle, "out", throttle_next, "in")
        throttle = throttle_next

    metrics = ecto_test.Metrics("Metrics", queue_size=4)
    plasm.connect(throttle[:] >> metrics[:])

    #    o = open('graph.dot', 'w')
    #    print >>o, plasm.viz()
    #    o.close()
    #    print "\n", plasm.viz(), "\n"

    return (plasm, metrics)