Skip to main content

Pynenc

Pynenc MongoDB Plugin

Full-stack MongoDB backend for Pynenc distributed task orchestration

Package version Supported Python versions GitHub last commit GitHub license


Documentation: https://pynenc-mongodb.readthedocs.io

Pynenc Documentation: https://docs.pynenc.org

Source Code: https://github.com/pynenc/pynenc-mongodb


The pynenc-mongo plugin provides all five Pynenc backend components running on MongoDB, with automatic document chunking for large payloads and a pseudo-atomic ownership protocol for distributed invocation management.

Components

Component Class Role
Orchestrator MongoOrchestrator Invocation lifecycle, ownership consensus & blocking control
Broker MongoBroker FIFO message queue using MongoDB collections
State Backend MongoStateBackend Persistent state, results & exceptions with auto document chunking
Client Data Store MongoClientDataStore Argument caching with compression for large payloads
Trigger MongoTrigger Event-driven & cron-based scheduling with distributed claims

Installation

pip install pynenc-mongo

The plugin registers itself automatically via Python entry points when installed.

Quick Start

from pynenc import PynencBuilder

app = (
    PynencBuilder()
    .app_id("my_app")
    .mongo(url="mongodb://localhost:27017/pynenc")  # all components on MongoDB
    .process_runner()
    .build()
)

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

result = add(1, 2).result  # 3

.mongo() registers every component at once. Start a runner with:

pynenc --app=tasks.app runner start

Configuration

Builder Parameters

# URL-based (recommended)
app = (
    PynencBuilder()
    .app_id("my_app")
    .mongo(url="mongodb://localhost:27017/pynenc")
    .multi_thread_runner(min_threads=2, max_threads=8)
    .build()
)

# Individual parameters
app = (
    PynencBuilder()
    .app_id("my_app")
    .mongo(
        host="localhost",
        port=27017,
        db="pynenc",
        username="admin",
        password="secret",
        auth_source="admin",
    )
    .process_runner()
    .build()
)

Component-Specific Configuration

app = (
    PynencBuilder()
    .app_id("my_app")
    .mongo(url="mongodb://localhost:27017/pynenc")
    .mongo_client_data_store(
        min_size_to_cache=1024,          # cache arguments > 1KB
        local_cache_size=1000,           # local LRU cache entries
        max_size_to_cache=16777216,      # max 16MB per document
    )
    .mongo_trigger(
        scheduler_interval_seconds=60,
        enable_scheduler=True,
    )
    .build()
)

Environment Variables

PYNENC__MONGO__MONGO_URL="mongodb://localhost:27017/pynenc"
# Or individual parameters:
PYNENC__MONGO__MONGO_HOST="localhost"
PYNENC__MONGO__MONGO_PORT=27017
PYNENC__MONGO__MONGO_DB="pynenc"

Connection URLs

.mongo(url="mongodb://localhost:27017/pynenc")                          # Standard
.mongo(url="mongodb://user:pass@localhost:27017/pynenc?authSource=admin")  # With auth
.mongo(url="mongodb+srv://cluster.example.net/pynenc")                  # Atlas SRV

Requirements

  • Python >= 3.12
  • Pynenc >= 0.3.0
  • pymongo >= 3.12.2
  • A running MongoDB server

Related Plugins

License

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

Metadata

Release files for pynenc-mongo 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pynenc-mongo 0.3.0
File Size Uploaded
pynenc_mongo-0.3.0.tar.gz 447.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pynenc-mongo 0.3.0
File Interpreter ABI Platform
pynenc_mongo-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 493.1 kB

Release files / pynenc_mongo-0.3.0.tar.gz

Download URL pynenc_mongo-0.3.0.tar.gz
Size 447.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b8f372b5150417540c7d9c6e40d1005bede02db946e8345bc0c82b06c5f600bd
BLAKE2b-256 checksum
How to use checksums
181eb2fe4c20e3026f12f6f2299dea22e4c49045502e05edfc089171022968b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pynenc_mongo-0.3.0-py3-none-any.whl

Download URL pynenc_mongo-0.3.0-py3-none-any.whl
Size 45.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a9950ccd1837bdf78e1cdbc3178a25c076b9d53743fbca2ae06c6755e5a67ea8
BLAKE2b-256 checksum
How to use checksums
31470c1b78ceca96621996441ba585a1f766a27be649d3b9991b2694e9e665aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.4

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page