Skip to main content

Serving with asyncio, multiprocessing, and batching

Project description

mpservice

Utilities for Python concurrency, including

  • Serving with multiprocessing to make full use of multiple cores, and batching to take advantage of vectorized computation if some components of the service have that capability.

    One use case is machine learning model serving, although the code is generic and not restricted to this particular use case.

  • Stream processing, i.e. processing a long, possibly infinite stream of input data, with multiple operators in the pipeline. A main use case is that one or more of the operators is I/O bound (think: calling an external service), hence can benefit from concurrency. Both sync and async interfaces are provided.

The serving and streaming utilities can be combined because a mpservice.mpserver.MPServer instance, while doing heavy-lifting in other processes, acts as an I/O bound operator in the main process. Indeed, mpservice.mpserver.MPServer provides methods stream and async_stream for using the server to process data streams.

A MPServer object could be used either in "embedded" mode or to back a HTTP service. In the latter case, the starlette package is a viable choice for providing async service. A few utilities in mpservice.http_server assist with this use case.

The package also contains some other related utilities.

To install, do pip install mpservice.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

mpservice-0.9.9.tar.gz (26.3 kB view details)

Uploaded Source

Built Distribution

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

mpservice-0.9.9-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

File details

Details for the file mpservice-0.9.9.tar.gz.

File metadata

  • Download URL: mpservice-0.9.9.tar.gz
  • Upload date:
  • Size: 26.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for mpservice-0.9.9.tar.gz
Algorithm Hash digest
SHA256 ce1ca07284ca892b09245ff0ae73eb79dc71872178f59a2bd4a4cef36a23feb0
MD5 fb8a9e89129bba22270c79619ac5b3fd
BLAKE2b-256 a4760caf3e54fc1b0c685c01abdb7deb283a4e0ab62467df218edf79256efe6d

See more details on using hashes here.

File details

Details for the file mpservice-0.9.9-py3-none-any.whl.

File metadata

  • Download URL: mpservice-0.9.9-py3-none-any.whl
  • Upload date:
  • Size: 30.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for mpservice-0.9.9-py3-none-any.whl
Algorithm Hash digest
SHA256 b69e85bdd9a1f88453120142f717a0a37ade5b023449a9605fb44e90315a5f5f
MD5 b46ced95fdb64087732f97a02ede63d4
BLAKE2b-256 0c79c74145e03a6e04d5d3a621387f7e02d3ae027666bddf2bc5bec1170e61b5

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