Created
January 3, 2016 16:15
-
-
Save awong1900/7f11ed951cd066c852a7 to your computer and use it in GitHub Desktop.
Implement scheduler with python's tornado on SAE (http://www.sinacloud.com/doc/sae/python/tutorial.html)
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
name: task | |
version: 1 | |
worker: tornado |
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 sae | |
# add yourself python library, pip install -t vendor PACKAGE ... | |
# sae.add_vendor_dir('vendor') | |
from tornado import web, ioloop | |
class MainHandler(web.RequestHandler): | |
def get(self): | |
self.write('Hello Tornado') | |
def task(): | |
print "task" | |
application = web.Application([ | |
(r'/', MainHandler), | |
]) | |
ioloop.PeriodicCallback(task, 3000).start() # start scheduler |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment