当前位置: 首页>>代码示例>>Python>>正文


Python schedule.run_pending方法代码示例

本文整理汇总了Python中schedule.run_pending方法的典型用法代码示例。如果您正苦于以下问题:Python schedule.run_pending方法的具体用法?Python schedule.run_pending怎么用?Python schedule.run_pending使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在schedule的用法示例。


在下文中一共展示了schedule.run_pending方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: schedule_with_delay

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import run_pending [as 别名]
def schedule_with_delay(self):
        for task in self.tasks:
            interval = task.get('interval')
            schedule.every(interval).minutes.do(self.schedule_task_with_lock, task)
        while True:
            schedule.run_pending()
            time.sleep(1) 
开发者ID:SpiderClub,项目名称:haipproxy,代码行数:9,代码来源:scheduler.py

示例2: run

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import run_pending [as 别名]
def run():
	# Load all modules and print active list
	feeds = objects.Feeds()
	exporters = objects.Exporters()
	processors = objects.Processors()
	print "Active Modules:"
	feeds.print_list()
	processors.print_list()	
	exporters.print_list()

	print "\nStarting..."

	feeds.start()

	while True:
		try:
			schedule.run_pending()
		except Exception, e:
			print "Excepion running pending: %s" % (e)
		time.sleep(10) 
开发者ID:silascutler,项目名称:MalPipe,代码行数:22,代码来源:functions.py

示例3: _run

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import run_pending [as 别名]
def _run(self):
        if self.args.run_mode == 'job':
            schedule.every().day.at('00:00').do(self._build_report)
            while True:
                schedule.run_pending()
                time.sleep(1)
        else:
            self._build_report(self.args.date) 
开发者ID:MycroftAI,项目名称:selene-backend,代码行数:10,代码来源:daily_report.py

示例4: handle

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import run_pending [as 别名]
def handle(self, args):
        logger = IngestLogger()
        logger.info(
            "Starting Baleen v{} ingestion service every hour.".format(baleen.get_version())
        )

        schedule.every().hour.do(partial(self.ingest, args))

        while True:
            try:
                schedule.run_pending()
                time.sleep(1)
            except (KeyboardInterrupt, SystemExit):
                logger.info("Graceful shutdown of Baleen ingestion service.")
                return ""
            except Exception as e:
                logger.critical(str(e))
                return str(e) 
开发者ID:DistrictDataLabs,项目名称:baleen,代码行数:20,代码来源:run.py

示例5: handle

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import run_pending [as 别名]
def handle(self, *args, **kwargs):

        logger.info("%s - starting jobs schedule" % (__name__))
            
        try:
            '''            
            schedule.every().hour.do(job_update_entities)
            schedule.every().hour.do(job_update_clients)
            schedule.every().hour.do(job_update_checks)
            schedule.every().hour.do(job_update_trends)
            #schedule.every(10).minutes.do(job_update_events)
            '''
            
            schedule.every(settings.CACHE_ENTITY_TTL).seconds.do(job_update_entities)
            schedule.every(settings.CACHE_CLIENT_TTL).seconds.do(job_update_clients)
            schedule.every(settings.CACHE_TRENDS_TTL).seconds.do(job_update_trends)
            
            
            while True:
                schedule.run_pending()
                sleep(1)

        except KeyboardInterrupt:
            logger.info("%s - user signal exit!" % (__name__))
            exit(0) 
开发者ID:ilavender,项目名称:sensu_drive,代码行数:27,代码来源:jobs.py

示例6: run_continuously

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import run_pending [as 别名]
def run_continuously(self, interval=1):
        """
        https://raw.githubusercontent.com/mrhwick/schedule/master/schedule/__init__.py
        """
        print("Started to run continuously")
        cease_continuous_run = Event()

        class ScheduleThread(Thread):
            @classmethod
            def run(cls):
                while not cease_continuous_run.is_set():
                    schedule.run_pending()
                    time.sleep(interval)

        continuous_thread = ScheduleThread()
        continuous_thread.start()
        return cease_continuous_run 
开发者ID:alirizakeles,项目名称:ab-2018,代码行数:19,代码来源:scheduler.py

示例7: __non_threaded_polling

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import run_pending [as 别名]
def __non_threaded_polling(self, schedule, none_stop=False, interval=0, timeout=3):
        logger.info('Started polling.')
        self._TeleBot__stop_polling.clear()
        error_interval = .25

        while not self._TeleBot__stop_polling.wait(interval):
            try:
                schedule.run_pending()
                self._TeleBot__retrieve_updates(timeout)
                error_interval = .25
            except apihelper.ApiException as e:
                logger.error(e)
                if not none_stop:
                    self._TeleBot__stop_polling.set()
                    logger.info("Exception occurred. Stopping.")
                else:
                    logger.info("Waiting for {0} seconds until retry".format(error_interval))
                    time.sleep(error_interval)
                    error_interval *= 2
            except KeyboardInterrupt:
                logger.info("KeyboardInterrupt received.")
                self._TeleBot__stop_polling.set()
                break

        logger.info('Stopped polling.') 
开发者ID:may-cat,项目名称:firefly-iii-telegram-bot,代码行数:27,代码来源:bot.py

示例8: main

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import run_pending [as 别名]
def main():
    try:
        smart_module = SmartModule()
        smart_module.asset.load_asset_info()
        smart_module.load_site_data()
        smart_module.discover()
        smart_module.load_influx_settings()
    except Exception as excpt:
        Log.exception("Error initializing Smart Module. %s.", excpt)

    while 1:
        try:
            time.sleep(0.5)
            schedule.run_pending()
        except Exception as excpt:
            Log.exception("Error in Smart Module main loop. %s.", excpt)
            break 
开发者ID:mayaculpa,项目名称:hapi,代码行数:19,代码来源:smart_module.py

示例9: run_schedule

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import run_pending [as 别名]
def run_schedule():
    while True:
        schedule.run_pending()
        time.sleep(1) 
开发者ID:Bennington-Distributed-Systems-2017,项目名称:DarkDarkGo,代码行数:6,代码来源:idx_server.py

示例10: squid_conf_update

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import run_pending [as 别名]
def squid_conf_update(usage, interval):
    """Timertask for updating proxies for squid config file"""
    # client_logger.info('the updating task is starting...')
    client = SquidClient(usage)
    client.update_conf()
    schedule.every(interval).minutes.do(client.update_conf)
    while True:
        schedule.run_pending()
        time.sleep(1) 
开发者ID:SpiderClub,项目名称:haipproxy,代码行数:11,代码来源:scheduler.py

示例11: schedule_coro

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import run_pending [as 别名]
def schedule_coro():
    while True:
        schedule.run_pending()
        await asyncio.sleep(1) 
开发者ID:EugeneDae,项目名称:VLC-Scheduler,代码行数:6,代码来源:vlcscheduler.py

示例12: run_monitor

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import run_pending [as 别名]
def run_monitor(self):
        self.__monitor_flag.set()
        while self.__monitor_flag.isSet():
            schedule.run_pending()
            time.sleep(1)
            # self.__monitor_flag.wait()
            if schedule.next_run is not None:
                self.auto_status.set(u'运行中...\n下次运行时间:\n %s\n当前时间:\n %s' % (schedule.next_run(), datetime.now().strftime("%Y-%m-%d %H:%M:%S")))
            else:
                self.auto_status.set(u'状态:无任务')

        self.auto_status.set(u'状态:停止') 
开发者ID:zodiac182,项目名称:autoxuexi,代码行数:14,代码来源:xuexi.py

示例13: _watch_config

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import run_pending [as 别名]
def _watch_config(config_path: str, directory_path: str):
    LOGGER.info("Starting DNSroboCert.")

    with tempfile.TemporaryDirectory() as workspace:
        runtime_config_path = os.path.join(workspace, "dnsrobocert-runtime.yml")

        schedule.every().day.at("12:00").do(
            _renew_job, config_path=runtime_config_path, directory_path=directory_path
        )
        schedule.every().day.at("00:00").do(
            _renew_job, config_path=runtime_config_path, directory_path=directory_path
        )

        daemon = _Daemon()
        previous_digest = ""
        while not daemon.do_shutdown():
            schedule.run_pending()

            try:
                generated_config_path = legacy.migrate(config_path)
                effective_config_path = (
                    generated_config_path if generated_config_path else config_path
                )
                digest = utils.digest(effective_config_path)

                if digest != previous_digest:
                    previous_digest = digest
                    _process_config(
                        effective_config_path, directory_path, runtime_config_path
                    )
            except BaseException as error:
                LOGGER.error("An error occurred during DNSroboCert watch:")
                LOGGER.error(error)
                traceback.print_exc(file=sys.stderr)

            time.sleep(1)

    LOGGER.info("Exiting DNSroboCert.") 
开发者ID:adferrand,项目名称:dnsrobocert,代码行数:40,代码来源:main.py

示例14: scheduler

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import run_pending [as 别名]
def scheduler():
    while True:
        schedule.run_pending()
        time.sleep(1) 
开发者ID:shauryauppal,项目名称:PyWhatsapp,代码行数:6,代码来源:PyWhatsapp.py

示例15: run_schedule

# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import run_pending [as 别名]
def run_schedule(self):
        while 1:
            schedule.run_pending()
            time.sleep(1) 
开发者ID:nathanpjones,项目名称:GaragePi,代码行数:6,代码来源:controller.py


注:本文中的schedule.run_pending方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。