mentat.dirq module

Implementation of filesystem directory based queue for universal messages.

class mentat.dirq.DirectoryQueue(dir_queue, **kwargs)[source]

Bases: object

Implementation of filesystem directory based queue for universal messages.

CONFIG_DIR_NEXT_QUEUE = 'dir_next_queue'
CONFIG_DIR_QUEUE = 'dir_queue'
CONFIG_GROUP = 'group'
CONFIG_QUEUE_PERMS = 'queue_perms'
CONFIG_USER = 'user'
STAT_CNT_CANCELS = 'cnt_cancels'
STAT_CNT_COMMITS = 'cnt_commits'
STAT_CNT_DEQUEUED = 'cnt_dequeued'
STAT_CNT_DISPATCHED = 'cnt_dispatched'
STAT_CNT_DUPLICATED = 'cnt_duplicated'
STAT_CNT_ERRORS = 'cnt_errors'
STAT_CNT_QUEUED = 'cnt_queued'
STAT_CNT_SKIPS = 'cnt_skips'
STAT_CNT_UPDATES = 'cnt_updates'
SUBDIR_ERRORS = 'errors'
SUBDIR_INCOMING = 'incoming'
SUBDIR_PENDING = 'pending'
SUBDIR_TMP = 'tmp'
banish(itemid, metadata=None)[source]

Banish given message into error folder.

cancel(itemid)[source]

Cancel given message (remove it from processing without moving to error folder).

count_done()[source]

Count number of messages in done queue subdirectory.

count_errors()[source]

Count number of messages in errors queue subdirectory.

count_incoming()[source]

Count number of messages in incoming queue subdirectory.

count_pending()[source]

Count number of messages in pending queue subdirectory.

dispatch(itemid, target_folder, metadata=None)[source]

Dispatch given message into designated target folder.

duplicate(itemid, target_folder, metadata=None)[source]

Duplicate given message into designated target folder.

enqueue(item)[source]

Enqueue given item into the incoming queue subdirectory.

enqueue_file(item)[source]

Enqueue given file directly into the incoming queue subdirectory.

is_error(itemid)[source]

Check if the given message is located in errors queue subdirectory.

is_incoming(itemid)[source]

Check if the given message is located in incoming queue subdirectory.

is_pending(itemid)[source]

Check if the given message is located in pending queue subdirectory.

next()[source]

Fetch next item from incoming queue.

next_file()[source]

Fetch next file from incoming queue.

reload(itemid)[source]

Reload given message from within pending queue.

statistics()[source]

Get the internal statistics.

update(itemid, item)[source]

Update given message within pending queue.

exception mentat.dirq.DirectoryQueueException(description)[source]

Bases: Exception

This class represents all custom exceptions related to DirectoryQueue.