本文整理汇总了Python中Scheduler.Scheduler.add_interval_job方法的典型用法代码示例。如果您正苦于以下问题:Python Scheduler.add_interval_job方法的具体用法?Python Scheduler.add_interval_job怎么用?Python Scheduler.add_interval_job使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scheduler.Scheduler
的用法示例。
在下文中一共展示了Scheduler.add_interval_job方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Scheduler import Scheduler [as 别名]
# 或者: from Scheduler.Scheduler import add_interval_job [as 别名]
def __init__(self):
self.http = httplib2.Http()
self.config = ConfigurationServer.get('AutoOn')
if self.config == None:
self.config = {
'lat': 0,
'long': 0,
'city': 'Enter a city here...',
'offset': 0,
'autoOnGroup': 'All Lights',
'groupBri': 255,
}
else:
if not 'autoOnGroup' in self.config.keys():
self.config['autoOnGroup'] = 'All Lights'
if not 'groupBri' in self.config.keys():
self.config['groupBri'] = 255
minute = random.randint(0,59)
start_date = datetime.datetime.combine(datetime.datetime.today(), datetime.time(hour=12, minute=minute, second=0)) #added randomness to not break earthtools :)
if start_date < datetime.datetime.now():
# get the sunset for today, the get_sunset function will take care of the rest
self.get_sunset()
start_date += datetime.timedelta(days=1)
Scheduler.add_interval_job(self.get_sunset, days=1, start_date=start_date)
示例2: startup
# 需要导入模块: from Scheduler import Scheduler [as 别名]
# 或者: from Scheduler.Scheduler import add_interval_job [as 别名]
def startup(self, bridge_ip):
from Plugins import Plugins
from HueBridge import HueBridge
HueBridge.init(bridge_ip)
HueBridge.update()
self.plugins = Plugins #expose it for cherrypy
# Automatically update every minute
Scheduler.add_interval_job(HueBridge.update, minutes=1)