Skip to content

Commit

Permalink
Fixes regression in which adapters was none, instead of an empty list
Browse files Browse the repository at this point in the history
  • Loading branch information
elijahbenizzy committed Jun 27, 2024
1 parent a22f72c commit 2bf6aa1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions hamilton/async_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,20 @@ def __init__(
Note that this is not the desired API -- you should be using the :py:class:`hamilton.async_driver.Builder` class to create the driver.
This will only (currently) work properly with asynchronous lifecycle hooks, and does not support methods or validators.
You can still pass in synchronous lifecycle hooks, but they may behave strangely.
:param config: Config to build the graph
:param modules: Modules to crawl for fns/graph nodes
:param adapters: Adapters to use for lifecycle methods.
:param result_builder: Results mixin to compile the graph's final results. TBD whether this should be included in the long run.
"""
if adapters is not None:
sync_adapters, async_adapters = separate_sync_from_async(adapters)
else:
# separate out so we know what the driver
sync_adapters = []
async_adapters = []
if adapters is None:
adapters = []
sync_adapters, async_adapters = separate_sync_from_async(adapters)

# we'll need to use this in multiple contexts so we'll keep it around for later

result_builders = [adapter for adapter in adapters if isinstance(adapter, base.ResultMixin)]
if result_builder is not None:
result_builders.append(result_builder)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class CustomResultBuilder(base.ResultMixin):
),
(
async_driver.AsyncGraphAdapter(base.DictResult()),
"hamilton.experimental.async_driver.AsyncGraphAdapter",
"hamilton.async_driver.AsyncGraphAdapter",
),
(CustomAdapter(base.DictResult()), "custom_adapter"),
],
Expand Down

0 comments on commit 2bf6aa1

Please sign in to comment.