daphne-eu / daphne

DAPHNE: An Open and Extensible System Infrastructure for Integrated Data Analysis Pipelines
Apache License 2.0
68 stars 62 forks source link

[DAPHNE-#717] handle daphne failure in daphne lib #808

Closed saminbassiri closed 2 months ago

saminbassiri commented 3 months ago

[DaphneLib-#717] handle daphne failure in daphne lib

Summary This PR closes issue #717 by handling execution errors in DaphneLib.

Changes:

pdamme commented 2 months ago

Here is an example for triggering a DAPHNE execution error from DaphneLib:

Contents of py-example.py:

from daphne.context.daphne_context import DaphneContext
dc = DaphneContext()
X = dc.seq(1, 3) + dc.seq(1, 2) # mismatching shapes
X.print().compute()

Output of ./run-python py-example.py:

Traceback (most recent call last):
  File "py-example.py", line 11, in <module>
    X.print().compute()
  File "/daphne/src/api/python/daphne/operator/operation_node.py", line 126, in compute
    self._script.execute()
  File "/daphne/src/api/python/daphne/script_building/script.py", line 106, in execute
    raise RuntimeError(f"Error in DaphneDSL script: {error_message}")
RuntimeError: Error in DaphneDSL script: Execution error: The kernel-function _ewAdd__DenseMatrix_int64_t__DenseMatrix_int64_t__DenseMatrix_int64_t failed during runtime with the following message [ EwBinaryMat(Dense) - lhs and rhs must either have the same dimensions, or one of them must be a row/column vector with the width/height of the other, but lhs has shape (3 x 1) and rhs has shape (2 x 1) ]
    | Source file -> "/tmp/DaphneLib/tmpdaphne.daphne":3:6
    | 
  3 | V2=V0 + V1;
    |       ^~~