prefect.utilities
hashing
prefect.utilities.hashing
Functions
stable_hash
Given some arguments, produces a stable 64-bit hash of their contents.
Supports bytes and strings. Strings will be UTF-8 encoded.
Args:
*args
: Items to include in the hash.hash_algo
: Hash algorithm from hashlib to use.
Returns:
- A hex hash.
file_hash
Given a path to a file, produces a stable hash of the file contents.
Args:
path
: the path to a filehash_algo
: Hash algorithm from hashlib to use.
Returns:
- a hash of the file contents
hash_objects
Attempt to hash objects by dumping to JSON or serializing with cloudpickle.
Args:
*args
: Positional arguments to hashhash_algo
: Hash algorithm to useraise_on_failure
: If True, raise exceptions instead of returning None**kwargs
: Keyword arguments to hash
Returns:
- A hash string or None if hashing failed
Raises:
HashError
: If objects cannot be hashed and raise_on_failure is True