Kyle Austin
03/16/2023, 5:31 PMfrom prefect import task, flow, get_run_logger
from logging import Logger
@task()
def pop_element_zero(ls: list, logger: Logger) -> list:
val = ls.pop(0)
<http://logger.info|logger.info>(f'Just popped {val} from the list {ls}')
return val
@flow()
def pop_task_flow():
logger = get_run_logger()
ls = [1,2,3]
while ls:
pop_element_zero(ls=ls, logger=logger)
if __name__ == "__main__":
pop_task_flow()
It makes sense (really good for making tasks retry-proof when the inputs are immutable objects). But I have some flows where I would like to not have this behavior. Is there a task decorator param that I am missing that would allow the user to let the task work directly on its inputs and not copies?Zanie
03/16/2023, 5:34 PMprefect.utilities.annotations.quote
utility we should not create a copypop_element_zero(ls=quote(ls))
Kyle Austin
03/16/2023, 5:40 PMZanie
03/16/2023, 5:41 PMKyle Austin
03/16/2023, 5:42 PM