Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclear API error when internet is down. #3

Open
albireox opened this issue Apr 26, 2017 · 0 comments
Open

Unclear API error when internet is down. #3

albireox opened this issue Apr 26, 2017 · 0 comments

Comments

@albireox
Copy link
Member

A student got this error while trying to run a relatively simple query. The problem ended being that her connection was stale. So, not really a "bug", but it would be good if we could provide a clearer error in this case.

Hi Jose. Here's the error. 

WARNING: No local database found. Cannot perform queries.
WARNING: local mode failed. Trying remote now.
Your parsed filter is: 
nsa.z<0.02
---------------------------------------------------------------------------
gaierror                                  Traceback (most recent call last)
/home/christina/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connection.py in _new_conn(self)
    140             conn = connection.create_connection(
--> 141                 (self.host, self.port), self.timeout, **extra_kw)
    142 

/home/christina/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options)
     59 
---> 60     for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
     61         af, socktype, proto, canonname, sa = res

/home/christina/anaconda3/lib/python3.6/socket.py in getaddrinfo(host, port, family, type, proto, flags)
    742     addrlist = []
--> 743     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
    744         af, socktype, proto, canonname, sa = res

gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

NewConnectionError                        Traceback (most recent call last)
/home/christina/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
    599                                                   body=body, headers=headers,
--> 600                                                   chunked=chunked)
    601 

/home/christina/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    344         try:
--> 345             self._validate_conn(conn)
    346         except (SocketTimeout, BaseSSLError) as e:

/home/christina/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py in _validate_conn(self, conn)
    843         if not getattr(conn, 'sock', None):  # AppEngine might not have  `.sock`
--> 844             conn.connect()
    845 

/home/christina/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connection.py in connect(self)
    283         # Add certificate verification
--> 284         conn = self._new_conn()
    285 

/home/christina/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connection.py in _new_conn(self)
    149             raise NewConnectionError(
--> 150                 self, "Failed to establish a new connection: %s" % e)
    151 

NewConnectionError: <requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fa05c0a60b8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

MaxRetryError                             Traceback (most recent call last)
/home/christina/anaconda3/lib/python3.6/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    422                     retries=self.max_retries,
--> 423                     timeout=timeout
    424                 )

/home/christina/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
    648             retries = retries.increment(method, url, error=e, _pool=self,
--> 649                                         _stacktrace=sys.exc_info()[2])
    650             retries.sleep()

/home/christina/anaconda3/lib/python3.6/site-packages/requests/packages/urllib3/util/retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
    375         if new_retry.is_exhausted():
--> 376             raise MaxRetryError(_pool, url, error or ResponseError(cause))
    377 

MaxRetryError: HTTPSConnectionPool(host='api.sdss.org', port=443): Max retries exceeded with url: /marvin2/api/query/cubes/ (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fa05c0a60b8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))

During handling of the above exception, another exception occurred:

ConnectionError                           Traceback (most recent call last)
/home/christina/anaconda3/lib/python3.6/site-packages/marvin/extern/marvin_brain/python/brain/api/api.py in _sendRequest(self, request_type)
    143             elif request_type == 'post':
--> 144                 self._response = self.session.post(self.url, data=self.params, timeout=self.timeout)
    145         except requests.Timeout as rt:

/home/christina/anaconda3/lib/python3.6/site-packages/requests/sessions.py in post(self, url, data, json, **kwargs)
    534 
--> 535         return self.request('POST', url, data=data, json=json, **kwargs)
    536 

/home/christina/anaconda3/lib/python3.6/site-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
    487         send_kwargs.update(settings)
--> 488         resp = self.send(prep, **send_kwargs)
    489 

/home/christina/anaconda3/lib/python3.6/site-packages/raven/breadcrumbs.py in send(self, request, *args, **kwargs)
    296         try:
--> 297             resp = real_send(self, request, *args, **kwargs)
    298         except Exception:

/home/christina/anaconda3/lib/python3.6/site-packages/requests/sessions.py in send(self, request, **kwargs)
    608         # Send the request
--> 609         r = adapter.send(request, **kwargs)
    610 

/home/christina/anaconda3/lib/python3.6/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    486 
--> 487             raise ConnectionError(e, request=request)
    488 

ConnectionError: HTTPSConnectionPool(host='api.sdss.org', port=443): Max retries exceeded with url: /marvin2/api/query/cubes/ (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fa05c0a60b8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))

During handling of the above exception, another exception occurred:

BrainError                                Traceback (most recent call last)
/home/christina/anaconda3/lib/python3.6/site-packages/marvin/tools/query/query.py in run(self, qmode)
    785             try:
--> 786                 ii = Interaction(route=url, params=params)
    787             except Exception as e:

/home/christina/anaconda3/lib/python3.6/site-packages/marvin/extern/marvin_brain/python/brain/api/api.py in __init__(self, route, params, request_type, auth, timeout)
     41         if self.url:
---> 42             self._sendRequest(request_type)
     43         else:

/home/christina/anaconda3/lib/python3.6/site-packages/marvin/extern/marvin_brain/python/brain/api/api.py in _sendRequest(self, request_type)
    152             self._closeRequestSession()
--> 153             raise BrainError('Requests Connection Error: {0}'.format(con))
    154         except requests.RequestException as req:

BrainError: Requests Connection Error: HTTPSConnectionPool(host='api.sdss.org', port=443): Max retries exceeded with url: /marvin2/api/query/cubes/ (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fa05c0a60b8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))

During handling of the above exception, another exception occurred:

MarvinError                               Traceback (most recent call last)
<ipython-input-22-e2f1fa1db4d4> in <module>()
      8 #set up the query so that it can be run
      9 q = Query(searchfilter = filter, returnparams = params)
---> 10 r = q.run()

/home/christina/anaconda3/lib/python3.6/site-packages/marvin/tools/query/query.py in wrapper(self, *args, **kwargs)
     94         if not self.query and self.mode == 'local':
     95             self._createBaseQuery()
---> 96         return f(self, *args, **kwargs)
     97     return wrapper
     98 

/home/christina/anaconda3/lib/python3.6/site-packages/marvin/tools/query/query.py in wrapper(self, *args, **kwargs)
    106         if self.mode == 'local' and self.filterparams and not self._alreadyInFilter(self.filterparams.keys()):
    107             self.add_condition()
--> 108         return f(self, *args, **kwargs)
    109 
    110     return wrapper

/home/christina/anaconda3/lib/python3.6/site-packages/marvin/tools/query/query.py in wrapper(self, *args, **kwargs)
     82         if self.query and self.mode == 'local':
     83             self.query = self.query.params({'drpver': self._drpver, 'dapver': self._dapver})
---> 84         return f(self, *args, **kwargs)
     85     return wrapper
     86 

/home/christina/anaconda3/lib/python3.6/site-packages/marvin/tools/query/query.py in run(self, qmode)
    788                 # if a remote query fails for any reason, then try to clean them up
    789                 # self._cleanUpQueries()
--> 790                 raise MarvinError('API Query call failed: {0}'.format(e))
    791             else:
    792                 res = ii.getData()

MarvinError: API Query call failed: Requests Connection Error: HTTPSConnectionPool(host='api.sdss.org', port=443): Max retries exceeded with url: /marvin2/api/query/cubes/ (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fa05c0a60b8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)).
You can submit this error to Marvin GitHub Issues (https://github.com/sdss/marvin/issues/new).
Fill out a subject and some text describing the error that just occurred.
If able, copy and paste the full traceback information into the issue as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant