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


Python sqlalchemy.SQLAlchemyJobStore方法代码示例

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


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

示例1: __init__

# 需要导入模块: from apscheduler.jobstores import sqlalchemy [as 别名]
# 或者: from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore [as 别名]
def __init__(self, datastore_dir, threat_max, timezone):
        global _scheduler_

        self.timezone = timezone

        lock = threading.Lock()
        with lock:
            if not _scheduler_:
                jobstores = {
                    'default': SQLAlchemyJobStore(url='sqlite:///{}/scheduler.sqlite'.format(datastore_dir)),
                }
                executors = {
                    'default': ThreadPoolExecutor(threat_max),
                }
                job_defaults = {
                    'coalesce': False,
                    'max_instances': 1
                }
                _scheduler_ = BackgroundScheduler(
                    jobstores=jobstores, executors=executors,
                    job_defaults=job_defaults, timezone=timezone
                )
                _scheduler_.start() 
开发者ID:ibmresilient,项目名称:resilient-community-apps,代码行数:25,代码来源:scheduler_helper.py

示例2: get_scheduler

# 需要导入模块: from apscheduler.jobstores import sqlalchemy [as 别名]
# 或者: from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore [as 别名]
def get_scheduler(store_path=None, log_file=None):
    if store_path is None:
        store_path = r'jobstore.sqlite'
    if log_file is None:
        log_file = r'logger.log'
    scheduler = BackgroundScheduler({'apscheduler.timezone': 'Asia/Shanghai'})
    jobstores = {
        'default': SQLAlchemyJobStore(url='sqlite:///{0}'.format(store_path))
    }
    executors = {
        'default': ThreadPoolExecutor(20),
        'processpool': ProcessPoolExecutor(5)
    }
    job_defaults = {
        'coalesce': False,
        'max_instances': 1
    }
    scheduler.configure(jobstores=jobstores, executors=executors)
    # 事件记录
    scheduler.add_listener(
        lambda event: event_listener(event, scheduler),
        EVENT_JOB_EXECUTED | EVENT_JOB_ERROR | EVENT_JOB_ADDED | EVENT_JOB_SUBMITTED | EVENT_JOB_REMOVED
    )
    # 日志定制
    scheduler._logger = modify_logger(scheduler._logger, log_file=log_file)
    return scheduler 
开发者ID:gsw945,项目名称:schedule-system,代码行数:28,代码来源:server.py

示例3: __init__

# 需要导入模块: from apscheduler.jobstores import sqlalchemy [as 别名]
# 或者: from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore [as 别名]
def __init__(self, clist_user_name, clist_api_key, mount_point, bot, fallback):
        self.clist_user_name = clist_user_name
        self.clist_api_key = clist_api_key
        self.bot = bot
        self.ong = None
        self.upc = None
        self.mount_point = mount_point
        self.utility = ContestUtility(mount_point)
        self.jobstores = {
            'default': SQLAlchemyJobStore(url='sqlite:///' + mount_point + 'coders1.db')
        }
        self.schedule = BackgroundScheduler(jobstores=self.jobstores)
        self.schedule.start()
        self.conv_handler = ConversationHandler(
            entry_points=[CommandHandler('upcoming', self.upcoming)],
            allow_reentry=True,
            states={
                SCHED: [CallbackQueryHandler(self.remind, pattern=r"^[0-9]*$")]
            },
            fallbacks=[fallback]
        )
        self.conv_handler1 = ConversationHandler(
            entry_points=[CommandHandler('dontRemindMe', self.removeRemind)],
            allow_reentry=True,
            states={
                REMNOTI: [CallbackQueryHandler(self.remnoti, pattern=r'^.*notiplz.*$')]
            },

            fallbacks=[fallback]
        ) 
开发者ID:Gotham13121997,项目名称:superCodingBot,代码行数:32,代码来源:competitions.py

示例4: start_scheduler

# 需要导入模块: from apscheduler.jobstores import sqlalchemy [as 别名]
# 或者: from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore [as 别名]
def start_scheduler(settings):
    assert settings['scheduler.store'] in ('redis', 'sqlalchemy'),\
        'Uknown job store, must by one of redis or sqlalchemy'

    if settings['scheduler.store'] == 'redis':
        jobstores = {
            'default': RedisJobStore(db=settings['scheduler.db'])
        }
    else:
        jobstores = {
            'default': SQLAlchemyJobStore(url=settings['scheduler.url'])
        }
        
    executors = {
        'default': {
            'type': settings['scheduler.executors.type'],
            'max_workers': settings['scheduler.executors.max_workers']
        },
        'processpool': ProcessPoolExecutor(
            max_workers=settings['scheduler.executors.processpool.max_workers']
        )
    }
    job_defaults = {
        'coalesce': False,
        'max_instances': settings['scheduler.job_defaults.max_instances']
    }
    scheduler.configure(
        jobstores=jobstores,
        executors=executors,
        job_defaults=job_defaults,
        timezone=timezone('UTC')
    )
    if settings['scheduler.autostart'] == 'true':
        scheduler.start() 
开发者ID:mazvv,项目名称:travelcrm,代码行数:36,代码来源:__init__.py

示例5: start

# 需要导入模块: from apscheduler.jobstores import sqlalchemy [as 别名]
# 或者: from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore [as 别名]
def start(self, scheduler, alias):
        # There should be called 'start' method of parent of SQLAlchemyJobStore
        super(self.__class__.__bases__[0], self).start(scheduler, alias) 
开发者ID:openstack,项目名称:watcher,代码行数:5,代码来源:job_store.py

示例6: start_sched

# 需要导入模块: from apscheduler.jobstores import sqlalchemy [as 别名]
# 或者: from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore [as 别名]
def start_sched():
    sched.configure(jobstores={
        'default': SQLAlchemyJobStore(url=settings.SCHEDULER_DB_URL)
    })
    log.info("Starting scheduler")
    sched.start()
    return sched 
开发者ID:gwu-libraries,项目名称:sfm-ui,代码行数:9,代码来源:sched.py


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