brain-plasma

Shared-memory Python object namespace with Apache Plasma. Built because of Plotly Dash, useful anywhere.

MIT License

Downloads
141
Stars
82
Committers
2
brain-plasma - Semantic bump Latest Release

Published by russellromney about 4 years ago

brain-plasma - Semantic bump

Published by russellromney about 4 years ago

Bumps previously released v0.3.1 for PyPi to use a file with a new name.

brain-plasma - BrainClient fix

Published by russellromney about 4 years ago

Wrong, untested code released in v0.3. Incomplete git add. This fixes that and stabilizes the package.

brain-plasma - Hashing speedup and unit tests

Published by russellromney about 4 years ago

Summary

This release is the biggest release yet in the path to production usefulness outside of a few large objects. brain_plasma.Brain is mostly rewritten and entirely refactored; it now hashes names for direct access to speed up read and write operations by several orders of magnitude due to fewer and more lightweight calls. The API is mostly the same. Custom exceptions are added to help users catch and understand errors better. Most functions are unit tested and can be checked with pytest.

The sum of these changes means brain-plasma can be used as a fast production backend similar to Redis, but with fast support for very large values as well as for very small values, and for few as well as many values. I'm pretty excited about it.

Hashing speedup

Speedup results are drastic, especially when there are more than a dozen or so names in the store. This is because the old Brain called client.list() multiple times for a most Brain interactions. This was admittedly a horrible design that should never have existed. The new Brain doesn't call client.list() at all for most operations including all reads and writes. The script many_vals.py compares the old with the new Brains:

plasma_store -m 10000000 -s /tmp/plasma
# new terminal
python many_vals.py
>>>
100 items:
    learn:
        old: 3.6606647968292236
        hash: 0.030955076217651367
    recall:
        old: 4.092543840408325
        hash: 0.017110824584960938
 10 items:
    learn:
        old: 0.32016992568969727
        hash: 0.005012035369873047
    recall:
        old: 0.31406521797180176
        hash: 0.002324819564819336

Unit tests

Most functions are tested in tests/. Check yourself or test your changes with:

pip install pytest
pytest

Exceptions

Custom exceptions are added to help users catch and understand errors better. Most types of errors that are unique to the functions rather than to Python errors are defined as custom exceptions. Function docstrings mention which exceptions which may be caught. New exceptions are imported en masse like:

from brain_plasma.exceptions import (
    BrainNameNotExistError,
    BrainNamespaceNameError,
    BrainNamespaceNotExistError,
    BrainNamespaceRemoveDefaultError,
    BrainNameLengthError,
    BrainNameTypeError,
    BrainClientDisconnectedError,
    BrainRemoveOldNameValueError,
    BrainLearnNameError,
    BrainUpdateNameError,
)

Other

Code is formatted with the excellent black. Markdown is formatted with Prettier.

brain-plasma - More stable - implemented namespaces, removed plasma instance interaction

Published by russellromney about 5 years ago

BIG RELEASE WITH BREAKING CHANGES: v0.2

  • changed parameter order of learn() to ('name',thing) which is more intuitive (but you should always use bracket notation)
  • removed ability to start, kill, or resize the underlying brain instance (stability)
  • added unique intra-plasma-instance namespaces
  • len(brain), del brain['this'] and 'this' in brain are now avilable (implemented __len__, __delitem__, and __contains__)
  • improved the documentation i.e. README

NOTE: stability problems should be resolved in v0.2.

brain-plasma - brain-plasma v0.1.4 - getting better

Published by russellromney over 5 years ago

PyPi setup was wrong; fixed so it works all the time.

brain.resize() no longer lets you try to resize to a smaller size than your data before deleting all your current data, i.e. #7

brain-plasma - v0.1.3 - package name fix

Published by russellromney over 5 years ago

Packages were not accessible due to an incorrect package setup structure. Fixed.

brain-plasma - brain-plasma v0.1.2

Published by russellromney over 5 years ago

brain-plasma v0.1.2 a.k.a "More Features"

features

object_map(), used(), free(), resize(), bytes, size(), etc.
A more robust API.

BREAKING CHANGES:

brain.size is now brain.size() - a dynamically updated function.

brain-plasma - brain-plasma v0.1.1

Published by russellromney over 5 years ago

Added ability to learn and recall using bracket notation, via PR #1 from @tcbegley

Removed a bug preventing user from reassigning values to a name.

Added ability to start up plasma_store in instantiation of Brain.

Overall - core functionality is more stable and you don't need to start up other stuff beforehand in the command line to use brain-plasma.

brain-plasma - brain-plasma v0.1

Published by russellromney over 5 years ago

The first release of brain-plasma.

Package Rankings
Top 15.27% on Pypi.org
Related Projects