Skip to main content

No project description provided

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 time
from moirai_engine.core.engine import Engine
from moirai_engine.utils.samples import hello_world, slow_hello_world

def notification_listener(notification):
    print(f"Received notification: {notification}")

# Create and start the engine with notification listener
engine = Engine(max_workers=4)
engine.add_notification_listener(notification_listener)
engine.start()

# Create jobs
job = slow_hello_world()
job2 = hello_world()

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

# Start notification listeners for the jobs
engine.start_notification_listener(job.id)
engine.start_notification_listener(job2.id)

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

# Cancel the current job
engine.cancel_current_job(job.id)

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

# Stop the engine
engine.stop()

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.15.tar.gz (7.8 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.15-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: moirai_engine-0.0.15.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for moirai_engine-0.0.15.tar.gz
Algorithm Hash digest
SHA256 2367bc4a24f394a8576ad0d1e06869aa01e00c131e652d1b1a8ace4b4cbddd38
MD5 5e9f04d509c91364d20ee0f1d04c9ccc
BLAKE2b-256 264f5bf92d9b290ff48737e20ab5243e92bd4199eb9b9cb29f02eb4f99f050ca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: moirai_engine-0.0.15-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for moirai_engine-0.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 36ad2456a2ad151e5ec71ddc3315aed37c5d143e5f367c6490bdd42b5fcb6830
MD5 4b00a2245170c977aee13539d386347c
BLAKE2b-256 98fbc0faea78cb6cb1e75e6b4a5bb27365d4981fb4a1cd49b355420e6fc6a652

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