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


Python Client.enqueue方法代码示例

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


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

示例1: addOccurrenceNotificationsTask

# 需要导入模块: from indico.modules.scheduler import Client [as 别名]
# 或者: from indico.modules.scheduler.Client import enqueue [as 别名]
def addOccurrenceNotificationsTask(dbi, prevVersion):
    """
    Add OccurrenceNotificationsTask to scheduler and remove old RoomReservationTask
    """
    scheduler_client = Client()
    scheduler_module = scheduler_client._schedMod
    old_tasks = []

    for _, task in scheduler_module.getWaitingQueue():
        if getattr(task, 'typeId', None) in {'RoomReservationTask', 'RoomReservationEndTask'}:
            old_tasks.append(task)
    for task in scheduler_module._runningList:
        if getattr(task, 'typeId', None) in {'RoomReservationTask', 'RoomReservationEndTask'}:
            old_tasks.append(task)
    for finished_task in scheduler_module._finishedIndex.values():
        task = finished_task._task if hasattr(finished_task, '_task') else finished_task
        if getattr(task, 'typeId', None) in {'RoomReservationTask', 'RoomReservationEndTask'}:
            scheduler_module._finishedIndex.unindex_obj(finished_task)
    for failed_task in scheduler_module._failedIndex.values():
        task = failed_task._task if hasattr(failed_task, '_task') else failed_task
        if getattr(task, 'typeId', None) in {'RoomReservationTask', 'RoomReservationEndTask'}:
            scheduler_module._failedIndex.unindex_obj(failed_task)
    for task in old_tasks:
        scheduler_client.dequeue(task)

    scheduler_client.enqueue(OccurrenceNotifications(rrule.HOURLY, byminute=0, bysecond=0))
    dbi.commit()
开发者ID:marcosmolla,项目名称:indico,代码行数:29,代码来源:migrate.py

示例2: addSuggestionsTask

# 需要导入模块: from indico.modules.scheduler import Client [as 别名]
# 或者: from indico.modules.scheduler.Client import enqueue [as 别名]
def addSuggestionsTask(dbi, withRBDB, prevVersion):
    """Add Category Suggestion Task to scheduler (Redis needed)"""
    if not Config.getInstance().getRedisConnectionURL():
        print console.colored("  Redis not configured, skipping", 'yellow')
        return
    task = CategorySuggestionTask(rrule.DAILY)
    client = Client()
    client.enqueue(task)
    dbi.commit()
开发者ID:Ictp,项目名称:indico,代码行数:11,代码来源:migrate.py

示例3: register

# 需要导入模块: from indico.modules.scheduler import Client [as 别名]
# 或者: from indico.modules.scheduler.Client import enqueue [as 别名]
 def register(interval=15):
     from indico.modules.scheduler import Client
     from dateutil.rrule import MINUTELY
     from indico.core.db import DBMgr
     DBMgr.getInstance().startRequest()
     task = OutlookUpdateCalendarNotificationTask(MINUTELY, interval=interval)
     client = Client()
     client.enqueue(task)
     DBMgr.getInstance().endRequest()
开发者ID:pferreir,项目名称:indico-backup,代码行数:11,代码来源:tasks.py

示例4: _run

# 需要导入模块: from indico.modules.scheduler import Client [as 别名]
# 或者: from indico.modules.scheduler.Client import enqueue [as 别名]
    def _run(self, args):

        if args.action == 'add_task':
            c = Client()
            task = LiveSyncUpdateTask(MINUTELY, interval=args.interval)
            c.enqueue(task)
            self._dbi.commit()
        elif args.action == 'export':
            self._export(args)
            self._dbi.abort()
        elif args.action == 'simulate':
            self._simulate(args)
            self._dbi.abort()
开发者ID:VishrutMehta,项目名称:indico,代码行数:15,代码来源:console.py

示例5: taskMigration

# 需要导入模块: from indico.modules.scheduler import Client [as 别名]
# 或者: from indico.modules.scheduler.Client import enqueue [as 别名]
def taskMigration(dbi, withRBDB, prevVersion):
    """
    Migrating database tasks from the old format to the new one
    """

    c = Client()

    for t in HelperTaskList().getTaskListInstance().getTasks():
        for obj in t.listObj.values():
            print console.colored("   * %s" % obj.__class__.__name__, 'blue')
            if obj.__class__.__name__ == 'OfflineWebsiteCreator':
                continue
            if obj.__class__.__name__ == 'FoundationSync':
                c.enqueue(
                    FoundationSyncTask(rrule.DAILY, byhour=0, byminute=0))
            elif obj.__class__.__name__ == 'StatisticsUpdater':
                c.enqueue(CategoryStatisticsUpdaterTask(
                    CategoryManager().getById('0'),
                    rrule.DAILY,
                    byhour=0, byminute=0))
            elif obj.__class__.__name__ == 'sendMail':
                # they have to be somewhere in the conference
                alarm = t.conf.alarmList[t.id]
                c.enqueue(alarm)
            else:
                print console.colored("WARNING: Unknown task type!", 'yellow')

    if withRBDB:
        DALManager.commit()
    dbi.commit()
开发者ID:ferhatelmas,项目名称:indico,代码行数:32,代码来源:migrate.py

示例6: Client

# 需要导入模块: from indico.modules.scheduler import Client [as 别名]
# 或者: from indico.modules.scheduler.Client import enqueue [as 别名]
from indico.modules.scheduler import Client
from dateutil import rrule
from indico.core.db import DBMgr
from indicoaffiliation.tasks.ecosoc import ECOSOCListTask

dbi = DBMgr.getInstance()
c = Client()
pt = ECOSOCListTask(rrule.HOURLY)
c.enqueue(pt)
dbi.commit()
开发者ID:cmorgia,项目名称:indicoaffiliation,代码行数:12,代码来源:ecosoc_task.py

示例7: run

# 需要导入模块: from indico.modules.scheduler import Client [as 别名]
# 或者: from indico.modules.scheduler.Client import enqueue [as 别名]
 def run(self):
     DBMgr.getInstance().startRequest()
     c = Client()
     c.enqueue(self._task_t(self._id, self._time, **self._extra_args))
     DBMgr.getInstance().endRequest()
开发者ID:VishrutMehta,项目名称:indico,代码行数:7,代码来源:server_test.py


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