Acumos 模型入职 python CLI

Acumos model onboarding python CLI

我正在尝试从 CLI 加载一个简单的 python 模型,如相关 tutorial 中所示。 提供入职令牌(用户:api-令牌)后,我收到以下错误。 Acumos 平台已通过准备部署过程使用 AIO 工具进行部署。 我能够转储相同的模型并使用网络 UI.

Traceback (most recent call last):   
  File "/home/gprato/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 677, in urlopen
    chunked=chunked,  
  File "/home/gprato/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 381, in _make_request
    self._validate_conn(conn)  
  File "/home/gprato/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 978, in _validate_conn
    conn.connect()  
  File "/home/gprato/.local/lib/python3.6/site-packages/urllib3/connection.py", line 371, in connect
    ssl_context=context,  
  File "/home/gprato/.local/lib/python3.6/site-packages/urllib3/util/ssl_.py", line 384, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)   
  File "/usr/lib/python3.6/ssl.py", line 407, in wrap_socket
    _context=self, _session=session)  
  File "/usr/lib/python3.6/ssl.py", line 817, in __init__
    self.do_handshake()  
  File "/usr/lib/python3.6/ssl.py", line 1077, in do_handshake
    self._sslobj.do_handshake()  
  File "/usr/lib/python3.6/ssl.py", line 689, in do_handshake
    self._sslobj.do_handshake()  
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):  
  File "/home/gprato/.local/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout  
  File "/home/gprato/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 727, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]  
  File "/home/gprato/.local/lib/python3.6/site-packages/urllib3/util/retry.py", line 439, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='***', port=443): Max retries exceeded with url: /onboarding-app/v2/models (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)'),))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "simple_example.py", line 16, in <module>
    session.push(model, 'example-2')  
  File "/home/gprato/.local/lib/python3.6/site-packages/acumos/session.py", line 103, in push
    _push_model(dump_dir, self.push_api, self.auth_api, options, extra_headers=extra_headers)    
  File "/home/gprato/.local/lib/python3.6/site-packages/acumos/session.py", line 172, in _push_model
    _post_model(files, push_api, auth_api, tries, max_tries, extra_headers, options)  
  File "/home/gprato/.local/lib/python3.6/site-packages/acumos/session.py", line 192, in _post_model
    resp = requests.post(push_api, files=files, headers=headers)  
  File "/home/gprato/.local/lib/python3.6/site-packages/requests/api.py", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)  
  File "/home/gprato/.local/lib/python3.6/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)  
  File "/home/gprato/.local/lib/python3.6/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)  
  File "/home/gprato/.local/lib/python3.6/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)  
  File "/home/gprato/.local/lib/python3.6/site-packages/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)  
requests.exceptions.SSLError: HTTPSConnectionPool(host='***', port=443): Max retries exceeded with url: /onboarding-app/v2/models (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)'),))

更新

我通过在 python 脚本中添加以下行解决了问题:

os.environ['CURL_CA_BUNDLE'] = ""

除此之外,我还必须更改推送 url ("acumos/onboarding-app/v2/models"),因为它在 acumos python 客户端库 ("[=25] 中被错误报告=]").

我建议您在 python 脚本中添加以下内容

os.environ['CURL_CA_BUNDLE'] = ""

它将跳过证书验证