streaminghub-datamux


Namestreaminghub-datamux JSON
Version 0.1.8 PyPI version JSON
download
home_pageNone
SummaryA library to stream data into real-time analytics pipelines
upload_time2024-07-05 19:50:23
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseCopyright (c) 2024 Old Dominion University Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: This work shall be cited in the bibliography as: Yasith Jayawardana, Vikas G. Ashok, and Sampath Jayarathna. 2022. StreamingHub: interactive stream analysis workflows. In Proceedings of the 22nd ACM/IEEE Joint Conference on Digital Libraries (JCDL '22). Association for Computing Machinery, New York, NY, USA, Article 15, 1-10. https://doi.org/10.1145/3529372.3530936 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords dfds metadata parser
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # DataMux

<img src="https://i.imgur.com/xSieE3V.png" height="100px">

**DataMux** is a library to stream data into real-time analytics pipelines.
It provides the modes listed below.

- **Proxy Mode**: to interface and proxy live data from sensors
- **Replay Mode**: to replay stored data from datasets
- **Simulate Mode**: to stream guided/unguided mock data for testing

## Installation

First, install datamux as a pip package.

```bash

pip install streaminghub-datamux

```

## Initialization

Next, configure where datamux should look for data and metadata. We use `$HOME/streaminghub` by default. This configuration will be stored at `$HOME/.streaminghubrc`.

```bash

python -m streaminghub_datamux init --data_dir="$HOME/streaminghub" --meta_dir="$HOME/streaminghub"

```

## Usage

### Import and Setup

In your Python script, first import datamux as follows.

```python
# import datamux
import streaminghub_datamux as dm

```

Next, instantiate the Datamux API. Here, you have two options:

```python
# Option A - Local API (runs locally)
api = dm.API()

# Option B - Remote API (runs over a remote datamux server)
api = dm.RemoteAPI(rpc_name="<rpc>", codec_name="<codec>")
await api.connect(server_host="<host>", server_port=<port>)
```

### Replay Recordings from Collections

```python
# list all collections (each collection provides one or more streams)
collections = await api.list_collections()
# list all recordings (i.e., streams) in a collection, by id
streams = await api.list_collection_streams(collection_id="<id>")
# sample attributes of a stream (found in stream.attrs)
attrs = dict({"subject": "A", "session": "1", "task": "1"})
# queue to append received data
sink = asyncio.Queue()
# start gathering data into queue
ack = await api.replay_collection_stream(collection_id="<id>", stream_id="<id>", attrs, sink)
# each request is assigned a unique ID for later reference
assert ack.randseq is not None
# simply await the queue to read data
while True:
    item = await sink.get()
    # checking for end-of-stream
    if item == util.END_OF_STREAM:
        break
# once done, stop the task to avoid wasting resources
await api.stop_task(ack.randseq)
```

### Proxy Live Streams from Devices

```python
# list all nodes (each node provides one or more streams)
nodes = await api.list_live_nodes()
# list all devices (i.e., streams) in a node, by id
streams = await api.list_live_streams(node_id="<id>")
# sample attributes of a stream (found in stream.attrs)
attrs = dict({"subject": "A", "session": "1", "task": "1"})
# queue to append received data
sink = asyncio.Queue()
# start gathering data into queue
ack = await api.proxy_live_stream(node_id="<id>", stream_id="<id>", attrs, sink)
# each request is assigned a unique ID for later reference
assert ack.randseq is not None
# simply await the queue to read data
while True:
    item = await sink.get()
    # checking for end-of-stream
    if item == util.END_OF_STREAM:
        break
# once done, stop the task to avoid wasting resources
await api.stop_task(ack.randseq)

```

## Start a Remote API

You can start a remote API using the command below.

```bash
python -m streaminghub_datamux serve -H "<host_name>" -p <port> -r <rpc_name> -c <codec_name>
```

## For Developers

```bash

# clone streaminghub from git
git clone https://github.com/nirdslab/streaminghub.git

# cd into streaminghub/ directory
cd streaminghub/

# install the streaminghub_datamux/ folder as a pip package
python -m pip install -e streaminghub_datamux/

```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "streaminghub-datamux",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "dfds, metadata, parser",
    "author": null,
    "author_email": "Yasith Jayawardana <yasith@cs.odu.edu>",
    "download_url": "https://files.pythonhosted.org/packages/99/0b/40ae8fb450062cd38d00da38a298ecc5aa5311c463bc2cdbf46e781c8f05/streaminghub_datamux-0.1.8.tar.gz",
    "platform": null,
    "description": "# DataMux\n\n<img src=\"https://i.imgur.com/xSieE3V.png\" height=\"100px\">\n\n**DataMux** is a library to stream data into real-time analytics pipelines.\nIt provides the modes listed below.\n\n- **Proxy Mode**: to interface and proxy live data from sensors\n- **Replay Mode**: to replay stored data from datasets\n- **Simulate Mode**: to stream guided/unguided mock data for testing\n\n## Installation\n\nFirst, install datamux as a pip package.\n\n```bash\n\npip install streaminghub-datamux\n\n```\n\n## Initialization\n\nNext, configure where datamux should look for data and metadata. We use `$HOME/streaminghub` by default. This configuration will be stored at `$HOME/.streaminghubrc`.\n\n```bash\n\npython -m streaminghub_datamux init --data_dir=\"$HOME/streaminghub\" --meta_dir=\"$HOME/streaminghub\"\n\n```\n\n## Usage\n\n### Import and Setup\n\nIn your Python script, first import datamux as follows.\n\n```python\n# import datamux\nimport streaminghub_datamux as dm\n\n```\n\nNext, instantiate the Datamux API. Here, you have two options:\n\n```python\n# Option A - Local API (runs locally)\napi = dm.API()\n\n# Option B - Remote API (runs over a remote datamux server)\napi = dm.RemoteAPI(rpc_name=\"<rpc>\", codec_name=\"<codec>\")\nawait api.connect(server_host=\"<host>\", server_port=<port>)\n```\n\n### Replay Recordings from Collections\n\n```python\n# list all collections (each collection provides one or more streams)\ncollections = await api.list_collections()\n# list all recordings (i.e., streams) in a collection, by id\nstreams = await api.list_collection_streams(collection_id=\"<id>\")\n# sample attributes of a stream (found in stream.attrs)\nattrs = dict({\"subject\": \"A\", \"session\": \"1\", \"task\": \"1\"})\n# queue to append received data\nsink = asyncio.Queue()\n# start gathering data into queue\nack = await api.replay_collection_stream(collection_id=\"<id>\", stream_id=\"<id>\", attrs, sink)\n# each request is assigned a unique ID for later reference\nassert ack.randseq is not None\n# simply await the queue to read data\nwhile True:\n    item = await sink.get()\n    # checking for end-of-stream\n    if item == util.END_OF_STREAM:\n        break\n# once done, stop the task to avoid wasting resources\nawait api.stop_task(ack.randseq)\n```\n\n### Proxy Live Streams from Devices\n\n```python\n# list all nodes (each node provides one or more streams)\nnodes = await api.list_live_nodes()\n# list all devices (i.e., streams) in a node, by id\nstreams = await api.list_live_streams(node_id=\"<id>\")\n# sample attributes of a stream (found in stream.attrs)\nattrs = dict({\"subject\": \"A\", \"session\": \"1\", \"task\": \"1\"})\n# queue to append received data\nsink = asyncio.Queue()\n# start gathering data into queue\nack = await api.proxy_live_stream(node_id=\"<id>\", stream_id=\"<id>\", attrs, sink)\n# each request is assigned a unique ID for later reference\nassert ack.randseq is not None\n# simply await the queue to read data\nwhile True:\n    item = await sink.get()\n    # checking for end-of-stream\n    if item == util.END_OF_STREAM:\n        break\n# once done, stop the task to avoid wasting resources\nawait api.stop_task(ack.randseq)\n\n```\n\n## Start a Remote API\n\nYou can start a remote API using the command below.\n\n```bash\npython -m streaminghub_datamux serve -H \"<host_name>\" -p <port> -r <rpc_name> -c <codec_name>\n```\n\n## For Developers\n\n```bash\n\n# clone streaminghub from git\ngit clone https://github.com/nirdslab/streaminghub.git\n\n# cd into streaminghub/ directory\ncd streaminghub/\n\n# install the streaminghub_datamux/ folder as a pip package\npython -m pip install -e streaminghub_datamux/\n\n```\n",
    "bugtrack_url": null,
    "license": "Copyright (c) 2024 Old Dominion University  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  This work shall be cited in the bibliography as:  Yasith Jayawardana, Vikas G. Ashok, and Sampath Jayarathna. 2022. StreamingHub: interactive stream analysis workflows. In Proceedings of the 22nd ACM/IEEE Joint Conference on Digital Libraries (JCDL '22). Association for Computing Machinery, New York, NY, USA, Article 15, 1-10. https://doi.org/10.1145/3529372.3530936  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A library to stream data into real-time analytics pipelines",
    "version": "0.1.8",
    "project_urls": {
        "homepage": "https://github.com/nirdslab/streaminghub/tree/master/datamux"
    },
    "split_keywords": [
        "dfds",
        " metadata",
        " parser"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e01b868275743353e438d09b8d8fd5396b08af4cefad5a6d27083adff55eeb45",
                "md5": "47aaa6422b80745ac561a6f5cb5c2048",
                "sha256": "3d4dd2cd0d8d4643b29bc9a66dbd59eb12e5960c15d72f830e1a1983ddecf26d"
            },
            "downloads": -1,
            "filename": "streaminghub_datamux-0.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "47aaa6422b80745ac561a6f5cb5c2048",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 26154,
            "upload_time": "2024-07-05T19:50:21",
            "upload_time_iso_8601": "2024-07-05T19:50:21.389846Z",
            "url": "https://files.pythonhosted.org/packages/e0/1b/868275743353e438d09b8d8fd5396b08af4cefad5a6d27083adff55eeb45/streaminghub_datamux-0.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "990b40ae8fb450062cd38d00da38a298ecc5aa5311c463bc2cdbf46e781c8f05",
                "md5": "d92dd5cf64fd7e3346632941065a8101",
                "sha256": "3740a30810828277ad5d7951f81eb709c4724bb6d6e199d077ac83b482f2344d"
            },
            "downloads": -1,
            "filename": "streaminghub_datamux-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "d92dd5cf64fd7e3346632941065a8101",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 21777,
            "upload_time": "2024-07-05T19:50:23",
            "upload_time_iso_8601": "2024-07-05T19:50:23.337665Z",
            "url": "https://files.pythonhosted.org/packages/99/0b/40ae8fb450062cd38d00da38a298ecc5aa5311c463bc2cdbf46e781c8f05/streaminghub_datamux-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-05 19:50:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nirdslab",
    "github_project": "streaminghub",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "streaminghub-datamux"
}
        
Elapsed time: 0.26269s