Created
March 14, 2013 20:57
-
-
Save ahawker/5165205 to your computer and use it in GitHub Desktop.
Crython example per request from user.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import crython | |
import time | |
@crython.job(second='*') #fired every second | |
def hello_world(): | |
print 'hello_world called every second.' | |
@crython.job(second='*/4') #fired every 4 seconds | |
def hello_fours(): | |
print 'hello_fours called every 4 seconds.' | |
if __name__ == '__main__': | |
crython.tab.start() #start the global cron tab scheduler which runs in a background thread | |
time.sleep(10) #sleep main thread for 10 seconds so we can see jobs being fired | |
#test.py STDOUT below >>> | |
#C:\Python27\python.exe C:/Users/arhawker/Downloads/crython-master/crython-master/test.py | |
#hello_world called every second. | |
#hello_world called every second. | |
#hello_world called every second. | |
#hello_fours called every 4 seconds. | |
#hello_world called every second. | |
#hello_world called every second. | |
#hello_world called every second. | |
#hello_world called every second. | |
#hello_fours called every 4 seconds. | |
#hello_world called every second. | |
#hello_world called every second. | |
#hello_world called every second. | |
#Process finished with exit code 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment