How to use the simgrid.this_actor.suspend 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 / actor-kill / actor-kill.py View on Github external
def victim_a_fun():
    this_actor.on_exit(lambda: this_actor.info("I have been killed!"))
    this_actor.info("Hello!")
    this_actor.info("Suspending myself")
    this_actor.suspend()                        # - Start by suspending itself
    # - Then is resumed and start to execute a task
    this_actor.info("OK, OK. Let's work")
    this_actor.execute(1e9)
    # - But will never reach the end of it
    this_actor.info("Bye!")
github simgrid / simgrid / examples / python / actor-suspend / actor-suspend.py View on Github external
def lazy_guy():
    """The Lazy guy only wants to sleep, but can be awaken by the dream_master process"""
    this_actor.info("Nobody's watching me ? Let's go to sleep.")
    this_actor.suspend()  # - Start by suspending itself
    this_actor.info("Uuuh ? Did somebody call me ?")

    # - Then repetitively go to sleep, but get awaken
    this_actor.info("Going to sleep...")
    this_actor.sleep_for(10)
    this_actor.info("Mmm... waking up.")

    this_actor.info("Going to sleep one more time (for 10 sec)...")
    this_actor.sleep_for(10)
    this_actor.info("Waking up once for all!")

    this_actor.info("Ok, let's do some work, then (for 10 sec on Boivin).")
    this_actor.execute(980.95e6)

    this_actor.info("Mmmh, I'm done now. Goodbye.")