refgenie / refgenconf

A Python object for standardized reference genome assets.
http://refgenie.databio.org
BSD 2-Clause "Simplified" License
3 stars 6 forks source link

upgrade error on broken URL #112

Closed nsheff closed 3 years ago

nsheff commented 3 years ago

I tried to upgrade when I had 1 valid server and 1 bad URL (nonexistant server) and got this error:

refgenie upgrade --target-version 0.4
Upgrading config to v0.4. Current genome identifiers will be replaced with sequence-derived digests and contents inside '/home/nsheff/code/refgenie_sandbox' will be replaced by 'data' and 'alias' directories. For more info visit: http://refgenie.databio.org/. Would you like to proceed? [y/N] y
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 156, in _new_conn
    conn = connection.create_connection(
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 84, in create_connection
    raise err
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 74, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 665, in urlopen
    httplib_response = self._make_request(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 387, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.8/http/client.py", line 1240, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1286, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1235, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1006, in _send_output
    self.send(msg)
  File "/usr/lib/python3.8/http/client.py", line 946, in send
    self.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 184, in connect
    conn = self._new_conn()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 168, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f3c9d950130>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 719, in urlopen
    retries = retries.increment(
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 436, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='rg.databio.org', port=82): Max retries exceeded with url: /openapi.json (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f3c9d950130>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/nsheff/.local/bin/refgenie", line 8, in <module>
    sys.exit(main())
  File "/home/nsheff/.local/lib/python3.8/site-packages/refgenie/refgenie.py", line 944, in main
    upgrade_config(target_version=args.target_version,
  File "/home/nsheff/.local/lib/python3.8/site-packages/refgenconf/refgenconf.py", line 2232, in upgrade_config
    get_json_url(server, 'index_v3__get')
  File "/home/nsheff/.local/lib/python3.8/site-packages/refgenconf/refgenconf.py", line 2175, in <lambda>
    get_json_url=lambda s, i: s + _get_server_endpoints_mapping(s)[i],
  File "/home/nsheff/.local/lib/python3.8/site-packages/refgenconf/refgenconf.py", line 2572, in _get_server_endpoints_mapping
    json = download_json(url + "/openapi.json")
  File "/home/nsheff/.local/lib/python3.8/site-packages/refgenconf/helpers.py", line 248, in download_json
    resp = get(url, params=params)
  File "/usr/lib/python3/dist-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='rg.databio.org', port=82): Max retries exceeded with url: /openapi.json (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f3c9d950130>: Failed to establish a new connection: [Errno 111] Connection refused'))
stolarczyk commented 3 years ago

@xuebingjie1990 did you see this issue? Last commit in refgenconf@dev_config_upgrade is older than this issue, which makes me think it hasn't been addressed.

xuebingjie1990 commented 3 years ago

I'm working on this. I got a different error (Connection timed out), if I have bad URL (nonexistant port).

xuebingjie1990 commented 3 years ago

@nsheff since I don't have the same error, can you test it to see if it works with ConnectionRefusedError. Also, should we remove the bad URL from the config?

nsheff commented 3 years ago

did you try it with rg.databio.org:82, does it give the same error?

xuebingjie1990 commented 3 years ago

I tried with rg.databio.org:82, I did get the same error. If I try with random port number, I get the TimeoutError. It except both error and continue with the upgrade.

nsheff commented 3 years ago

ok great! sounds good.