1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
from parsl.app.app import python_app
@python_app(cache=True, ignore_for_cache=[])
def random_uuid(x):
import uuid
return str(uuid.uuid4())
@python_app(cache=True, ignore_for_cache=['x'])
def random_uuid_def(x):
import uuid
return str(uuid.uuid4())
def test_memo_different():
# explicitly call result() before launching next app so that
# the executions are serialized and the x result will be in
# memo table
x = random_uuid(x=0).result()
y = random_uuid(x=1).result()
assert x != y, "Memoized results were used incorrectly"
def test_memo_same_at_definition():
x = random_uuid_def(x=0).result()
y = random_uuid_def(x=1).result()
assert x == y, "Memoized results were not used"
|