How to use the simgrid.this_actor.info function in simgrid

To help you get started, we’ve selected a few simgrid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github simgrid / simgrid / examples / python / exec-remote / exec-remote.py View on Github external
ginette = Host.by_name("Ginette")
        boivin = Host.by_name("Boivin")

        this_actor.info("I'm a wizard! I can run a task on the Ginette host from the Fafard one! Look!")
        activity = this_actor.exec_init(48.492e6)
        activity.host = ginette
        activity.start()
        this_actor.info("It started. Running 48.492Mf takes exactly one second on Ginette (but not on Fafard).")

        this_actor.sleep_for(0.1)
        this_actor.info("Loads in flops/s: Boivin={:.0f}; Fafard={:.0f}; Ginette={:.0f}".format(boivin.load, fafard.load,
                                                                                                ginette.load))
        activity.wait()
        this_actor.info("Done!")

        this_actor.info("And now, harder. Start a remote task on Ginette and move it to Boivin after 0.5 sec")
        activity = this_actor.exec_init(73293500)
        activity.host = ginette
        activity.start()

        this_actor.sleep_for(0.5)
        this_actor.info(
            "Loads before the move: Boivin={:.0f}; Fafard={:.0f}; Ginette={:.0f}".format(
                boivin.load,
                fafard.load,
                ginette.load))

        activity.host = boivin

        this_actor.sleep_for(0.1)
        this_actor.info(
            "Loads after the move: Boivin={:.0f}; Fafard={:.0f}; Ginette={:.0f}".format(
github simgrid / simgrid / examples / python / async-wait / async-wait.py View on Github external
mbox = mboxes[i % self.receivers_count]

            this_actor.info("Send '{:s}' to '{:s}'".format(content, str(mbox)))

            # Create a communication representing the ongoing communication, and store it in pending_comms
            comm = mbox.put_async(content, self.msg_size)
            pending_comms.append(comm)

        # Start sending messages to let the workers know that they should stop
        for i in range(0, self.receivers_count):
            mbox = mboxes[i]
            this_actor.info("Send 'finalize' to '{:s}'".format(str(mbox)))
            comm = mbox.put_async("finalize", 0)
            pending_comms.append(comm)

        this_actor.info("Done dispatching all messages")

        # Now that all message exchanges were initiated, wait for their completion, in order of creation.
        for comm in pending_comms:
            comm.wait()
        this_actor.info("Goodbye now!")
github simgrid / simgrid / examples / python / actor-create / actor-create.py View on Github external
def forwarder(*args):
    """Our second class of actors is also a function"""
    if len(args) < 2:
        raise AssertionError(
            "Actor forwarder requires 2 parameters, but got only {:d}".format(len(args)))
    mb_in = Mailbox.by_name(args[0])
    mb_out = Mailbox.by_name(args[1])

    msg = mb_in.get()
    this_actor.info("Forward '{:s}'.".format(msg))
    mb_out.put(msg, len(msg))
github simgrid / simgrid / examples / python / exec-basic / exec-basic.py View on Github external
def privileged():
    # You can also specify the priority of your execution as follows.
    # An execution of priority 2 computes twice as fast as a regular one.
    #
    # So instead of a half/half sharing between the two executions,
    # we get a 1/3 vs 2/3 sharing.
    this_actor.execute(98095, priority=2)
    this_actor.info("Done.")
github simgrid / simgrid / examples / python / actor-suspend / actor-suspend.py View on Github external
"I was thinking that the lazy guy would be suspended now")

    this_actor.sleep_for(5)  # Repeat two times:
    this_actor.info("Suspend the lazy guy while he's sleeping...")
    lazy.suspend()  # Suspend the lazy_guy while he's asleep
    this_actor.info("Let him finish his siesta.")
    this_actor.sleep_for(10)  # Wait for 10 seconds
    this_actor.info("Wake up, lazy guy!")
    lazy.resume()  # Then wake up the lazy_guy again

    this_actor.sleep_for(5)
    this_actor.info("Suspend again the lazy guy while he's sleeping...")
    lazy.suspend()
    this_actor.info("This time, don't let him finish his siesta.")
    this_actor.sleep_for(2)
    this_actor.info("Wake up, lazy guy!")
    lazy.resume()

    this_actor.sleep_for(5)
    this_actor.info(
        "Give a 2 seconds break to the lazy guy while he's working...")
    lazy.suspend()
    this_actor.sleep_for(2)
    this_actor.info("Back to work, lazy guy!")
    lazy.resume()

    this_actor.info("OK, I'm done here.")
github simgrid / simgrid / examples / python / actor-join / actor-join.py View on Github external
this_actor.info("Start sleeper")
    actor = Actor.create("sleeper from master", Host.current(), sleeper)
    this_actor.info("Join the sleeper (timeout 4)")
    actor.join(4)

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

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

    this_actor.info("Goodbye now!")

    this_actor.sleep_for(1)

    this_actor.info("Goodbye now!")
github simgrid / simgrid / examples / python / async-wait / async-wait.py View on Github external
def __call__(self):
        # FIXME: It should be ok to initialize self.mbox from __init__, but it's currently failing on the OS X Jenkins slave.
        self.mbox = Mailbox.by_name("receiver-{:d}".format(self.id))
        this_actor.info("Wait for my first message")
        while True:
            received = self.mbox.get()
            this_actor.info("I got a '{:s}'.".format(received))
            if received == "finalize":
                break  # If it's a finalize message, we're done.