예제 #1
0
def task_process_queue_document(queue_document_id):
    queue_document = QueueDocument.objects.get(id=queue_document_id)
    queue_document.state = QUEUEDOCUMENT_STATE_PROCESSING
    queue_document.save()
    try:
        do_document_ocr(queue_document.document)
        queue_document.delete()
    except Exception, e:
        queue_document.state = QUEUEDOCUMENT_STATE_ERROR
        queue_document.result = e
        queue_document.save()
예제 #2
0
파일: tasks.py 프로젝트: strogo/mayan
def task_process_queue_document(queue_document_id):
    queue_document = QueueDocument.objects.get(id=queue_document_id)
    queue_document.state = QUEUEDOCUMENT_STATE_PROCESSING
    queue_document.save()
    try:
        do_document_ocr(queue_document.document)
        queue_document.delete()
    except Exception, e:
        queue_document.state = QUEUEDOCUMENT_STATE_ERROR
        queue_document.result = e
        queue_document.save()
예제 #3
0
파일: tasks.py 프로젝트: mrcrabby/mayan
def task_process_queue_document(queue_document_id):
    lock_id = u'%s-lock-%d' % (u'task_process_queue_document', queue_document_id)
    if acquire_lock(lock_id):
        queue_document = QueueDocument.objects.get(pk=queue_document_id)
        queue_document.state = QUEUEDOCUMENT_STATE_PROCESSING
        queue_document.node_name = platform.node()
        queue_document.result = task_process_queue_document.request.id
        queue_document.save()
        try:
            do_document_ocr(queue_document.document)
            queue_document.delete()
        except Exception, e:
            queue_document.state = QUEUEDOCUMENT_STATE_ERROR
            queue_document.result = e
            queue_document.save()
        release_lock(lock_id)
예제 #4
0
파일: tasks.py 프로젝트: MechanisM/mayan
def task_process_queue_document(queue_document_id):
    lock_id = u'task_proc_queue_doc-%d' % queue_document_id
    try:
        lock = Lock.acquire_lock(lock_id, LOCK_EXPIRE)
        queue_document = QueueDocument.objects.get(pk=queue_document_id)
        queue_document.state = QUEUEDOCUMENT_STATE_PROCESSING
        queue_document.node_name = platform.node()
        queue_document.save()
        try:
            do_document_ocr(queue_document)
            queue_document.delete()
        except Exception, e:
            queue_document.state = QUEUEDOCUMENT_STATE_ERROR
            queue_document.result = e
            queue_document.save()
        
        lock.release()
예제 #5
0
파일: tasks.py 프로젝트: spacedman/mayan
def task_process_queue_document(queue_document_id):
    lock_id = u'task_proc_queue_doc-%d' % queue_document_id
    try:
        logger.debug('trying to acquire lock: %s' % lock_id)
        lock = Lock.acquire_lock(lock_id, LOCK_EXPIRE)
        logger.debug('acquired lock: %s' % lock_id)
        queue_document = QueueDocument.objects.get(pk=queue_document_id)
        queue_document.state = QUEUEDOCUMENT_STATE_PROCESSING
        queue_document.node_name = platform.node()
        queue_document.save()
        try:
            do_document_ocr(queue_document)
            queue_document.delete()
        except Exception, e:
            queue_document.state = QUEUEDOCUMENT_STATE_ERROR
            queue_document.result = e
            queue_document.save()
        
        lock.release()