tash lai
04/05/2021, 6:01 AMproduce stay in memory until the flow finishes, or will it be removed as soon as consume finishes?
@task
def produce(url):
return download_big_json(url)
@task
def consume(big_json):
do_something(big_json)
with Flow('my_flow') as flow:
urls = Parameter('urls')
produced = produce.map(urls)
consume.map(produced)Kevin Kho
del and/or gc.collect()). In your situation though, it seems like you can’t do this. You may have to store the results somewhere and pass the reference to downstream tasks or you can look at Results: https://docs.prefect.io/core/concepts/results.htmltash lai
04/06/2021, 5:41 AMproduce then consume will take big_json using Result.read instead of taking it from memory?tash lai
04/06/2021, 6:38 AMKevin Kho
Kevin Kho
tash lai
04/06/2021, 2:59 PMread and write methods return a Result instance with value attribute set to reference instead of an actual value. A little dirty but i think there shouldn't be problems with that.