Skip to content

Commit

Permalink
Merge pull request #2750 from activeloopai/fy_tfm_err
Browse files Browse the repository at this point in the history
Better transform error propagation
  • Loading branch information
FayazRahman committed Jan 25, 2024
2 parents 858c5cb + f44bb1c commit ccd61a5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
6 changes: 5 additions & 1 deletion deeplake/core/transform/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,11 @@ def run(

for res in result["error"]:
if res is not None:
raise res
print(res["traceback"])
print(
"The above exception was the direct cause of the following exception:\n"
)
raise res["raise"]


def compose(functions: List[ComputeFunction]): # noqa: DAR101, DAR102, DAR201, DAR401
Expand Down
14 changes: 13 additions & 1 deletion deeplake/util/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
SampleAppendError,
)

import traceback
import posixpath
import time

Expand Down Expand Up @@ -393,7 +394,18 @@ def store_data_slice_with_pbar(pg_callback, transform_input: Tuple) -> Dict:
# retrieve relevant objects from memory
meta = _retrieve_memory_objects(all_chunk_engines)
meta.update(ret)
meta["error"] = err

err_dict: Optional[Dict[str, Any]] = None
if err:
err_dict = {}
err_dict["raise"] = err
cause = err.__cause__
if cause:
cause_traceback = "".join(
traceback.format_exception(cause.__class__, cause, cause.__traceback__) # type: ignore
)
err_dict["traceback"] = cause_traceback
meta["error"] = err_dict
return meta


Expand Down

0 comments on commit ccd61a5

Please sign in to comment.