# Debugging Tools


# Functions

top-level functions:                                                                                                                                                       

prefect.utilities.debug.is_serializable

(obj, raise_on_error=False)[source]

Checks whether a given object can be registered with Prefect Cloud. This requires that the object can be serialized in the current process and deserialized in a fresh process.

Args:

  • obj (Any): the object to check
  • raise_on_error(bool, optional): if True, raises the CalledProcessError for inspection; the output attribute of this exception can contain useful information about why the object is not registrable
Returns:
  • bool: True if registrable, False otherwise
Raises:
  • subprocess.CalledProcessError: if raise_on_error=True and the object is not registrable

prefect.utilities.debug.raise_on_exception

()[source]

Context manager for raising exceptions when they occur instead of trapping them. Intended to be used only for local debugging and testing.

Example:

    from prefect import Flow, task
from prefect.utilities.debug import raise_on_exception

@task
def div(x):
return 1 / x

with Flow("My Flow") as f:
res = div(0)

with raise_on_exception():
f.run() # raises ZeroDivisionError


This documentation was auto-generated from commit n/a
on February 23, 2022 at 19:26 UTC