Charles Leung
04/19/2023, 10:47 PMZanie
04/20/2023, 2:57 AMCharles Leung
04/20/2023, 5:16 PMfrom prefect import flow, task
from prefect_shell import ShellOperation
@task()
def secondary():
raise ValueError("Failed")
@task()
def primary():
print("This is the primary task")
return
@flow()
def main():
primary()
secondary()
if __name__ == "__main__":
main()
Zanie
04/20/2023, 5:21 PM@task(persist_result=True)
Charles Leung
04/20/2023, 9:51 PMfrom prefect import flow, task, logging, get_run_logger
from prefect_shell import ShellOperation
@task(persist_result=False)
def secondary():
logger = get_run_logger()
<http://logger.info|logger.info>("Secondary Task")
print("This is the secondary task")
raise ValueError("Failed")
return
@task(persist_result=False)
def primary():
logger = get_run_logger()
<http://logger.info|logger.info>("Primary Task")
print("This is the primary task")
@flow(persist_result=False)
def main():
primary()
secondary()
if __name__ == "__main__":
main()
In this scenario, I tried testing it with a deployment and expected "Primary Task" AND "Secondary Task" to be logged in the output on retry, since persist_result is False. But when I pressed retry in the deployment, i didnt get any of the logs even though i put persist_result=FalseZanie
04/20/2023, 10:25 PMDeceivious
04/21/2023, 8:20 AMCharles Leung
04/21/2023, 4:03 PMZanie
04/21/2023, 4:05 PMCharles Leung
04/21/2023, 4:56 PMZanie
04/21/2023, 5:22 PMCharles Leung
04/21/2023, 5:41 PMZanie
04/21/2023, 6:03 PMMissingResult
error when you access the result of the task — you can see this happening for primary-0 as it retries from the beginningCharles Leung
04/21/2023, 7:27 PM