本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)
示例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
示例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.')
示例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
示例9: run_schedule
# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import run_pending [as 别名]
def run_schedule():
while True:
schedule.run_pending()
time.sleep(1)
示例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)
示例11: schedule_coro
# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import run_pending [as 别名]
def schedule_coro():
while True:
schedule.run_pending()
await asyncio.sleep(1)
示例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'状态:停止')
示例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.")
示例14: scheduler
# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import run_pending [as 别名]
def scheduler():
while True:
schedule.run_pending()
time.sleep(1)
示例15: run_schedule
# 需要导入模块: import schedule [as 别名]
# 或者: from schedule import run_pending [as 别名]
def run_schedule(self):
while 1:
schedule.run_pending()
time.sleep(1)