covalent icon indicating copy to clipboard operation
covalent copied to clipboard

Meaningful errors for non-lattice dispatches.

Open santoshkumarradha opened this issue 2 years ago • 4 comments

Consider this code

@ct.electron
def new_func(a, b, c, d, e):
    time.sleep(10)
    return a + b + c + d + e


@ct.electron
@ct.lattice
def work_func(a, b, c):
    return new_func(a, b, c, d=4, e=5)

dispatch_id = ct.dispatch(work_func)(5, 6, 7)
print(dispatch_id)

Running this will produce an error like this

Traceback (most recent call last):
  File "example_db.py", line 246, in <module>
    dispatch_id = ct.dispatch(lattice)(*args)
  File "/Users/scott/covalent/covalent/_dispatcher_plugins/local.py", line 83, in wrapper
    lattice.build_graph(*args, **kwargs)
AttributeError: 'function' object has no attribute 'build_graph'

I expect this is because I'm trying to dispatch a sublattice. If that's the case, we should have a check in the code that raises an informative error so users don't see the AttributeError.

Loosely related to #760

Originally posted by @scottwn in https://github.com/AgnostiqHQ/covalent/discussions/788

santoshkumarradha avatar Jul 06 '22 23:07 santoshkumarradha

Hi, I would like to on this one, you think. Can I give it a try?

gcamach0 avatar Jul 07 '22 09:07 gcamach0

Go for it @gcamach0! thanks!

scottwn avatar Jul 07 '22 12:07 scottwn

Thanks for reaching out @gcamach0 ! I have assigned this issue to you. Let me know if you have any questions and I will do my best to answer :)

AlejandroEsquivel avatar Jul 07 '22 17:07 AlejandroEsquivel

Thanks I'll let you know any updates

gcamach0 avatar Jul 07 '22 19:07 gcamach0

@wjcunningham7 can you assign this issue to me?

Aravind-psiog avatar Oct 31 '22 06:10 Aravind-psiog