简体   繁体   中英

Acumos model onboarding python CLI

I'm trying to onboard a simple python model from CLI as shown in the related tutorial . After providing the onboarding token (user:api-token) I'm getting the error below. The Acumos platform has been deployed using the AIO tools using prep-deploy process. I was able to dump the same model and onboard using the web 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)'),))

UPDATE

I've solved by adding the following line into the python script:

os.environ['CURL_CA_BUNDLE'] = ""

In addition to that I also had to change the push url ("acumos/onboarding-app/v2/models") as it was wrongly reported in the acumos python client library ("acumos/onboarding-app/v2/push").

I recomend you to add the following in your python script

os.environ['CURL_CA_BUNDLE'] = ""

it will skip the certificate verification

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM