stupid.py 543 B

12345678910111213141516171819202122232425262728293031
  1. """This is a very basic template example. This template do nothing, just
  2. print a message in stdout. Of course, it not very useful :)
  3. """
  4. import random
  5. from time import sleep
  6. def hello():
  7. print "Hello world!"
  8. def bye():
  9. print "Good bye cruel world..."
  10. @async
  11. def launch_async(arg):
  12. sleep(random.randint(2,10))
  13. print "Hola %s" % arg
  14. @serial
  15. def pfinish():
  16. print "Finished!"
  17. def main(*args):
  18. # next two in serial
  19. hello()
  20. bye()
  21. # next in parallel
  22. for x in args:
  23. launch_async(x)
  24. pfinish()