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


Python Scheduler.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from celery.beat import Scheduler [as 别名]
# 或者: from celery.beat.Scheduler import __init__ [as 别名]
 def __init__(self, *args, **kwargs):
     self._schedule = {}
     self._last_updated = None
     Scheduler.__init__(self, *args, **kwargs)
     self.max_interval = (kwargs.get('max_interval')
                          or self.app.conf.CELERYBEAT_MAX_LOOP_INTERVAL or 300)
     self.db = db_factory.get_database()
开发者ID:jfilak,项目名称:faf,代码行数:9,代码来源:schedulers.py

示例2: __init__

# 需要导入模块: from celery.beat import Scheduler [as 别名]
# 或者: from celery.beat.Scheduler import __init__ [as 别名]
 def __init__(self, *args, **kwargs):
     self._dirty = set()
     self._last_flush = None
     self._flush_every = 3 * 60
     self._finalize = Finalize(self, self.flush, exitpriority=5)
     Scheduler.__init__(self, *args, **kwargs)
     self.max_interval = 5
开发者ID:crankycoder,项目名称:zamboni-lib,代码行数:9,代码来源:schedulers.py

示例3: __init__

# 需要导入模块: from celery.beat import Scheduler [as 别名]
# 或者: from celery.beat.Scheduler import __init__ [as 别名]
 def __init__(self, *args, **kwargs):
     self._dirty = set()
     self._finalize = Finalize(self, self.sync, exitpriority=5)
     Scheduler.__init__(self, *args, **kwargs)
     self.max_interval = (kwargs.get("max_interval")
                        or self.app.conf.CELERYBEAT_MAX_LOOP_INTERVAL
                        or DEFAULT_MAX_INTERVAL)
开发者ID:AdamG,项目名称:django-celery,代码行数:9,代码来源:schedulers.py

示例4: __init__

# 需要导入模块: from celery.beat import Scheduler [as 别名]
# 或者: from celery.beat.Scheduler import __init__ [as 别名]
    def __init__(self, *args, **kwargs):

        if hasattr(current_app.conf, "CELERY_MONGODB_SCHEDULER_DB"):
            db = current_app.conf.CELERY_MONGODB_SCHEDULER_DB
        else:
            db = "celery"
        if hasattr(current_app.conf, "CELERY_MONGODB_SCHEDULER_COLLECTION") \
            and current_app.conf.CELERY_MONGODB_SCHEDULER_COLLECTION:
            collection=current_app.conf.CELERY_MONGODB_SCHEDULER_COLLECTION
        else:
            collection="schedules"

        if hasattr(current_app.conf, "CELERY_MONGODB_SCHEDULER_URL"):
              
             connection=Connection(current_app.conf.CELERY_MONGODB_SCHEDULER_URL) 
             get_logger(__name__).info("backend scheduler using %s/%s:%s",
                    current_app.conf.CELERY_MONGODB_SCHEDULER_DB,
                    db,collection)
        else:
            connection=Connection() 


        self.db=connection[db][collection]
  
        self._schedule = {}
        self._last_updated = None
        Scheduler.__init__(self, *args, **kwargs)
        self.max_interval = (kwargs.get('max_interval') \
                or self.app.conf.CELERYBEAT_MAX_LOOP_INTERVAL or 300)
开发者ID:Arttii,项目名称:celerybeat-mongo,代码行数:31,代码来源:schedulers.py

示例5: __init__

# 需要导入模块: from celery.beat import Scheduler [as 别名]
# 或者: from celery.beat.Scheduler import __init__ [as 别名]
    def __init__(self, *args, **kwargs):
        if hasattr(current_app.conf, 'CELERY_REDIS_SCHEDULER_URL'):
            logger.info('backend scheduler using %s',
                                      current_app.conf.CELERY_REDIS_SCHEDULER_URL)
        else:
            logger.info('backend scheduler using %s',
                                      current_app.conf.CELERY_REDIS_SCHEDULER_URL)

        # how long we should hold on to the redis lock in seconds
        if 'CELERY_REDIS_SCHEDULER_LOCK_TTL' in current_app.conf:
            lock_ttl = current_app.conf.CELERY_REDIS_SCHEDULER_LOCK_TTL
        else:
            lock_ttl = 30

        if lock_ttl < self.UPDATE_INTERVAL.seconds:
            lock_ttl = self.UPDATE_INTERVAL.seconds * 2
        self.lock_ttl = lock_ttl

        self._schedule = {}
        self._last_updated = None
        self._lock_acquired = False
        Scheduler.__init__(self, *args, **kwargs)
        self.max_interval = (kwargs.get('max_interval') \
                             or self.app.conf.CELERYBEAT_MAX_LOOP_INTERVAL or 300)
        self._lock = rdb.lock('celery:beat:task_lock', timeout=self.lock_ttl)
        self._lock_acquired = self._lock.acquire(blocking=False)
        self.Entry.scheduler = self
开发者ID:Adaptification,项目名称:celerybeatredis,代码行数:29,代码来源:schedulers.py

示例6: __init__

# 需要导入模块: from celery.beat import Scheduler [as 别名]
# 或者: from celery.beat.Scheduler import __init__ [as 别名]
 def __init__(self, *args, **kwargs):
     """Initialize the database scheduler."""
     self._dirty = set()
     Scheduler.__init__(self, *args, **kwargs)
     self._finalize = Finalize(self, self.sync, exitpriority=5)
     self.max_interval = (
         kwargs.get('max_interval')
         or self.app.conf.beat_max_loop_interval
         or DEFAULT_MAX_INTERVAL)
开发者ID:cloudera,项目名称:hue,代码行数:11,代码来源:schedulers.py

示例7: __init__

# 需要导入模块: from celery.beat import Scheduler [as 别名]
# 或者: from celery.beat.Scheduler import __init__ [as 别名]
    def __init__(self, *args, **kwargs):

        log.info("SQLAlchemyScheduler.__init__ called")

        self._dirty = set()
        Scheduler.__init__(self, *args, **kwargs)
        self.max_interval = (
            kwargs.get('max_interval') or
            self.app.conf.CELERYBEAT_MAX_LOOP_INTERVAL or
            DEFAULT_MAX_INTERVAL)
开发者ID:kashifpk,项目名称:celerybeat-sqlalchemy,代码行数:12,代码来源:schedulers.py

示例8: __init__

# 需要导入模块: from celery.beat import Scheduler [as 别名]
# 或者: from celery.beat.Scheduler import __init__ [as 别名]
    def __init__(self, *args, **kwargs):
        if hasattr(current_app.conf, 'CELERY_REDIS_SCHEDULER_URL'):
            get_logger(__name__).info('backend scheduler using %s',
                                      current_app.conf.CELERY_REDIS_SCHEDULER_URL)
        else:
            get_logger(__name__).info('backend scheduler using %s',
                                      current_app.conf.CELERY_REDIS_SCHEDULER_URL)

        self._schedule = {}
        self._last_updated = None
        Scheduler.__init__(self, *args, **kwargs)
        self.max_interval = (kwargs.get('max_interval') \
                             or self.app.conf.CELERYBEAT_MAX_LOOP_INTERVAL or 300)
开发者ID:georgewhewell,项目名称:celerybeatredis,代码行数:15,代码来源:schedulers.py

示例9: __init__

# 需要导入模块: from celery.beat import Scheduler [as 别名]
# 或者: from celery.beat.Scheduler import __init__ [as 别名]
    def __init__(self, *args, **kwargs):
        self.data = {}
        self.last_refresh = None

        if 'LEEK_REDIS_URL' not in current_app.conf:
            raise Exception('Missing LEEK_REDIS_URL celery config')
        self.hash_key = current_app.conf.get('LEEK_HASH_KEY', 'leek')
        self.redis = redis.from_url(current_app.conf.get('LEEK_REDIS_URL'))
        self.tz = timezone.get_timezone(current_app.conf.get('CELERY_TIMEZONE', 'UTC'))

        Scheduler.__init__(self, *args, **kwargs)

        self.max_interval = self.app.conf.get('LEEK_REFRESH_INTERVAL', 5)
        self.refresh_frequency = timedelta(seconds=self.max_interval)
开发者ID:MouseMob,项目名称:leek,代码行数:16,代码来源:leek.py

示例10: __init__

# 需要导入模块: from celery.beat import Scheduler [as 别名]
# 或者: from celery.beat.Scheduler import __init__ [as 别名]
    def __init__(self, *args, **kwargs):
        if hasattr(current_app.conf, 'CELERY_REDIS_SCHEDULER_URL'):
            logger.info('backend scheduler using %s',
                                      current_app.conf.CELERY_REDIS_SCHEDULER_URL)
        else:
            logger.info('backend scheduler using %s',
                                      current_app.conf.CELERY_REDIS_SCHEDULER_URL)

        self._schedule = {}
        self._last_updated = None
        Scheduler.__init__(self, *args, **kwargs)
        self.max_interval = (kwargs.get('max_interval') \
                             or self.app.conf.CELERYBEAT_MAX_LOOP_INTERVAL or 300)
        self._lock = rdb.lock('celery:beat:task_lock')
        self._lock_acquired = self._lock.acquire(blocking=False)
        self.Entry.scheduler = self
开发者ID:orgsea,项目名称:celerybeatredis,代码行数:18,代码来源:schedulers.py

示例11: __init__

# 需要导入模块: from celery.beat import Scheduler [as 别名]
# 或者: from celery.beat.Scheduler import __init__ [as 别名]
    def __init__(self, *args, **kwargs):
        if hasattr(current_app.conf, "CELERY_MONGODB_SCHEDULER_DB"):
            db = current_app.conf.CELERY_MONGODB_SCHEDULER_DB
        else:
            db = "celery"
        if hasattr(current_app.conf, "CELERY_MONGODB_SCHEDULER_URL"):
            self._mongo = mongoengine.connect(db, host=current_app.conf.CELERY_MONGODB_SCHEDULER_URL)
            get_logger(__name__).info("backend scheduler using %s/%s:%s",
                    current_app.conf.CELERY_MONGODB_SCHEDULER_URL,
                    db, self.Model._get_collection().name)
        else:
            self._mongo = mongoengine.connect(db)
            get_logger(__name__).info("backend scheduler using %s/%s:%s",
                    "mongodb://localhost",
                    db, self.Model._get_collection().name)

        self._schedule = {}
        self._last_updated = None
        Scheduler.__init__(self, *args, **kwargs)
        self.max_interval = (kwargs.get('max_interval')
                or self.app.conf.CELERYBEAT_MAX_LOOP_INTERVAL or 5)
开发者ID:zmap,项目名称:celerybeat-mongo,代码行数:23,代码来源:schedulers.py

示例12: __init__

# 需要导入模块: from celery.beat import Scheduler [as 别名]
# 或者: from celery.beat.Scheduler import __init__ [as 别名]
 def __init__(self, app, **kwargs):
     self._last_timestamp = self._get_latest_change()
     Scheduler.__init__(self, app, **kwargs)
开发者ID:SeraphLiu,项目名称:celery_sqlalchemy_scheduler,代码行数:5,代码来源:sqlalchemy_scheduler.py

示例13: __init__

# 需要导入模块: from celery.beat import Scheduler [as 别名]
# 或者: from celery.beat.Scheduler import __init__ [as 别名]
 def __init__(self, *args, **kwargs):
     self._dirty = set()
     self._finalize = Finalize(self, self.sync, exitpriority=5)
     Scheduler.__init__(self, *args, **kwargs)
     self.max_interval = 5
开发者ID:ericbuckley,项目名称:django-celery,代码行数:7,代码来源:schedulers.py

示例14: __init__

# 需要导入模块: from celery.beat import Scheduler [as 别名]
# 或者: from celery.beat.Scheduler import __init__ [as 别名]
 def __init__(self, *args, **kwargs):
     Scheduler.__init__(self, *args, **kwargs)
     self.max_interval = 5
     self._dirty = set()
     self._last_flush = None
     self._flush_every = 3 * 60
开发者ID:aneilbaboo,项目名称:django-celery,代码行数:8,代码来源:schedulers.py

示例15: cls

# 需要导入模块: from celery.beat import Scheduler [as 别名]
# 或者: from celery.beat.Scheduler import __init__ [as 别名]
        return cls(db_entry)


class DatabaseScheduler(Scheduler):
    Entry = Entry
    _last_timestamp = None
    _schedule = None
    _initial_read = False

    def __init__(self, app, **kwargs):
<<<<<<< HEAD
        print 'DBScheduler initiated'
=======
>>>>>>> eb2a33c4b2f857754113985e104210382f7b5a44
        self._last_timestamp = self._get_latest_change()
        Scheduler.__init__(self, app, **kwargs)

    def _get_latest_change(self):
        query = dbsession.query(DatabaseSchedulerEntry.date_changed)
        query = query.order_by(DatabaseSchedulerEntry.date_changed.desc())
        latest_entry_date = query.first()
        return latest_entry_date

    def setup_schedule(self):
        self.install_default_entries(self.schedule)
        self.update_from_dict(self.app.conf.CELERYBEAT_SCHEDULE)

    def _all_as_schedule(self):
        s = {}
        query = dbsession.query(DatabaseSchedulerEntry)
        query = query.filter_by(enabled=True)
开发者ID:saadqc,项目名称:celery_sqlalchemy_scheduler,代码行数:33,代码来源:sqlalchemy_scheduler.py


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