def redo_all_error_for_queue(request): """重做这个错误队列所有的任务 """ queue_id = request.matchdict['id'] while 1: error_task = ztq_core.pop_error(queue_id, timeout=-1) if error_task is None: break error_task['runtime'] = {'queue': queue_id, 'create': int(time.time())} ztq_core.push_runtime_task(queue_id, error_task) return HTTPFound(location='/taskqueues')
def redo_all_error_for_queue(request): """重做这个错误队列所有的任务 """ queue_id = request.matchdict['id'] while 1: error_task = ztq_core.pop_error(queue_id, timeout=-1) if error_task is None: break error_task['runtime'] = {'queue':queue_id, 'create':int(time.time())} ztq_core.push_runtime_task(queue_id, error_task) return HTTPFound(location = '/taskqueues')
def error_jobs_handler(request): """从错误队列中移除或重做某个失败的转换 传入参数:http://server/errorqueues/q01/job?action=remove{redo}&hash_id={{hashid}} """ valid_action = ('remove','redo') queue_id = request.matchdict['id'] url_action = request.params.get('action','') hash_id = urllib.unquote(request.params.get('hash_id').encode('utf8')) if url_action in valid_action: if url_action == 'remove': ztq_core.pop_error(queue_id, hash_id) elif url_action == 'redo': task = ztq_core.pop_error(queue_id, hash_id) task['runtime'] = {'queue':queue_id, 'create':int(time.time())} ztq_core.push_runtime_task(queue_id, task) return HTTPFound(location = '/errorlog') else: return Response('Invalid request')
def error_jobs_handler(request): """从错误队列中移除或重做某个失败的转换 传入参数:http://server/errorqueues/q01/job?action=remove{redo}&hash_id={{hashid}} """ valid_action = ('remove', 'redo') queue_id = request.matchdict['id'] url_action = request.params.get('action', '') hash_id = urllib.unquote(request.params.get('hash_id').encode('utf8')) if url_action in valid_action: if url_action == 'remove': ztq_core.pop_error(queue_id, hash_id) elif url_action == 'redo': task = ztq_core.pop_error(queue_id, hash_id) task['runtime'] = {'queue': queue_id, 'create': int(time.time())} ztq_core.push_runtime_task(queue_id, task) return HTTPFound(location='/errorlog') else: return Response('Invalid request')
def push_buffer_task(self): if 'runtime' not in self.buffer_task: self.buffer_task['runtime'] = {} ztq_core.push_runtime_task(self.buffer_name, self.buffer_task)
def push_buffer_task(self): if "runtime" not in self.buffer_task: self.buffer_task["runtime"] = {} ztq_core.push_runtime_task(self.buffer_name, self.buffer_task)