Skip to main content

moriarty

Project description

codecov

moriarty

Moriarty is a set of components for building asynchronous inference cluster.

Relying on cloud vendors or self-built global queue services, asynchronous inference clusters can be built without exposing ports to the public.

Why asynchronous inference, why moriarty?

  • Preventing client timeout.
  • Avoid HTTP disconnection due to network or other issues.
  • Reducing HTTP queries with queues.
  • Deploy on Multi/Hybrid/Private cloud, even on bare metal.

Alternatives

This project came from my deep use of Asynchronous Inferenc for AWS Sagemaker, and as far as I know, only AWS and Aliyun provide asynchronous inference support.

For open source projects, there are many deployment solutions, but most of them are synchronous inference (based on HTTP or RPC).I don't find any alternative for async inference. Maybe Kubeflow pipeline can be used for asynchronous inference. But without serving support(Leave model in GPU as a service, not load per job), there is a significant overhead of GPU memory cache and model load time.

Architecture Overview

Architecture Overview

Key Components:

  • Matrix: single producer, multiple consumers. Connector as producer, provide HTTP API for Backend Service and push invoke request to the global Job Queue. Operator as consumer, pull tasks from the Job Queue and push them to local queue. Pulling or not depends on the load of inference cluster. And also, Operator will autoscale inference container if needed.
  • Endpoint: Deploy a function as an HTTP service.
  • Sidecar: Proxy and transform queue message into HTTP request.
  • Init: Init script for inference container

CLIs:

  • moriarty-matrix: Manager matrix components
  • moriarty-operator: Start the operator component
  • moriarty-connector: Start the connector component
  • moriarty-sidecar: Start the sidecar component
  • moriarty-deploy: Request operator's API or database for deploy inference endpoint.

Install

pip install moriarty[matrix] for all components.

Or use docker image

docker pull wh1isper/moriarty or docker pull ghcr.io/wh1isper/moriarty

docker pull wh1isper/moriarty:dev for developing version

Develop

Install pre-commit before commit

pip install pre-commit
pre-commit install

Install package locally with test dependencies

pip install -e .[test]

Run tests with pytest

pytest -v tests/

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

moriarty-0.2.7.tar.gz (190.1 kB view details)

Uploaded Source

Built Distribution

moriarty-0.2.7-py3-none-any.whl (62.9 kB view details)

Uploaded Python 3

File details

Details for the file moriarty-0.2.7.tar.gz.

File metadata

  • Download URL: moriarty-0.2.7.tar.gz
  • Upload date:
  • Size: 190.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for moriarty-0.2.7.tar.gz
Algorithm Hash digest
SHA256 46485a774ac0b49bad52ce54b4aa8454f283229251fc46c30e889cca05658de5
MD5 b5b7e7e1bc61c324e2bde6ac0a307711
BLAKE2b-256 12e93d7b78731fa48651c320d1d4145b08c45f9e3a081048df551ce74dd8514f

See more details on using hashes here.

File details

Details for the file moriarty-0.2.7-py3-none-any.whl.

File metadata

  • Download URL: moriarty-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 62.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for moriarty-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 c68c127df668a213fd469fe1c92c910658cb78d2f6ebef04c8213d7d038e90a1
MD5 e1fc0a9886abc7382a26d423f2cc170b
BLAKE2b-256 26f8aa8c92ef3e9b836df8fb1d63710b16b3daf291727c6397a1a767f4048d0f

See more details on using hashes here.

Supported by

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