Skip to content

Instantly share code, notes, and snippets.

@awong1900
Created January 3, 2016 16:15
Show Gist options
  • Save awong1900/7f11ed951cd066c852a7 to your computer and use it in GitHub Desktop.
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)
name: task
version: 1
worker: tornado
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