Skip to content

Commit

Permalink
Set allow_module_overrides in AsyncDriver
Browse files Browse the repository at this point in the history
  • Loading branch information
rwhitten577 committed Nov 5, 2024
1 parent 62763b8 commit 0d3db5d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion hamilton/async_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ def __init__(
*modules,
result_builder: Optional[base.ResultMixin] = None,
adapters: typing.List[lifecycle.LifecycleAdapter] = None,
allow_module_overrides: bool = False,
):
"""Instantiates an asynchronous driver.
Expand All @@ -210,8 +211,12 @@ def __init__(
: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.
:param adapters: Adapters to use for lifecycle methods.
:param allow_module_overrides: Optional. Same named functions get overridden by later modules.
The order of listing the modules is important, since later ones will overwrite the previous ones.
This is a global call affecting all imported modules.
See https://github.com/DAGWorks-Inc/hamilton/tree/main/examples/module_overrides for more info.
"""
if adapters is None:
adapters = []
Expand Down Expand Up @@ -243,6 +248,7 @@ def __init__(
*sync_adapters,
*async_adapters, # note async adapters will not be called during synchronous execution -- this is for access later
],
allow_module_overrides=allow_module_overrides,
)
self.initialized = False

Expand Down Expand Up @@ -492,6 +498,7 @@ def build_without_init(self) -> AsyncDriver:
*self.modules,
adapters=self.adapters,
result_builder=specified_result_builder,
allow_module_overrides=self._allow_module_overrides,
)

async def build(self):
Expand Down

0 comments on commit 0d3db5d

Please sign in to comment.