コード例 #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()