Skip to main content

The job processing engine that powers ananke

Project description

moirai-engine

PyPI - Version PyPI - Python Version


Table of Contents

NOTE: This doc is still in progress. for now it was generated by AI (sorry).

Installation

pip install moirai-engine

Usage

Basic Example

Here is a basic example of how to use the moirai-engine library to create and run a simple job:

import time
from moirai_engine.core.engine import Engine
from moirai_engine.utils.samples import hello_world

# Create and start the engine
engine = Engine()
engine.start()

# Create a job using the hello_world sample
job = hello_world()

# Add the job to the engine
engine.add_job(job)

# Let the engine run for a while
time.sleep(5)

# Stop the engine
engine.stop()

Advanced Example

Here is an advanced example that includes real-time notifications and job cancellation:

import asyncio
from moirai_engine.core.engine import Engine
from moirai_engine.utils.samples import hello_world


# Create an async function
async def notification_listener(notification):
    print(f"Received notification: {notification}")


async def main():
    engine = Engine(max_workers=4, listener=notification_listener)
    await engine.start()

    # Add jobs to the engine
    await engine.add_job(hello_world(), notification_listener)

    # Let the engine run for a while
    await asyncio.sleep(2)

    await engine.stop()


if __name__ == "__main__":
    asyncio.run(main())

About

moirai-engine is the engine that powers Ananke, but it was planned to be used as a processing engine. This project is still in progress, and features like task registry and autodiscover are still in development.

License

MIT License

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

moirai_engine-0.0.25.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

moirai_engine-0.0.25-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file moirai_engine-0.0.25.tar.gz.

File metadata

  • Download URL: moirai_engine-0.0.25.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for moirai_engine-0.0.25.tar.gz
Algorithm Hash digest
SHA256 4c24df5e8176c1937d9eb4d1b5efdf9f60aa6d9417dfe52e77943c3e7d38a54e
MD5 d42688933c5edd65eff919ecfd9be3f5
BLAKE2b-256 960fe54912338506b150401fd573300ac74a4e54a3860ed5e62fb52e3ca27c49

See more details on using hashes here.

File details

Details for the file moirai_engine-0.0.25-py3-none-any.whl.

File metadata

  • Download URL: moirai_engine-0.0.25-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for moirai_engine-0.0.25-py3-none-any.whl
Algorithm Hash digest
SHA256 5f1dc509ce98b5e55a90060defbe405589dacbf027410795c469ef1961ba510b
MD5 f4effaf3852ad2452d49e0bf796d6ac0
BLAKE2b-256 df55a15993c5f2254f0c8a222d487286c5e68a4141bedcd5d143cf723e4a897c

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