示例#1
0
文件: views.py 项目: ghotiv/ztq
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')
示例#2
0
文件: views.py 项目: robert118/ztq
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')
示例#3
0
文件: views.py 项目: robert118/ztq
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')
示例#4
0
文件: views.py 项目: ghotiv/ztq
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')
示例#5
0
    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)
示例#6
0
    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)