Skip to content

CachedDag.cache should be populated with inputs that it was called on #34

@thorwhalen

Description

@thorwhalen
from meshed import DAG
from meshed.scrap.cached_dag import CachedDag

def f(a, x=1):
    return a + x

def g(a, y=2):
    return a * y

dag = DAG([f, g])
dag.dot_digraph()

image

c = CachedDag(dag)
c('g', dict(a=1))
c.cache
# == {

c('f')  # doesn't work but should give me 2

Test

from meshed import DAG
from meshed.scrap.cached_dag import CachedDag

def f(a, x=1):
    return a + x

def g(a, y=2):
    return a * y

dag = DAG([f, g])

c = CachedDag(dag)
c('g', dict(a=1))
assert c.cache == {'g': 2, 'a': 1}
assert c('f') == 2

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions