https://prefect.io logo
p

Pedro Machado

10/02/2020, 3:23 AM
Is it possible to set the
dir
for a
LocalResult
at run time? I am setting it based on a context variable but it seems to be getting the value of the variable at registration time.
Copy code
@task(
    target="ftp_{start_date}_{end_date}.done",
    result=LocalResult(dir=prefect.context.local_results_dir),
)
def mytask(start_date, end_date):
    pass
c

Chris White

10/02/2020, 5:12 AM
Hi Pedro, yes you can achieve this by: 1) setting dir = None 2.) using an absolute path in your target (which can be templated with variables from context)
p

Pedro Machado

10/02/2020, 5:33 AM
Great thanks!
3 Views