當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。