Skip to main content
Version: Beta 🚧

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 checkpoint

  • args (Any) - The arguments to the function

  • idempotency_key (Any) - The extra key to change the function's idempotency, defaults to None Default: None

  • kwargs (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 idempotent

  • key_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: None

  • idempotency_key (Any) - The extra key to change the function's idempotency, defaults to None Default: None

Returns

Callable[~P, ~T]

Example

@with_checkpoint
def func1(a: int, b: str) -> pd.DataFrame:
return random.random()
@with_checkpoint(idempotency_key=2)
def func2(df: pd.DataFrame) -> int:
return 1

Was this page helpful?