mintproject / mic

Model Insertion Checker
https://mic-cli.readthedocs.io/en/latest/
5 stars 3 forks source link

verify if docker is running #235

Closed mosoriob closed 3 years ago

mosoriob commented 4 years ago

If docker is not running, the user will see a ugly error

Traceback (most recent call last):
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/urllib3/connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/http/client.py", line 1230, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/http/client.py", line 1276, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/http/client.py", line 1225, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/http/client.py", line 1004, in _send_output
    self.send(msg)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/http/client.py", line 944, in send
    self.connect()
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/docker/transport/unixconn.py", line 43, in connect
    sock.connect(self.unix_socket)
ConnectionRefusedError: [Errno 61] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/urllib3/connectionpool.py", line 724, in urlopen
    retries = retries.increment(
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/urllib3/util/retry.py", line 403, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/urllib3/packages/six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/urllib3/connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/http/client.py", line 1230, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/http/client.py", line 1276, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/http/client.py", line 1225, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/http/client.py", line 1004, in _send_output
    self.send(msg)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/http/client.py", line 944, in send
    self.connect()
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/docker/transport/unixconn.py", line 43, in connect
    sock.connect(self.unix_socket)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionRefusedError(61, 'Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/mosorio/.pyenv/versions/3.8.0/bin/mic", line 11, in <module>
    load_entry_point('mic==1.0.1', 'console_scripts', 'mic')()
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/mic/click_encapsulate/commands.py", line 79, in start
    image = build_docker(mic_dir / DOCKER_DIR, name)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/mic/publisher/docker.py", line 34, in build_docker
    image, logs = client.images.build(path=str(docker_path), tag="{}".format(name), nocache=True)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/docker/models/images.py", line 279, in build
    resp = self.client.api.build(**kwargs)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/docker/api/build.py", line 263, in build
    response = self._post(
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/docker/utils/decorators.py", line 46, in inner
    return f(self, *args, **kwargs)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/docker/api/client.py", line 226, in _post
    return self.post(url, **self._set_request_timeout(kwargs))
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/requests/sessions.py", line 578, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/Users/mosorio/.pyenv/versions/3.8.0/lib/python3.8/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionRefusedError(61, 'Connection refused'))
~/tmp/simpleModel ❯
issue-label-bot[bot] commented 4 years ago

Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.