How can I cache a task result based on task input arguments?

Prefect 2.0

You can set the cache_key_fn argument to task_input_hash.

from prefect import task
from prefect.tasks import task_input_hash

def my_task():

Prefect 1.0

Prefect 1.0 provides a cache_validator argument that can be set to all_inputs or partial_inputs_only.

from prefect import task

def my_task():

See also: