Skip to main content

The Wrapped Exchange Array is a convenient way in order to exchange array data easily via processes or remote nodes

Project description

wea.py

The Wrapped Exchange Array is a convenient way in order to exchange array data easily via processes or remote nodes. Inspired and adopted partly from Julia’s InterProcessCommunication WrappedArray.

The wrapped exchange array can be accessed like a numpy array because under the hood, numpy is applied.

Getting started

Install the package from Pypi

pip install wea

Shared memory

import wea
import numpy as np

...
wa = wea.shared_memory.create_wrapped_array('/awesome-1', np.dtype('float64'), (10, 2))
wa[:] = my_new_data[:]
...

Creating a shared memory segement

In order to create a new shared memory segment, use the following snippet

import wea
import numpy as np

type = np.dtype('float64')
dims = (10, 2)
wa = wea.shared_memory.create_wrapped_array('/awesome-1', type, dims)
wa[:] = np.random.randn(dims[0], dims[1])

If creating was not possible because the segment already exists , a FileExistsError exception will be thrown.

Attaching to an existing shared memory array

If a wrapped exchange array was already created, you can attach to it simply by

import wea
import numpy as np

wa = wea.shared_memory.attach_wrapped_array('/awesome-1')
wa[:] = np.random.randn(dims[0], dims[1])

The metadata of the array are stored in the shared memory header segment and will be retrieved for the numpy array creation.

If attaching was not possible because the segment does not exist so far, a FileNotFoundError exception will be thrown.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

wea-0.1.1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

wea-0.1.1-py2.py3-none-any.whl (7.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file wea-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: wea-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.8.5

File hashes

Hashes for wea-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fada423e536d7c0c4e770a55acc3b290ac6dc0627c16af82a3d74148e362e61e
MD5 79a49f0815a95272cc2c09503b6a3e34
BLAKE2b-256 8aa7038c94dada276b032b82be40ab1f09cef09d95283b70442e99e4c5d2a3bd

See more details on using hashes here.

File details

Details for the file wea-0.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: wea-0.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.8.5

File hashes

Hashes for wea-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e3e020e2cb4feda1a58fab8e23989e907e4233d8916573aa21fb134718dd79cd
MD5 420949fcab46bb2aebac511eb12ccd64
BLAKE2b-256 78b6a04e9b49e1a889c6cba77143a7acad217e660f553f7301f321aa0ac1320f

See more details on using hashes here.

Supported by

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