本文整理汇总了Python中scheduler.Scheduler方法的典型用法代码示例。如果您正苦于以下问题:Python scheduler.Scheduler方法的具体用法?Python scheduler.Scheduler怎么用?Python scheduler.Scheduler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scheduler
的用法示例。
在下文中一共展示了scheduler.Scheduler方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import scheduler [as 别名]
# 或者: from scheduler import Scheduler [as 别名]
def __init__(self, player, time=300, reason='None'):
if time == 0:
player.mute = True
player.protocol.send_chat(
'%s was muted indefinitely (Reason: %s)' %
(player.name, reason), irc=True)
return
schedule = Scheduler(player.protocol)
schedule.call_later(time, self.end)
player.mute_schedule = schedule
player.protocol.send_chat(
'%s was muted for %s seconds (Reason: %s)' %
(player.name, time, reason), irc=True)
player.mute = True
self.player = player
self.time = time
示例2: start
# 需要导入模块: import scheduler [as 别名]
# 或者: from scheduler import Scheduler [as 别名]
def start(self):
instigator = self.instigator
protocol = self.protocol
if instigator is None:
protocol.send_chat('Time to vote!', irc=True)
else:
protocol.send_chat(
'* %s initiated a map vote.' % instigator.name, irc=True)
self.schedule = schedule = Scheduler(protocol)
schedule.call_later(self.vote_time, self.timeout)
schedule.loop_call(30.0, self.update)
self.protocol.votemap = self
self.update()
示例3: main
# 需要导入模块: import scheduler [as 别名]
# 或者: from scheduler import Scheduler [as 别名]
def main():
pos = (0,0,0)
attitude = (0,0,np.pi/2)
quadcopter = Quadcopter(pos, attitude)
sched = scheduler.Scheduler()
sched.add_task(attitudeControl, dt, (quadcopter,time))
kEvent_Render = sched.add_event(render, (quadcopter,))
plt.plot_quad_3d((sched, kEvent_Render))
try:
while True:
thread_time.sleep(5)
except KeyboardInterrupt:
print ("attempting to close threads.")
sched.stop()
print ("terminated.")
示例4: main
# 需要导入模块: import scheduler [as 别名]
# 或者: from scheduler import Scheduler [as 别名]
def main():
"""main function"""
# get directory name
basedir = os.path.dirname(os.path.abspath(__file__))
# configure logging
logging.basedir = basedir + "/logs"
logging.config.fileConfig(basedir + "/etc/logging.conf")
# init
config = Config()
scheduler = Scheduler()
webapp_conf = {
"bind": config.get_value("Webserver", "bind", "0.0.0.0:5000"),
"workers": int(config.get_value("Webserver", "workers", "1"))
}
webapp = WebApplication(wsgi_app, webapp_conf)
# run scheduler
print("Starting opennms_alarmforwarder...")
proc_webapp = Process(target=webapp.run)
proc_scheduler = Process(target=scheduler.run)
proc_webapp.start()
proc_scheduler.start()
signal.signal(signal.SIGTERM, process_helper.shutdown_handler)
signal.signal(signal.SIGINT, process_helper.shutdown_handler)
try:
proc_scheduler.join()
proc_webapp.join()
except:
print("Stopping opennms_alarmforwarder...")
proc_scheduler.terminate()
proc_webapp.terminate()
print("...exited")
示例5: __init__
# 需要导入模块: import scheduler [as 别名]
# 或者: from scheduler import Scheduler [as 别名]
def __init__(self, someprocess=None, logit=True, ticks=sys.maxint):
super(Executor,self).__init__()
if someprocess:
self.process = someprocess
else:
if ticks < sys.maxint:
ticks += 1
self.process = Scheduler(ticks=ticks, name="")
self.logit = logit
self.linker = Linker()
示例6: __init__
# 需要导入模块: import scheduler [as 别名]
# 或者: from scheduler import Scheduler [as 别名]
def __init__(self, mongo, ctx, tokens, api_key):
self.mongo = mongo
self.log = SlackArchive.get_logger()
self.people = mongo_store.MongoStore(self.mongo.db.users, ctx)
self.streams = mongo_store.MongoStore(self.mongo.db.streams, ctx)
self.tokens = tokens
self.api_handle = Slacker(api_key)
self.scheduler = scheduler.Scheduler(ctx, mongo)
self._setup_scheduler()
self.scheduler.start()
示例7: scheduler
# 需要导入模块: import scheduler [as 别名]
# 或者: from scheduler import Scheduler [as 别名]
def scheduler(ctx):
"""Run Scheduler."""
from fulmar.scheduler.projectdb import projectdb
from fulmar.message_queue import newtask_queue, ready_queue, cron_queue
from scheduler import Scheduler
scheduler = Scheduler(newtask_queue, ready_queue, cron_queue, projectdb)
scheduler.run()
示例8: __init__
# 需要导入模块: import scheduler [as 别名]
# 或者: from scheduler import Scheduler [as 别名]
def __init__ (self, loop, bus=None, path=PATH):
self.loop = loop
self.bus = bus or dbus.SystemBus( )
self.path = path
request = self.bus.request_name(BUS, dbus.bus.NAME_FLAG_DO_NOT_QUEUE)
self.running = False
ScheduleManager.__init__(self, self.bus, PATH)
self.sync_all_props( )
self.init_managed( )
self.ResetHeartbeat( )
self.scheduler = scheduler.Scheduler(self.bus, self)
self.background = doable.Doable(self)
self.eventsink = triggers.EventSink(self.bus, self)
# self.connect("notify::ini-home", self.on_change_home)