Created
September 19, 2012 17:30
-
-
Save eristoddle/3750962 to your computer and use it in GitHub Desktop.
Very Tiny Python Job Server
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
#!/usr/bin/python | |
from lib import scheduler | |
import datetime, time | |
def eristoddle_post_server(every_min, run_time_min): | |
from core.myWP import zem_cb_eristoddle | |
every_sec = 60 * every_min | |
run_time = 60 * run_time_min | |
esched = scheduler.Scheduler() | |
etask = scheduler.Task("eristoddle_post", | |
datetime.datetime.now(), | |
scheduler.every_x_secs(every_sec), | |
scheduler.RunOnce(zem_cb_eristoddle)) | |
esched.start() | |
receipt = esched.schedule_task(etask) | |
print receipt | |
print 'sleeping for %s sec...' % (run_time) | |
time.sleep(run_time) | |
print 'waking up and killing scheduler' | |
esched.halt() | |
if __name__ == "__main__": | |
eristoddle_post_server(2,4000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment