當前位置: 首頁>>代碼示例>>Python>>正文


Python scheduler.Scheduler方法代碼示例

本文整理匯總了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 
開發者ID:piqueserver,項目名稱:piqueserver,代碼行數:21,代碼來源:timedmute.py

示例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() 
開發者ID:piqueserver,項目名稱:piqueserver,代碼行數:15,代碼來源:votemap.py

示例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.") 
開發者ID:hbd730,項目名稱:quadcopter-simulation,代碼行數:17,代碼來源:runsim.py

示例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") 
開發者ID:NETHINKS,項目名稱:opennms_alarmforwarder,代碼行數:38,代碼來源:opennms_alarmforwarder.py

示例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() 
開發者ID:Mizzlr,項目名稱:NetFlux-Component-Oriented-Flow-Based-Programming-DSL,代碼行數:12,代碼來源:executor.py

示例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() 
開發者ID:n8v-guy,項目名稱:slag,代碼行數:12,代碼來源:slack_archive.py

示例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() 
開發者ID:tylderen,項目名稱:fulmar,代碼行數:9,代碼來源:cli.py

示例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) 
開發者ID:openaps,項目名稱:oacids,代碼行數:16,代碼來源:service.py


注:本文中的scheduler.Scheduler方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。