heavyai/rbc

`Caller.describe` fails with `RemoteOmnisci` when there is no connection

Opened this issue · 0 comments

tupui commented

The following fails if there is no connection to a DB.

If should fail back to, say, local CPU target, or something sensible that reminds the expected output of describe (which would be a LLVM IR string and a note/warning that it may not correspond to the actual result when the target info cannot be retrieved from the server).

from rbc.omniscidb import RemoteOmnisci

omni = RemoteOmnisci()
def farenheight2celcius(f):
    return (f - 32)* 5 / 9

caller = omni('double(double)')(farenheight2celcius)
caller.describe()
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/mambaforge/base/envs/rbc-dev/lib/python3.9/site-packages/thriftpy2/transport/socket.py", line 96, in open
    self.sock.connect(addr)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/mambaforge/base/envs/rbc-dev/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3251, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-4-aad08ddc3c82>", line 1, in <module>
    a.describe()
  File "/Users/tupui/Documents/Quansight/Projects/Omnisci/rbc/rbc/remotejit.py", line 334, in describe
    for device, target_info in self.remotejit.targets.items():
  File "/Users/tupui/Documents/Quansight/Projects/Omnisci/rbc/rbc/remotejit.py", line 576, in targets
    self._targets = self.retrieve_targets()
  File "/Users/tupui/Documents/Quansight/Projects/Omnisci/rbc/rbc/omniscidb.py", line 753, in retrieve_targets
    self.session_id)
  File "/Users/tupui/Documents/Quansight/Projects/Omnisci/rbc/rbc/omniscidb.py", line 313, in session_id
    self._session_id = self.thrift_call('connect', user, pw, dbname)
  File "/Users/tupui/Documents/Quansight/Projects/Omnisci/rbc/rbc/omniscidb.py", line 356, in thrift_call
    return client(Omnisci={name: args})['Omnisci'][name]
  File "/Users/tupui/Documents/Quansight/Projects/Omnisci/rbc/rbc/thrift/client.py", line 197, in __call__
    with ctx as c:
  File "/opt/homebrew/Caskroom/mambaforge/base/envs/rbc-dev/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/opt/homebrew/Caskroom/mambaforge/base/envs/rbc-dev/lib/python3.9/site-packages/thriftpy2/rpc.py", line 129, in client_context
    transport.open()
  File "thriftpy2/transport/buffered/cybuffered.pyx", line 34, in thriftpy2.transport.buffered.cybuffered.TCyBufferedTransport.open
  File "/opt/homebrew/Caskroom/mambaforge/base/envs/rbc-dev/lib/python3.9/site-packages/thriftpy2/transport/socket.py", line 103, in open
    raise TTransportException(
thriftpy2.transport.base.TTransportException: TTransportException(type=1, message="Could not connect to ('192.168.8.117', 6274)")