modzy / sdk-python Goto Github PK
View Code? Open in Web Editor NEWPython library for Modzy Machine Learning Operations (MLOps) Platform
License: Apache License 2.0
Python library for Modzy Machine Learning Operations (MLOps) Platform
License: Apache License 2.0
Please review first that the issue is fully related with this SDK by checking the relevant checkboxes ([x]
).
When you use models that produce a file output, Modzy saves that file, and then returns the location in the results object. To download that file, you need to do an authenticated GET request using cURL. It would be nice if Modzy's Python SDK had a method that automatically downloaded that file, or maybe let you send it to a specific location? Maybe something like...
client.results.download(name-of-file, file-save-location)
Just an idea.
Paste the command(s) you ran and the output.
Expected results:
Actual results:
Paste the logs that you consider useful for diagnostic.
Please review first that the issue is fully related with this SDK by checking the relevant checkboxes ([x]
).
I was trying to submit a job to one of our dev environments "intdev.modzy.engineering" but ran into an SSL error (error below).
From a BAH machine, submit a job using the Python SDK using this line:
job = client.jobs.submit_files(model_id, model_version, {'input.txt': './input.txt'})
I believe it is an issue with the certifications installed/trusted onto our SDK. It would be great if there were an optional "certs" parameter to the ApiClient
connection line where we could specify a root TLS certificate to validate the HTTP response against...maybe something like
client = ApiClient(base_url = URL, api_key = KEY, certs = CERTS)
The change might need to be made here https://github.com/modzy/sdk-python/blob/main/modzy/http.py#L84.
Expected results: Successful job submission.
Actual results: Error below
~\Anaconda3\envs\modzy\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
669 # Make the request on the httplib connection object.
--> 670 httplib_response = self._make_request(
671 conn,
~\Anaconda3\envs\modzy\lib\site-packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
380 try:
--> 381 self._validate_conn(conn)
382 except (SocketTimeout, BaseSSLError) as e:
~\Anaconda3\envs\modzy\lib\site-packages\urllib3\connectionpool.py in _validate_conn(self, conn)
977 if not getattr(conn, "sock", None): # AppEngine might not have `.sock`
--> 978 conn.connect()
979
~\Anaconda3\envs\modzy\lib\site-packages\urllib3\connection.py in connect(self)
361
--> 362 self.sock = ssl_wrap_socket(
363 sock=conn,
~\Anaconda3\envs\modzy\lib\site-packages\urllib3\util\ssl_.py in ssl_wrap_socket(sock, keyfile, certfile, cert_reqs, ca_certs, server_hostname, ssl_version, ciphers, ssl_context, ca_cert_dir, key_password, ca_cert_data)
385 if HAS_SNI and server_hostname is not None:
--> 386 return context.wrap_socket(sock, server_hostname=server_hostname)
387
~\Anaconda3\envs\modzy\lib\ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)
499 # ctx._wrap_socket()
--> 500 return self.sslsocket_class._create(
501 sock=sock,
~\Anaconda3\envs\modzy\lib\ssl.py in _create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session)
1039 raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
-> 1040 self.do_handshake()
1041 except (OSError, ValueError):
~\Anaconda3\envs\modzy\lib\ssl.py in do_handshake(self, block)
1308 self.settimeout(None)
-> 1309 self._sslobj.do_handshake()
1310 finally:
SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)
During handling of the above exception, another exception occurred:
MaxRetryError Traceback (most recent call last)
~\Anaconda3\envs\modzy\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
438 if not chunked:
--> 439 resp = conn.urlopen(
440 method=request.method,
~\Anaconda3\envs\modzy\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
725
--> 726 retries = retries.increment(
727 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
~\Anaconda3\envs\modzy\lib\site-packages\urllib3\util\retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
445 if new_retry.is_exhausted():
--> 446 raise MaxRetryError(_pool, url, error or ResponseError(cause))
447
MaxRetryError: HTTPSConnectionPool(host='intdev.modzy.engineering', port=443): Max retries exceeded with url: /api/models?per-page=1000 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)')))
During handling of the above exception, another exception occurred:
SSLError Traceback (most recent call last)
~\Anaconda3\envs\modzy\lib\site-packages\modzy\http.py in request(self, method, url, json_data)
83 try:
---> 84 response = self.session.request(method, url, data=data, headers=headers)
85 self.logger.debug("response %s", response.status_code)
~\Anaconda3\envs\modzy\lib\site-packages\requests\sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
529 send_kwargs.update(settings)
--> 530 resp = self.send(prep, **send_kwargs)
531
~\Anaconda3\envs\modzy\lib\site-packages\requests\sessions.py in send(self, request, **kwargs)
642 # Send the request
--> 643 r = adapter.send(request, **kwargs)
644
~\Anaconda3\envs\modzy\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
513 # This branch is for urllib3 v1.22 and later.
--> 514 raise SSLError(e, request=request)
515
SSLError: HTTPSConnectionPool(host='intdev.modzy.engineering', port=443): Max retries exceeded with url: /api/models?per-page=1000 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)')))
During handling of the above exception, another exception occurred:
NetworkError Traceback (most recent call last)
<ipython-input-11-31a2100395aa> in <module>
----> 1 client.models.get_all()
~\Anaconda3\envs\modzy\lib\site-packages\modzy\models.py in get_all(self)
157 """
158 self.logger.debug("getting all models")
--> 159 return self.get_models()
160
161 def get_models(self, model_id=None, author=None, created_by_email=None, name=None, description=None,
~\Anaconda3\envs\modzy\lib\site-packages\modzy\models.py in get_models(self, model_id, author, created_by_email, name, description, is_active, is_expired, is_recommended, last_active_date_time, expiration_date_time, sort_by, direction, page, per_page)
253 body = {k: v for (k, v) in body.items() if v is not None}
254 self.logger.debug("body 2? %s", body)
--> 255 json_list = self._api_client.http.get('{}?{}'.format(self._base_route, urlencode(body)))
256 return list(Model(json_obj, self._api_client) for json_obj in json_list)
257
~\Anaconda3\envs\modzy\lib\site-packages\modzy\http.py in get(self, url)
121 or the client is unable to connect.
122 """
--> 123 return self.request('GET', url)
124
125 def post(self, url, json_data=None):
~\Anaconda3\envs\modzy\lib\site-packages\modzy\http.py in request(self, method, url, json_data)
86 except requests.exceptions.RequestException as ex:
87 self.logger.exception('unable to make network request')
---> 88 raise NetworkError(str(ex), url, reason=ex)
89
90 try:
NetworkError: HTTPSConnectionPool(host='intdev.modzy.engineering', port=443): Max retries exceeded with url: /api/models?per-page=1000 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)')))```
Please review first that the issue is fully related with this SDK by checking the relevant checkboxes ([x]
).
Syntax error while importing modzy.
Input:
from modzy import ApiClient
from modzy._util import file_to_bytes
Output:
File "/usr/local/lib/python3.7/dist-packages/modzy/_util.py", line 54
while chunk := file.read(chunk_size):
^
SyntaxError: invalid syntax
Expected results: To import modzy into my workspace
Actual results: Syntax Error
Please review first that the issue is fully related with this SDK by checking the relevant checkboxes ([x]
).
The edge client inferences.run
method is a wrapper around inferences.perform_inference
and inferences.block_until_complete
. The issue is, this method does not accept a timeout parameter, so for models that take longer than 30 seconds to perform inference (default value in block_until_complete
method, you have to manually use the perform inference --> block until complete methods.
Please review first that the issue is fully related with this SDK by checking the relevant checkboxes ([x]
).
When submitting a job to any model, one of the parameters is the model version. There are ways to extract the latest version programmatically, but it would be great if the SDK defaulted to the latest version in the case a version is not supplied.
You can get the latest model version this way in the SDK:
for model in models:
model_info = client.models.get(models[model]['id'])
if models[model].get('version', None) == None: #let set a version explicitly above
models[model]['version'] = model_info.latestActiveVersion
models[model]['name'] = model_info.name
Expected results: Default latest version extracted by SDK automatically if user does not pass version through
Actual results: Requires manual work on user currently
Please review first that the issue is fully related with this SDK by checking the relevant checkboxes ([x]
).
Current version?
As a user of the sdk, I want to see a list of features or API calls supported by the SDK without have to navigate into the code.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.