Skip to main content

Experimental standalone state storage service for crawlers at www.microprediction.org

Project description

microstate

Simple REST state storage tied to a write key

Creating a state writer

from microstate import MicroStateWriter
from microprediction import new_key
write_key = new_key(difficulty=11) # Takes a while! 
msw = MicroStateWriter(write_key=write_key)

Usage pattern 1

Assume we have data taking the form of a dictionary

data = {'age':17,'model':'my model','params':{'mean':17,'std':10}

Store data:

msw.set(value=data)

Retrieve data:

data = msw.get()     

Usage pattern 2 (using a logical memory location from 0 to 99)

Store data with a location index

msw.set(value=data, k=34)

Retrieve data with a location index

data = msw.get(k=34) 

Other data types

In addition to dict, or list, data may be str, int or float. However it will be stored internally as a binary string. Be aware of this when retrieving the data.

Partial support for tuple

Tuples can be stored but will be converted to list.

Memory limits

Assuming a write key of difficulty at least 11:

location  0      holds    320 kb
locations 1-319  hold       1 kb each 

Project details


Download files

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

Source Distribution

microstate-0.0.7.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

microstate-0.0.7-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file microstate-0.0.7.tar.gz.

File metadata

  • Download URL: microstate-0.0.7.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for microstate-0.0.7.tar.gz
Algorithm Hash digest
SHA256 23503f92383eb36e3f2dc53e3f52280aba7409dd48ef553410b032f4fadf2705
MD5 36f69b5e310ce72d1c5aec158eaf4e07
BLAKE2b-256 b9273967072a8cc8eee94162951483ddcdc10091fdc276c7a6e4bb8ed59df627

See more details on using hashes here.

File details

Details for the file microstate-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: microstate-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for microstate-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 2f9727b28604c20bdd28deceacf34260e0afa94e8c86e4803ed9b7b21d3d1a88
MD5 657bcc39b94556440e3bcda47f477bd6
BLAKE2b-256 ee143dd9612404eabf2ecf6d97e86fe3f41b5e1d0342ca630166f22258657bec

See more details on using hashes here.

Supported by

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