heavyai/rbc

Calling omnisci decorated function fails with cryptic error message

pearu opened this issue · 0 comments

pearu commented

Consider:

>>> from rbc.omniscidb import RemoteOmnisci
>>> omni = RemoteOmnisci()
>>> @omni('double(double)')
... def farenheight2celcius(f):
...     return (f - 32)* 5 / 9
... 
>>> _, r=omni.sql_execute('select farenheight2celcius(40)')
>>> print(list(r))
[(4.444444444444445,)]
>>> farenheight2celcius(40)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pearu/git/xnd-project/rbc/rbc/remotejit.py", line 365, in __call__
    raise TypeError(
TypeError: specifying device is required when target has more than one device. Available devices: cpu, gpu

While calling a omnisci decorated function from Python is supposed to fail, users of rbc will likely still try to call the omnisci decorated functions from Python. The exception message should explain why it fails and what is the correct way to call the corresponding SQL operator in a query to omniscidb server.