Skip to main content

MongoDB plugin for Pynenc distributed task management system

Project description

Pynenc MongoDB Plugin

CI codecov PyPI version Python versions

MongoDB state backend plugin for Pynenc, providing distributed task state management using MongoDB as the storage backend.

Features

  • 🚀 High Performance: Optimized MongoDB operations with connection pooling
  • 🔒 Distributed Locking: MongoDB-based distributed locks for task coordination
  • 🎯 Type Safe: Full type hints and mypy compatibility
  • 🧪 Well Tested: Comprehensive test suite with multiple MongoDB versions
  • 📊 Production Ready: Battle-tested configuration options and monitoring

Quick Start

Installation

pip install pynenc-mongodb

Basic Usage

from pynenc import Pynenc
from pynenc_mongodb import MongoStateBackend

# Create Pynenc app with MongoDB backend
app = Pynenc().with_state_backend(
    MongoStateBackend.from_uri("mongodb://localhost:27017/pynenc")
)

@app.task
def my_task(x: int, y: int) -> int:
    return x + y

# Use your tasks as normal
result = my_task(1, 2)

Configuration

Connection Configuration

from pynenc_mongodb import MongoStateBackend, ConfigMongoDB

config = ConfigMongoDB(
    uri="mongodb://localhost:27017",
    database_name="my_pynenc_db",
    max_pool_size=100,
    write_concern_w="majority",
    read_preference="primaryPreferred"
)

backend = MongoStateBackend(config)

Environment Variables

You can also configure via environment variables:

export PYNENC_MONGODB_URI="mongodb://localhost:27017"
export PYNENC_MONGODB_DATABASE="pynenc"
export PYNENC_MONGODB_MAX_POOL_SIZE="100"

Documentation

Development

Setup

  1. Clone the repository
  2. Install dependencies: poetry install --with dev
  3. Start MongoDB: docker-compose -f docker/docker-compose.yml up -d
  4. Run tests: poetry run pytest

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pynenc_mongo-0.1.0.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pynenc_mongo-0.1.0-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file pynenc_mongo-0.1.0.tar.gz.

File metadata

  • Download URL: pynenc_mongo-0.1.0.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.13

File hashes

Hashes for pynenc_mongo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 29e150856d069597c54e3c947f587accb3e11909838f711df9505d866410f1b7
MD5 4221345547758b68b3f3e4023c284f39
BLAKE2b-256 34ac2aefde6aabcc178a4c0abfd07fbb311ff308c2c24c9f2ed28d0408119afc

See more details on using hashes here.

File details

Details for the file pynenc_mongo-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pynenc_mongo-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 27.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.13

File hashes

Hashes for pynenc_mongo-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 08f3b676fc1c0481d951fd1ca214ce6cb724aa58c29bd8128e51e78fbef1d981
MD5 9eec9362dd3e11f2ab81bc6586b9d972
BLAKE2b-256 e2a5860a898b2b1d7a0fcd04633ebba07e95e39f9e3ab52899464e0f684efd74

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page