Ejemplo n.º 1
0
def master():
    this_actor.info("Start 1st sleeper")
    actor = Actor.create("1st sleeper from master", Host.current(), sleeper)
    this_actor.info("Join the 1st sleeper (timeout 2)")
    actor.join(2)

    this_actor.info("Start 2nd sleeper")
    actor = Actor.create("2nd sleeper from master", Host.current(), sleeper)
    this_actor.info("Join the 2nd sleeper (timeout 4)")
    actor.join(4)

    this_actor.info("Start 3rd sleeper")
    actor = Actor.create("3rd sleeper from master", Host.current(), sleeper)
    this_actor.info("Join the 3rd sleeper (timeout 2)")
    actor.join(2)

    this_actor.info("Start 4th sleeper")
    actor = Actor.create("4th sleeper from master", Host.current(), sleeper)
    this_actor.info("Waiting 4")
    this_actor.sleep_for(4)
    this_actor.info("Join the 4th sleeper after its end (timeout 1)")
    actor.join(1)

    this_actor.info("Goodbye now!")

    this_actor.sleep_for(1)

    this_actor.info("Goodbye now!")
Ejemplo n.º 2
0
 def __call__(self):
     this_actor.execute(1e9)
     for disk in Host.current().get_disks():
         this_actor.info("Using disk " + disk.name)
         disk.read(10000)
         disk.write(10000)
     mbox = Mailbox.by_name(this_actor.get_host().name)
     msg = mbox.get()
     this_actor.info("I got '%s'." % msg)
     this_actor.info("Finished executing. Goodbye!")
Ejemplo n.º 3
0
def host():
    # Estimating bw for each disk and considering concurrent flows
    for n in range(1, 15, 2):
        for disk in Host.current().get_disks():
            estimate_bw(disk, n, True)
            estimate_bw(disk, n, False)