Skip to content

Commit

Permalink
Fix LRU cache bug with Ray
Browse files Browse the repository at this point in the history
For some reason, the ray actors were failing to properly import
the cython code in the lru-dict library. Kept giving the error
`AttributeError: type object 'LRU' has no attribute '__len__'`

Switching to pylru (pure python) fixed the issues
  • Loading branch information
Jeffrey Law committed Apr 3, 2024
1 parent a027627 commit 76c0688
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions rlmolecule/actors.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Any, List

import ray
from lru import LRU
from pylru import lrucache

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -32,7 +32,7 @@ class RayDictCache(DictCache):
@ray.remote
class RayLRUCache(DictCache):
def __init__(self, max_size: int = int(1e5)):
self._dict = LRU(max_size)
self._dict = lrucache(max_size)


@ray.remote
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ include_package_data = true
install_requires =
graphenv
tensorflow
lru-dict
pylru
rdkit
nfp

Expand Down

0 comments on commit 76c0688

Please sign in to comment.