PrefectHQ
prefect
BlogDocsChangelog

Fix `AttributeError` for `functools.partial` hooks in `Runner`

#20136Merged
Comparing
devin/1767807561-fix-partial-hook-name
(
5b58bd2
) with
main
(
6645cd6
)
CodSpeed Performance Gauge
0%
Untouched
2
Ignored
6

Benchmarks

Passed

bench_task_decorator
benches/bench_tasks.py
CodSpeed Performance Gauge
0%
604.9 µs602.8 µs
bench_import_prefect_flow
benches/bench_import.py
CodSpeed Performance Gauge
0%
1.4 s1.4 s

Ignored

bench_flow_call[options1]
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
0%
107.8 ms107.7 ms
bench_task_submit
benches/bench_tasks.py
Ignored
CodSpeed Performance Gauge
-61%
7.6 ms19.7 ms
bench_flow_decorator
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
+6%
5.7 ms5.4 ms
bench_flow_call[options0]
benches/bench_flows.py
Ignored
CodSpeed Performance Gauge
-2%
161 ms164.7 ms
bench_import_prefect
benches/bench_import.py
Ignored
CodSpeed Performance Gauge
0%
1.1 s1.1 s
bench_task_call
benches/bench_tasks.py
Ignored
CodSpeed Performance Gauge
+7%
33.8 ms31.5 ms

Commits

Click on a commit to change the comparison range
Base
main
6645cd6
+0.17%
Fix AttributeError for functools.partial hooks in Runner Replace direct hook.__name__ access with get_hook_name() utility in _run_hooks function to properly handle functools.partial objects. The get_hook_name utility already exists in prefect.utilities._engine and handles partial objects by checking hook.func.__name__ when the hook is a functools.partial instance. This fix resolves the issue where on_cancellation and on_crashed hooks would fail with AttributeError when using functools.partial objects in flows served via Runner. Co-Authored-By: alex.s@prefect.io <ajstreed1@gmail.com>
5b58bd2
1 day ago
by devin-ai-integration[bot]
© 2026 CodSpeed Technology
Home Terms Privacy Docs