nodet / dowml

A library and command line client to use Decision Optimization on IBM Watson Machine Learning (WML). NOT SUPPORTED BY IBM.
Apache License 2.0
3 stars 0 forks source link

Speed up `create_job` by caching deployment information #44

Closed nodet closed 2 years ago

nodet commented 2 years ago

Function create_job must know what deployment to create a job in. It finds the correct deployment by getting the list (which requires a REST call) and looking for the one with the correct name. We can cache the results of this function to avoid the delay from the REST call.

A simple cache wouldn't work correctly if the deployment gets deleted during the lifetime of an instance of the library: it wouldn't realize that the deployment is gone, and would never update the cache. We therefore need to catch the corresponding errors, clear the cache, and try again.