Describe the bug
Not sure whether this is a bug or just our misunderstanding of how this is mean to work. When using the map function over a list of objects we expected the map method to only be executed once no matter how many times we iterate over the returned Stage object or how many times we convert it to a list as we do below.
Minimal code to reproduce
Small snippet that contains a minimal amount of code.
import pypeln as pl
from datetime import datetime
def map(count):
return {count, datetime.now()}
res = pl.task.map(map, [1,2])
print(res)
print(list(res))
print(list(res))
As you can see the datetime objects are being generated each time we build a list from the Stage object. Is that what is meant to happen?
Expected behavior
We expected the result to be cached within the Stage object and only run once. So we would expect the same result to be returned no matter how many times we translated the Stage into a list. The same thing happens if we iterate over the Stage object in a for loop.
Library Info
Please provide os info and elegy version.
Describe the bug Not sure whether this is a bug or just our misunderstanding of how this is mean to work. When using the map function over a list of objects we expected the map method to only be executed once no matter how many times we iterate over the returned Stage object or how many times we convert it to a list as we do below.
Minimal code to reproduce Small snippet that contains a minimal amount of code.
The output we get from the above is
As you can see the datetime objects are being generated each time we build a list from the Stage object. Is that what is meant to happen?
Expected behavior We expected the result to be cached within the Stage object and only run once. So we would expect the same result to be returned no matter how many times we translated the Stage into a list. The same thing happens if we iterate over the Stage object in a for loop.
Library Info Please provide os info and elegy version.
Pypeln version 0.4.9
Screenshots N/A
Additional context N/A