def test_doc(): scatter = ecto_test.Scatter(n=6, x=3) gather = ecto_test.Gather(n=3) gather2 = ecto_test.Gather(n=3) plasm = ecto.Plasm() plasm.connect(scatter["out_0000", "out_0001", "out_0002"] >> gather[:], scatter["out_0003", "out_0004", "out_0005"] >> gather2[:]) plasm.execute() result = gather.outputs.out assert (result == 9) # 3 * 3 assert scatter.__doc__ != None assert gather.__doc__ != None assert type(plasm.viz()) == str
def bad_syntax_errors(): scatter = ecto_test.Scatter(n=3, x=3) scatter2 = ecto_test.Scatter(n=5, x=10) gather = ecto_test.Gather(n=3) gather2 = ecto_test.Gather(n=5) try: plasm = ecto.Plasm() plasm.connect( scatter[:] >> gather2[:] ) util.fail("Should not work as there is a size mismatch...") except RuntimeError, e: print e
def test_plasm(): scatter = ecto_test.Scatter(n=3, x=3) scatter2 = ecto_test.Scatter(n=5, x=10) gather = ecto_test.Gather(n=3) gather2 = ecto_test.Gather(n=5) plasm = ecto.Plasm() p = ecto.Plasm() #test the old syntax. p.connect(scatter, "out_0000", gather, "in_0000") try: p2 = ecto.Plasm() p2.connect(scatter, "out_0000", gather, "idn_0001") util.fail() except ecto.NonExistant, e: print ">>>",e assert "'in_0000':type(int) 'in_0001':type(int) 'in_0002':type(int)" in str(e) print "(threw as expected)\n\n"
#!/usr/bin/env python import ecto, signal, ecto_test, sys terminate_req = False def terminate(sign, frame): global terminate_req print 'termination requested' terminate_req = True #ecto_test.abort() #for gdb break point #install callback signal.signal(signal.SIGTERM, terminate) signal.signal(signal.SIGQUIT, terminate) scatter = ecto_test.Scatter(n=3, x=3) gather = ecto_test.Gather(n=3) plasm = ecto.Plasm() plasm.connect(scatter[:] >> gather[:]) sched = ecto.Scheduler(plasm) count = 0 while (terminate_req == False) and (sched.execute(niter=1)): count += 1 print count