Skip to main content

Shared memory object with redis and json files.

Project description

Redison : Redis + Json : Shared objects in memory using redis and json files

Getting Started

numpy

from redison import RedisObject
import numpy as np

array = np.random.rand(10)  # Set the object in python stack
print(array) # Retrieve the object from the stack
array = RedisObject(array)  # Set the object in redis
print(array.get())  # Retrieve the object from the redis database

multiproc

Processus 1

from redison import RedisObject
import numpy as np

while True:
    # Push array1
    RedisObject(id="array1", data=np.random.rand(10))

    # Pull array2
    array2 = RedisObject(id="array2")

    # Wait for array1 to be set in redis by proc2
    print(array2.get(blocking=True)) 

Processus 2

from redison import RedisObject
import numpy as np

while True:
    # Push array2
    RedisObject(id="array2", data=np.random.rand(10))

    # Pull array1
    array1 = RedisObject(id="array1")

    # Wait for array1 to be set in redis by proc1
    print(array1.get(blocking=True)) 

multiproc remote

Processus 1

from redison import RedisObject
import numpy as np

while True:
    # Create array2
    array1 = np.random.rand(10)

    # Push array2 
    RedisObject(id="array1",
                data=array1,
                host="10.1.0.2")

    # Pull array1
    array2 = RedisObject(id="array2", 
                         host="10.2.0.2")

    # Wait for array1 to be set on the remote machine 2
    print(array2.get(blocking=True)) 

Processus 2

from redison import RedisObject
import numpy as np

while True:
    # Create array2
    array2 = np.random.rand(10)

    # Push array2 
    RedisObject(id="array2",
                data=array2,
                host="10.2.0.2")

    # Pull array1
    array1 = RedisObject(id="array1", 
                         host="10.1.0.2")

    # Wait for array1 to be set on the remote machine 1
    print(array1.get(blocking=True)) 

Contributions

Email me at j.cadic@9dw-lab.com for any questions.

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 Distribution

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

redison-1.0a5-py36-none-any.whl (2.7 kB view details)

Uploaded Python 3.6

File details

Details for the file redison-1.0a5-py36-none-any.whl.

File metadata

  • Download URL: redison-1.0a5-py36-none-any.whl
  • Upload date:
  • Size: 2.7 kB
  • Tags: Python 3.6
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.6

File hashes

Hashes for redison-1.0a5-py36-none-any.whl
Algorithm Hash digest
SHA256 874da658a4c7803b8d94821304d5f772b1e94d5c97f39cded066c78ff3936ac4
MD5 94eb25b73084b1be089f5ea062b81896
BLAKE2b-256 3229a295080ac7825c11153971919c16b9b1bb5a305a44c73bc555424ababfe5

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