H2OConnectionError:意外的HTTP错误:HTTPConnectionPool Errno 111连接被拒绝

时间:2018-01-26 23:21:02

标签: python h2o

我正在使用H2O的机器学习软件包(随机森林)。

偶尔会收到此错误:

H2OConnectionError: Unexpected HTTP error: HTTPConnectionPool(host='localhost', port=54321): Max retries exceeded with url: /3/PostFile (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f176f9f39d0>: Failed to establish a new connection: [Errno 111] Connection refused',))

重新启动H2O服务器和/或重试我的命令的一些组合(我不确定哪一个,因为它深埋在我的代码中但是它在h2o.init()之后在构建H2O数据框之前)似乎最终会解决错误。

有没有办法提升Max重试次数?

我的配置。 Ubuntu 16.04-2 x86_64 GNU / Linux。我使用的是Python API。

H 2 O:

Checking whether there is an H2O instance running at http://localhost:54321..... not found.
Attempting to start a local H2O server...
  Java Version: openjdk version "1.8.0_151"; OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12); OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
  Starting server from /usr/local/lib/python2.7/dist-packages/h2o/backend/bin/h2o.jar
  Ice root: /tmp/tmpGnu_MH
  JVM stdout: /tmp/tmpGnu_MH/h2o_clem_started_from_python.out
  JVM stderr: /tmp/tmpGnu_MH/h2o_clem_started_from_python.err
  Server is running at http://127.0.0.1:54321
Connecting to H2O server at http://127.0.0.1:54321... successful.

H2O cluster uptime:     05 secs
H2O cluster version:    3.16.0.4
H2O cluster version age:    10 days
H2O cluster name:   H2O_from_python_clem_30vfd8
H2O cluster total nodes:    1
H2O cluster free memory:    13.95 Gb
H2O cluster total cores:    8
H2O cluster allowed cores:  7
H2O cluster status:     accepting new members, healthy
H2O connection url:     http://127.0.0.1:54321
H2O connection proxy:   None
H2O internal security:  False
H2O API Extensions:     XGBoost, Algos, AutoML, Core V3, Core V4
Python version:     2.7.12 final

(已添加)我实际上遇到了制作数据帧的问题:

/usr/local/lib/python2.7/dist-packages/h2o/frame.pyc in __init__(self, python_obj, destination_frame, header, separator, column_names, column_types, na_strings)
    100         if python_obj is not None:
    101             self._upload_python_object(python_obj, destination_frame, header, separator,
--> 102                                        column_names, column_types, na_strings)
    103 
    104     @staticmethod

/usr/local/lib/python2.7/dist-packages/h2o/frame.pyc in _upload_python_object(self, python_obj, destination_frame, header, separator, column_names, column_types, na_strings)
    141             csv_writer.writerows(data_to_write)
    142         tmp_file.close()  # close the streams
--> 143         self._upload_parse(tmp_path, destination_frame, 1, separator, column_names, column_types, na_strings)
    144         os.remove(tmp_path)  # delete the tmp file
    145 

/usr/local/lib/python2.7/dist-packages/h2o/frame.pyc in _upload_parse(self, path, destination_frame, header, sep, column_names, column_types, na_strings)
    315 
    316     def _upload_parse(self, path, destination_frame, header, sep, column_names, column_types, na_strings):
--> 317         ret = h2o.api("POST /3/PostFile", filename=path)
    318         rawkey = ret["destination_frame"]
    319         self._parse(rawkey, destination_frame, header, sep, column_names, column_types, na_strings)

/usr/local/lib/python2.7/dist-packages/h2o/h2o.pyc in api(endpoint, data, json, filename, save_to)
    101     # type checks are performed in H2OConnection class
    102     _check_connection()
--> 103     return h2oconn.request(endpoint, data=data, json=json, filename=filename, save_to=save_to)
    104 
    105 

/usr/local/lib/python2.7/dist-packages/h2o/backend/connection.pyc in request(self, endpoint, data, json, filename, save_to)
    408             else:
    409                 self._log_end_exception(e)
--> 410                 raise H2OConnectionError("Unexpected HTTP error: %s" % e)
    411         except requests.exceptions.Timeout as e:
    412             self._log_end_exception(e)

H2OConnectionError: Unexpected HTTP error: HTTPConnectionPool(host='localhost', port=54321): Max retries exceeded with url: /3/PostFile (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fcc564de750>: Failed to establish a new connection: [Errno 111] Connection refused',))

1 个答案:

答案 0 :(得分:0)

尝试重新启动jupyter内核,然后重新启动H2O。

h2o.init(ip="127.0.0.1",max_mem_size_GB = 2)