temporian.save #
save(
fn: Callable[..., Dict[str, EventSetOrNode]],
path: str,
*args: Union[EventSetNode, EventSet, Schema],
**kwargs: Union[EventSetNode, EventSet, Schema]
) -> None
Saves a compiled Temporian function to a file.
The saved function must only take
EventSetOrNodes
as arguments, return a
dictionary of names to EventSetOrNodes, and be decorated with
@tp.compile
.
Temporian saves the graph built between the function's input and output nodes, not the function itself. Any arbitrary code that is executed in the function will not be ran when loading it back up and executing it.
If you need to save a function that additionally takes other types of
arguments, try using functools.partial
to create a new function that takes
only EventSetNodes, and save that instead. Note that the partial function
needs to be compiled too, with tp.compile(partial(...))
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fn |
Callable[..., Dict[str, EventSetOrNode]]
|
The function to save. |
required |
path |
str
|
The path to save the function to. |
required |
args |
Union[EventSetNode, EventSet, Schema]
|
Positional arguments to pass to the function to trace it. The arguments can be either EventSets, EventSetNodes, or raw Schemas. In all cases, the values will be converted to EventSetNodes before being passed to the function to trace it. |
()
|
kwargs |
Union[EventSetNode, EventSet, Schema]
|
Keyword arguments to pass to the function to trace it. Same
restrictions as for |
{}
|
Raises:
Type | Description |
---|---|
ValueError
|
If the received function is not compiled. |
ValueError
|
If any of the received inputs is not of the specified types. |
ValueError
|
If the function doesn't return the specified type. |