ibis ConnectionError :(“连接已中止。”,RemoteDisconnected(“远端封闭的无响应的连接”,))

时间:2018-10-25 17:12:20

标签: python pandas impala impyla ibis

我将Ibis连接到黑斑羚时遇到问题。

我可以查询和检索信息,并用熊猫对其进行转换,没有任何问题,但是当我尝试从熊猫数据框创建表格时,出现以下错误:

ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed 
connection without response',)

还定义了hdfs_client,我具有写和读的写权限。

完整的完整代码如下:

---------------------------------------------------------------------------
RemoteDisconnected                        Traceback (most recent call last)
C:\anaconda\lib\site-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 

C:\anaconda\lib\site-packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    383                     # otherwise it looks like a programming error was the cause.
--> 384                     six.raise_from(e, None)
    385         except (SocketTimeout, BaseSSLError, SocketError) as e:

C:\anaconda\lib\site-packages\urllib3\packages\six.py in raise_from(value, from_value)

C:\anaconda\lib\site-packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    379                 try:
--> 380                     httplib_response = conn.getresponse()
    381                 except Exception as e:

C:\anaconda\lib\http\client.py in getresponse(self)
   1330             try:
-> 1331                 response.begin()
   1332             except ConnectionError:

C:\anaconda\lib\http\client.py in begin(self)
    296         while True:
--> 297             version, status, reason = self._read_status()
    298             if status != CONTINUE:

C:\anaconda\lib\http\client.py in _read_status(self)
    265             # sending a valid response.
--> 266             raise RemoteDisconnected("Remote end closed connection without"
    267                                      " response")

RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

ProtocolError                             Traceback (most recent call last)
C:\anaconda\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    448                     retries=self.max_retries,
--> 449                     timeout=timeout
    450                 )

C:\anaconda\lib\site-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)
    637             retries = retries.increment(method, url, error=e, _pool=self,
--> 638                                         _stacktrace=sys.exc_info()[2])
    639             retries.sleep()

C:\anaconda\lib\site-packages\urllib3\util\retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
    366             if read is False or not self._is_method_retryable(method):
--> 367                 raise six.reraise(type(error), error, _stacktrace)
    368             elif read is not None:

C:\anaconda\lib\site-packages\urllib3\packages\six.py in reraise(tp, value, tb)
    684         if value.__traceback__ is not tb:
--> 685             raise value.with_traceback(tb)
    686         raise value

C:\anaconda\lib\site-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 

C:\anaconda\lib\site-packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    383                     # otherwise it looks like a programming error was the cause.
--> 384                     six.raise_from(e, None)
    385         except (SocketTimeout, BaseSSLError, SocketError) as e:

C:\anaconda\lib\site-packages\urllib3\packages\six.py in raise_from(value, from_value)

C:\anaconda\lib\site-packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    379                 try:
--> 380                     httplib_response = conn.getresponse()
    381                 except Exception as e:

C:\anaconda\lib\http\client.py in getresponse(self)
   1330             try:
-> 1331                 response.begin()
   1332             except ConnectionError:

C:\anaconda\lib\http\client.py in begin(self)
    296         while True:
--> 297             version, status, reason = self._read_status()
    298             if status != CONTINUE:

C:\anaconda\lib\http\client.py in _read_status(self)
    265             # sending a valid response.
--> 266             raise RemoteDisconnected("Remote end closed connection without"
    267                                      " response")

ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

During handling of the above exception, another exception occurred:

ConnectionError                           Traceback (most recent call last)
<ipython-input-10-1f842e026e2e> in <module>()
----> 1 client.create_table('test',files)

C:\anaconda\lib\site-packages\ibis\impala\client.py in create_table(self, table_name, obj, schema, database, external, force, format, location, partition, like_parquet)
   1105             if isinstance(obj, pd.DataFrame):
   1106                 from ibis.impala.pandas_interop import write_temp_dataframe
-> 1107                 writer, to_insert = write_temp_dataframe(self, obj)
   1108             else:
   1109                 to_insert = obj

C:\anaconda\lib\site-packages\ibis\impala\pandas_interop.py in write_temp_dataframe(client, df)
    115 def write_temp_dataframe(client, df):
    116     writer = DataFrameWriter(client, df)
--> 117     path = writer.write_temp_csv()
    118     return writer, writer.delimited_table(path)

C:\anaconda\lib\site-packages\ibis\impala\pandas_interop.py in write_temp_csv(self)
     40         temp_hdfs_dir = pjoin(options.impala.temp_hdfs_path,
     41                               'pandas_{0}'.format(util.guid()))
---> 42         self.hdfs.mkdir(temp_hdfs_dir)
     43 
     44         # Keep track of the temporary HDFS file

C:\anaconda\lib\site-packages\ibis\filesystems.py in mkdir(self, dir_path)
    281     @implements(HDFS.mkdir)
    282     def mkdir(self, dir_path):
--> 283         self.client.makedirs(dir_path)
    284 
    285     @implements(HDFS.size)

C:\anaconda\lib\site-packages\hdfs\client.py in makedirs(self, hdfs_path, permission)
    952     """
    953     _logger.info('Creating directories to %r.', hdfs_path)
--> 954     self._mkdirs(hdfs_path, permission=permission)
    955 
    956   def checksum(self, hdfs_path):

C:\anaconda\lib\site-packages\hdfs\client.py in api_handler(client, hdfs_path, data, strict, **params)
    116             if len(client._urls) > 1:
    117               _logger.warning('No reachable host, raising last error.')
--> 118             raise err
    119 
    120     api_handler.__name__ = '%s_handler' % (operation.lower(), )

C:\anaconda\lib\site-packages\hdfs\client.py in api_handler(client, hdfs_path, data, strict, **params)
    105             params=params,
    106             strict=strict,
--> 107             **self.kwargs
    108           )
    109         except (rq.exceptions.ReadTimeout, rq.exceptions.ConnectTimeout,

C:\anaconda\lib\site-packages\hdfs\client.py in _request(self, method, url, strict, **kwargs)
    205       timeout=self._timeout,
    206       headers={'content-type': 'application/octet-stream'}, # For HttpFS.
--> 207       **kwargs
    208     )
    209     if strict and not response: # Non 2XX status code.

C:\anaconda\lib\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)
    522         }
    523         send_kwargs.update(settings)
--> 524         resp = self.send(prep, **send_kwargs)
    525 
    526         return resp

C:\anaconda\lib\site-packages\requests\sessions.py in send(self, request, **kwargs)
    635 
    636         # Send the request
--> 637         r = adapter.send(request, **kwargs)
    638 
    639         # Total elapsed time of the request (approximately)

C:\anaconda\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    496 
    497         except (ProtocolError, socket.error) as err:
--> 498             raise ConnectionError(err, request=request)
    499 
    500         except MaxRetryError as e:

ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

0 个答案:

没有答案