hi! I have a Task that is querying a slow API (10K...
# prefect-community
j
hi! I have a Task that is querying a slow API (10K times). I want to checkpoint this task each iteration (disk is okay), but struggling with how to template the
location
since the task argument is what makes the task unique, but that’s not available to the context object as far as I can tell. Am I missing something obvious for this use case?
c
Hi Josh! Task inputs are also available for location templating, e.g.,
Copy code
@task(result=LocalResult(location="~/task-results/{param}.bytes"))
def my_task(param):
    return stuff
You’ll just need to make sure that the inputs play nicely with filepaths when they are converted to strings
j
Thanks chris, worked great. I didn’t see that in the docs!
c
Awesome! Yea it’s a little tough to find right now but here’s a page for your future reference: https://docs.prefect.io/core/concepts/templating.html#where-can-i-use-templating