Skip to content

Commit

Permalink
docs: mark ipc wrapper as deprecated (#378)
Browse files Browse the repository at this point in the history
Signed-off-by: Keming <[email protected]>
  • Loading branch information
kemingy authored Jun 6, 2023
1 parent 66ab1f3 commit 76c8035
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mosec"
version = "0.6.7"
version = "0.7.0"
authors = ["Keming <[email protected]>", "Zichen <[email protected]>"]
edition = "2021"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion docs/source/examples/ipc.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This is an example demonstrating how you can enable the plasma shared memory sto

Mosec's multi-stage pipeline requires the output data from the previous stage to be transferred to the next stage across python processes. This is coordinated via Unix domain socket between every Python worker process from all stages and the Rust controller process.

By default, we serialize the data and directly transfer the bytes over the socket. However, users may find wrapping this IPC useful or more efficient for specific use cases. Therefore, we provide an example implementation `PlasmaShmIPCMixin` based on [`pyarrow.plasma`](https://arrow.apache.org/docs/11.0/python/plasma.html) and `RedisShmIPCMixin` based on [`redis`](https://pypi.org/project/redis). We recommand using `RedisShmWrapper` for better performance and longer-lasting updates.
By default, we serialize the data and directly transfer the bytes over the socket. However, users may find wrapping this IPC useful or more efficient for specific use cases. Therefore, we provide an example implementation `PlasmaShmIPCMixin` based on [`pyarrow.plasma`](https://arrow.apache.org/docs/11.0/python/plasma.html) and `RedisShmIPCMixin` based on [`redis`](https://pypi.org/project/redis). We recommend using `RedisShmWrapper` for better performance and longer-lasting updates.

```{warning}
`plasma` is deprecated. Please use Redis instead.
Expand Down
10 changes: 5 additions & 5 deletions license.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
{
"name": "axum",
"version": "0.6.17",
"version": "0.6.18",
"authors": null,
"repository": "https://github.com/tokio-rs/axum",
"license": "MIT",
Expand Down Expand Up @@ -55,7 +55,7 @@
},
{
"name": "mosec",
"version": "0.6.6",
"version": "0.7.0",
"authors": "Keming <[email protected]>|Zichen <[email protected]>",
"repository": "https://github.com/mosecorg/mosec",
"license": "Apache-2.0",
Expand All @@ -64,7 +64,7 @@
},
{
"name": "once_cell",
"version": "1.17.1",
"version": "1.17.2",
"authors": "Aleksey Kladov <[email protected]>",
"repository": "https://github.com/matklad/once_cell",
"license": "Apache-2.0 OR MIT",
Expand All @@ -73,7 +73,7 @@
},
{
"name": "prometheus-client",
"version": "0.20.0",
"version": "0.21.1",
"authors": "Max Inden <[email protected]>",
"repository": "https://github.com/prometheus/client_rust",
"license": "Apache-2.0 OR MIT",
Expand All @@ -82,7 +82,7 @@
},
{
"name": "tokio",
"version": "1.28.0",
"version": "1.28.2",
"authors": "Tokio Contributors <[email protected]>",
"repository": "https://github.com/tokio-rs/tokio",
"license": "MIT",
Expand Down
5 changes: 5 additions & 0 deletions mosec/ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
"""Wrapper layer for IPC between workers.
This will be called before sending data or after receiving data through the Protocol.
.. warning::
This implementation is deprecated. Please use
:py:mod:`PlasmaShmIPCMixin <mosec.mixin.PlasmaShmIPCMixin>`
"""

import abc
Expand Down
4 changes: 4 additions & 0 deletions mosec/plugins/plasma_shm.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ def __init__(self, shm_path: str) -> None:
Args:
shm_path (str): path of the plasma server.
"""
warnings.warn(
"PlasmaShmWrapper is deprecated, please use RedisShmIPCMixin.",
DeprecationWarning,
)
self.client = plasma.connect(shm_path)

def _put_plasma(self, data: List[bytes]) -> List[plasma.ObjectID]:
Expand Down
13 changes: 3 additions & 10 deletions mosec/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,18 @@
model serving.
Dynamic Batching
================
----------------
The user may enable the dynamic batching feature for any stage when the
corresponding worker is appended, by setting the
:py:meth:`append_worker(max_batch_size) <Server.append_worker>`.
Multiprocess
============
------------
The user may spawn multiple processes for any stage when the
corresponding worker is appended, by setting the
:py:meth:`append_worker(num) <Server.append_worker>`.
IPC Wrapper
===========
The user may wrap the inter-process communication to use shared memory,
e.g. pyarrow plasma, by providing the :py:mod:`IPC Wrapper <mosec.ipc.IPCWrapper>`
for the server.
"""

import multiprocessing as mp
Expand Down Expand Up @@ -78,7 +71,7 @@ def __init__(
"""Initialize a MOSEC Server.
Args:
ipc_wrapper: wrapper function (before and after) IPC
ipc_wrapper: (deprecated) wrapper function (before and after) IPC
endpoint: path to route inference
"""
self.ipc_wrapper = ipc_wrapper
Expand Down

0 comments on commit 76c8035

Please sign in to comment.