apscheduler定时任务
利用setuptools的entry_point参数实现模块动态导入

apscheduler如何传递参数给job

妙音 posted @ 2015年7月03日 10:17 in python with tags apscheduler , 1812 阅读
import tornado
from apscheduler.schedulers.tornado import TornadoScheduler
sched = TornadoScheduler()


def job1(a, b, c):
    print "job1:", a,b,c


def job2(a, b, c):
    print "job2:", a,b,c

sched.add_job(job1, 'interval', seconds=1, args=["a", "b", "c"])
sched.add_job(job2, 'interval', seconds=1, kwargs={"a": "a", "b": "b", "c": "c"})
sched.start()

tornado.ioloop.IOLoop.instance().start()

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter