Experimental standalone state storage service for crawlers at www.microprediction.org
Project description
microstate
Simple REST state storage tied to a write key
You need a key
from microstate import MicroStateWriter
write_key = MicroStateWriter.create_key(difficulty=11) # Takes a while!
to instantiate a writer
writer = 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:
writer.set(value=data)
Retrieve data:
data = writer.get()
Usage pattern 2 (using a logical memory location from 0 to 99)
Store data with a location index
writer.set(value=data, k=34)
Retrieve data with a location index
data = writer.get(k=34)
Other data types (caution!)
- Tuples will be converted to lists
- int, float to string
To preserve types use dict or list
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.2.0.tar.gz
(5.0 kB
view details)
Built Distribution
File details
Details for the file microstate-0.2.0.tar.gz
.
File metadata
- Download URL: microstate-0.2.0.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b7d94110df6ae3e81f3479544013a336623f81af1ad62dc7341f64ec0748fa0 |
|
MD5 | acedaf36c3b38b056710d9eced67178e |
|
BLAKE2b-256 | 762498f5098e3c6f6bce5c8eca7b5141f6f5f08dcd97f1ffbb7dbc1c0b1ef067 |
File details
Details for the file microstate-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: microstate-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.3 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fa972d80b26a6a22337752658af4db21a50a9acee256f5c1a56570eccdb55be |
|
MD5 | dc17f1e4c867fda49d139e471216d5e1 |
|
BLAKE2b-256 | dff063c9b47c02134f9c85944c5de46cb6828aca4df879d8a13f8186e6269f9b |