Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __call__(self):
fafard = Host.by_name("Fafard")
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
def __call__(self):
fafard = Host.by_name("Fafard")
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")
this_actor.sleep_for(0.5)
this_actor.info("I changed my mind, cancel!")
activity.cancel()
this_actor.info("Goodbye now!")
if __name__ == '__main__':
e = Engine(sys.argv)
if len(sys.argv) < 2:
raise AssertionError("Usage: exec-async.py platform_file [other parameters]")
e.load_platform(sys.argv[1])
Actor.create("wait", Host.by_name("Fafard"), Waiter())
Actor.create("monitor", Host.by_name("Ginette"), Monitor())
Actor.create("cancel", Host.by_name("Boivin"), Canceller())
e.run()