Functions
checkpoint​
Checkpoint a function call. If the function has already been called with the same arguments, it will return the result from the cache.Parameters
func(Callable[...,~T]) - The function to checkpointargs(Any) - The arguments to the functionidempotency_key(Any) - The extra key to change the function's idempotency, defaults to None Default:Nonekwargs(Any) - The keyword arguments to the function
Returns
T: The result of the function
make_deterministic​
Make an object deterministic by adding a checkpoint attribute to it. It's a no-op for primitive types and datetimes.Parameters
obj(Any) - The object to make idempotentkey_obj(Any) - The key object to generate the deterministic key for the object
Returns
Any: The object with the checkpoint
with_checkpoint​
Decorator to checkpoint a function call. If the function has already been called with the same arguments, it will return the result from the cache.Parameters
func(Optional[Callable[~P,~T]]) - The function to checkpoint Default:Noneidempotency_key(Any) - The extra key to change the function's idempotency, defaults to None Default:None
Returns
Callable[~P, ~T]Example
@with_checkpointdef func1(a: int, b: str) -> pd.DataFrame:return random.random()@with_checkpoint(idempotency_key=2)def func2(df: pd.DataFrame) -> int:return 1