def __call__(self, *args, **kwargs):
self.logger = get_task_logger('que.mgmt')
task = 'MgmtTask %s%s' % (self.name, args[:2])
tidlock = kwargs.pop('tidlock', None)
check_user_tasks = kwargs.pop('check_user_tasks', False)
kwargs.pop('cache_result', None)
kwargs.pop('cache_timeout', None)
kwargs.pop('nolog', None)
tid = self.request.id
if tidlock:
task_lock = TaskLock(tidlock, desc=task, logger=self.logger)
else:
task_lock = NoLock()
try:
if check_user_tasks: # Wait for task to appear in UserTasks - bug #chili-618
UserTasks.check(tid, logger=self.logger) # Will raise an exception in case the task does not show up
task_lock.task_check() # Will raise an exception in case the lock does not exist
return super(MgmtTask, self).__call__(tid, *args, **kwargs) # run()
finally:
task_lock.delete()
评论列表
文章目录