lifecycle.api.GraphConstructionHook#

class hamilton.lifecycle.api.GraphConstructionHook#

Hook that is run after graph construction. This allows you to register/capture info on the graph. Note that, in the case of materialization, this may be called multiple times (once when we create the graph, once when we materialize). Currently information into that is not exposed to the user, but we will be adding that in future iterations.

post_graph_construct(*, graph: FunctionGraph, modules: List[module], config: Dict[str, Any])#

Hooks that is called after the graph is constructed.

Parameters:
  • graph – Graph that has been constructed.

  • modules – Modules passed into the graph

  • config – Config passed into the graph

abstract run_after_graph_construction(*, graph: HamiltonGraph, config: Dict[str, Any], **future_kwargs: Any)#

Hook that is run post graph construction. This allows you to register/capture info on the graph. A common pattern is to store something in your object’s state here so that you can use it later (E.G. compute a hash on the graph)

Parameters:
  • graph – Graph that was constructed

  • config – Configuration used to construct the graph

  • future_kwargs – Reserved for backwards compatibility.