You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

22 lines
530 B

  1. #!/usr/bin/python
  2. from nilmdb.utils.printf import *
  3. import time
  4. import signal
  5. import sys
  6. # This is just for testing the process management.
  7. def dummy(n):
  8. if n < 0: # raise an exception
  9. raise Exception("test exception")
  10. if n == 0: # ignore SIGTERM and count to 40
  11. n = 40
  12. signal.signal(signal.SIGTERM, signal.SIG_IGN)
  13. for x in range(n):
  14. s = sprintf("dummy %d\n", x)
  15. if x & 1:
  16. sys.stdout.write(s)
  17. else:
  18. sys.stderr.write(s)
  19. time.sleep(0.1)