本文整理汇总了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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()