PREFECT_TASK_INTROSPECTION_WARN_THRESHOLD warning

When calculating the task parameter intropection time, Prefect took the run time of the dependent task into account. e.g. task1 takes 10 seconds to run, and task2 depends on task1, so the task intropection time is greater than 10, triggering the warning.
Minimum code to trigger the issue: `from prefect import flow, task

@task
def my_task():
import time
time.sleep(10)

@flow
def my_flow():
res1 = my_task.submit()
res2 = my_task.submit(wait_for=[res1])

if name == ‘main’:
my_flow()`
The problem originates from orchestrate_task_run function in prefect/engine.py

1 Like

I believe we are seeing the same issue. Also, we get this warning for each subsequent task and the time in the message is always increasing.

Task parameter introspection took 109.896 seconds , exceeding PREFECT_TASK_INTROSPECTION_WARN_THRESHOLD of 10.0. Try wrapping large task parameters with prefect.utilities.annotations.quote for increased performance, e.g. my_task(quote(param)). To disable this message set PREFECT_TASK_INTROSPECTION_WARN_THRESHOLD=0.
Task parameter introspection took 132.399 seconds , exceeding PREFECT_TASK_INTROSPECTION_WARN_THRESHOLD of 10.0. Try wrapping large task parameters with prefect.utilities.annotations.quote for increased performance, e.g. my_task(quote(param)). To disable this message set PREFECT_TASK_INTROSPECTION_WARN_THRESHOLD=0.
Task parameter introspection took 162.429 seconds , exceeding PREFECT_TASK_INTROSPECTION_WARN_THRESHOLD of 10.0. Try wrapping large task parameters with prefect.utilities.annotations.quote for increased performance, e.g. my_task(quote(param)). To disable this message set PREFECT_TASK_INTROSPECTION_WARN_THRESHOLD=0.