mongo-taskqueue


Namemongo-taskqueue JSON
Version 0.2.4 PyPI version JSON
download
home_page
SummaryQueueing data structure on top of a MongoDB collection
upload_time2022-12-08 20:01:19
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT
keywords mongo mongodb queue task taskqueue
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Mongo TaskQueue
[![Python 3.6](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue.svg)](https://pypi.org/project/mongo-taskqueue)
[![PyPI version](https://badge.fury.io/py/mongo-taskqueue.svg)](https://badge.fury.io/py/mongo-taskqueue)
![MongoDB](https://img.shields.io/badge/MongoDB-%234ea94b.svg?style=flat&logo=mongodb&logoColor=white)

Mongo-TaskQueue is a queueing data structure built on top of a MongoDB 
collection.

## Quick start
Just create an instance of TaskQueue and start to append to your queue:
```python
>>> from mongotq import get_task_queue

>>> task_queue = get_task_queue(
        database_name=YOUR_MONGO_DATABASE_NAME,
        collection_name='queueGeocoding',
        host=YOUR_MONGO_DB_URI,
        ttl=-1  # permanent queue
    )
>>> task_queue.append({'species': 'Great Horned Owl'})
>>> task_queue.append({'species': 'Eastern Screech Owl'})
>>> task_queue.append({'species': 'Northern Saw-whet Owl'})
>>> task_queue.append({'species': 'Snowy Owl'})
>>> task_queue.append({'species': 'Whiskered Screech Owl'})
```

Then you can simply check the tail of your queue:
```python
>>> task_queue.tail(n=5)
```
```python
{'_id': ObjectId('6392375588c63227371c693c'),
 'assignedTo': None,
 'createdAt': datetime.datetime(2022, 12, 8, 14, 13, 25, 99685),
 'errorMessage': None,
 'modifiedAt': datetime.datetime(2022, 12, 8, 14, 13, 25, 99685),
 'payload': {'species': 'Great Horned Owl'},
 'priority': 0,
 'retries': 0,
 'status': 'new'}
{'_id': ObjectId('6392375588c63227371c693d'),
 'assignedTo': None,
 'createdAt': datetime.datetime(2022, 12, 8, 14, 13, 25, 129570),
 'errorMessage': None,
 'modifiedAt': datetime.datetime(2022, 12, 8, 14, 13, 25, 129570),
 'payload': {'species': 'Eastern Screech Owl'},
 'priority': 0,
 'retries': 0,
 'status': 'new'}
{'_id': ObjectId('6392375588c63227371c693e'),
 'assignedTo': None,
 'createdAt': datetime.datetime(2022, 12, 8, 14, 13, 25, 155404),
 'errorMessage': None,
 'modifiedAt': datetime.datetime(2022, 12, 8, 14, 13, 25, 155404),
 'payload': {'species': 'Northern Saw-whet Owl'},
 'priority': 0,
 'retries': 0,
 'status': 'new'}
{'_id': ObjectId('6392375588c63227371c693f'),
 'assignedTo': None,
 'createdAt': datetime.datetime(2022, 12, 8, 14, 13, 25, 179804),
 'errorMessage': None,
 'modifiedAt': datetime.datetime(2022, 12, 8, 14, 13, 25, 179804),
 'payload': {'species': 'Snowy Owl'},
 'priority': 0,
 'retries': 0,
 'status': 'new'}
{'_id': ObjectId('6392375588c63227371c6940'),
 'assignedTo': None,
 'createdAt': datetime.datetime(2022, 12, 8, 14, 13, 25, 204284),
 'errorMessage': None,
 'modifiedAt': datetime.datetime(2022, 12, 8, 14, 13, 25, 204284),
 'payload': {'species': 'Whiskered Screech Owl'},
 'priority': 0,
 'retries': 0,
 'status': 'new'}
5 Task(s) available in the TaskQueue
```


## Installation
The only dependency is [pyMongo](https://pymongo.readthedocs.io/en/stable/).
The easiest way to install Mongo-TaskQueue is using `pip`:
```shell
pip install mongo-taskqueue
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "mongo-taskqueue",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Shayan Amani <shayan@talonhealthtech.com>",
    "keywords": "mongo,mongodb,queue,task,taskqueue",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/41/b9/1f6de18e6ab82bfdb1132fbbd4644d8ae99a4f2fb14f168afdb6b3e2cef2/mongo-taskqueue-0.2.4.tar.gz",
    "platform": null,
    "description": "# Mongo TaskQueue\n[![Python 3.6](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue.svg)](https://pypi.org/project/mongo-taskqueue)\n[![PyPI version](https://badge.fury.io/py/mongo-taskqueue.svg)](https://badge.fury.io/py/mongo-taskqueue)\n![MongoDB](https://img.shields.io/badge/MongoDB-%234ea94b.svg?style=flat&logo=mongodb&logoColor=white)\n\nMongo-TaskQueue is a queueing data structure built on top of a MongoDB \ncollection.\n\n## Quick start\nJust create an instance of TaskQueue and start to append to your queue:\n```python\n>>> from mongotq import get_task_queue\n\n>>> task_queue = get_task_queue(\n        database_name=YOUR_MONGO_DATABASE_NAME,\n        collection_name='queueGeocoding',\n        host=YOUR_MONGO_DB_URI,\n        ttl=-1  # permanent queue\n    )\n>>> task_queue.append({'species': 'Great Horned Owl'})\n>>> task_queue.append({'species': 'Eastern Screech Owl'})\n>>> task_queue.append({'species': 'Northern Saw-whet Owl'})\n>>> task_queue.append({'species': 'Snowy Owl'})\n>>> task_queue.append({'species': 'Whiskered Screech Owl'})\n```\n\nThen you can simply check the tail of your queue:\n```python\n>>> task_queue.tail(n=5)\n```\n```python\n{'_id': ObjectId('6392375588c63227371c693c'),\n 'assignedTo': None,\n 'createdAt': datetime.datetime(2022, 12, 8, 14, 13, 25, 99685),\n 'errorMessage': None,\n 'modifiedAt': datetime.datetime(2022, 12, 8, 14, 13, 25, 99685),\n 'payload': {'species': 'Great Horned Owl'},\n 'priority': 0,\n 'retries': 0,\n 'status': 'new'}\n{'_id': ObjectId('6392375588c63227371c693d'),\n 'assignedTo': None,\n 'createdAt': datetime.datetime(2022, 12, 8, 14, 13, 25, 129570),\n 'errorMessage': None,\n 'modifiedAt': datetime.datetime(2022, 12, 8, 14, 13, 25, 129570),\n 'payload': {'species': 'Eastern Screech Owl'},\n 'priority': 0,\n 'retries': 0,\n 'status': 'new'}\n{'_id': ObjectId('6392375588c63227371c693e'),\n 'assignedTo': None,\n 'createdAt': datetime.datetime(2022, 12, 8, 14, 13, 25, 155404),\n 'errorMessage': None,\n 'modifiedAt': datetime.datetime(2022, 12, 8, 14, 13, 25, 155404),\n 'payload': {'species': 'Northern Saw-whet Owl'},\n 'priority': 0,\n 'retries': 0,\n 'status': 'new'}\n{'_id': ObjectId('6392375588c63227371c693f'),\n 'assignedTo': None,\n 'createdAt': datetime.datetime(2022, 12, 8, 14, 13, 25, 179804),\n 'errorMessage': None,\n 'modifiedAt': datetime.datetime(2022, 12, 8, 14, 13, 25, 179804),\n 'payload': {'species': 'Snowy Owl'},\n 'priority': 0,\n 'retries': 0,\n 'status': 'new'}\n{'_id': ObjectId('6392375588c63227371c6940'),\n 'assignedTo': None,\n 'createdAt': datetime.datetime(2022, 12, 8, 14, 13, 25, 204284),\n 'errorMessage': None,\n 'modifiedAt': datetime.datetime(2022, 12, 8, 14, 13, 25, 204284),\n 'payload': {'species': 'Whiskered Screech Owl'},\n 'priority': 0,\n 'retries': 0,\n 'status': 'new'}\n5 Task(s) available in the TaskQueue\n```\n\n\n## Installation\nThe only dependency is [pyMongo](https://pymongo.readthedocs.io/en/stable/).\nThe easiest way to install Mongo-TaskQueue is using `pip`:\n```shell\npip install mongo-taskqueue\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Queueing data structure on top of a MongoDB collection",
    "version": "0.2.4",
    "split_keywords": [
        "mongo",
        "mongodb",
        "queue",
        "task",
        "taskqueue"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "31faa7c28afcd9fa7441568776eb3d02",
                "sha256": "737541722a2459039d189b657409aa283bd6022a5f027c58d3c0f7da573577cc"
            },
            "downloads": -1,
            "filename": "mongo_taskqueue-0.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "31faa7c28afcd9fa7441568776eb3d02",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 10040,
            "upload_time": "2022-12-08T20:01:17",
            "upload_time_iso_8601": "2022-12-08T20:01:17.628224Z",
            "url": "https://files.pythonhosted.org/packages/63/88/d3bf370a6bcd9efbe3de69d1b84fb4644948a39cf084a249d4dd8e7505b9/mongo_taskqueue-0.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "8c4f10b3a24882b71b0463afd3b63575",
                "sha256": "3e3f7551a3526fdf694fd60b9bcba66de3f3a6700387e2c06e4544170f4424d1"
            },
            "downloads": -1,
            "filename": "mongo-taskqueue-0.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "8c4f10b3a24882b71b0463afd3b63575",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8719,
            "upload_time": "2022-12-08T20:01:19",
            "upload_time_iso_8601": "2022-12-08T20:01:19.517205Z",
            "url": "https://files.pythonhosted.org/packages/41/b9/1f6de18e6ab82bfdb1132fbbd4644d8ae99a4f2fb14f168afdb6b3e2cef2/mongo-taskqueue-0.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-08 20:01:19",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "mongo-taskqueue"
}
        
Elapsed time: 0.02170s