def list_versions(self, workspace, chart_name): url = '/workspace/%s/chart-app/%s/versions' % (workspace, chart_name) resp = self.http_client.get(url) if resp.status_code >= 400: self._raise_api_exception(resp) return [ChartVersion(self, v) for v in base.extract_json(resp, None)]
def status(self, workspace, name): self._ensure_not_empty(workspace=workspace, name=name) url = '/workspace/%s/application/%s/status' % (workspace, name) resp = self.http_client.get(url) if resp.status_code >= 400: self._raise_api_exception(resp) return AppStatus(self, base.extract_json(resp, None))
def get_destinations(self, workspace): self._ensure_not_empty(workspace=workspace) url = '/workspace/%s/appdestinations' % workspace resp = self.http_client.get(url) if resp.status_code >= 400: self._raise_api_exception(resp) return [ AppDestination(self, d) for d in base.extract_json(resp, None) ]
def get_pods(self, workspace, app_name, task, build): url = ( '/workspace/%s/application/%s/tasks/%s/build/%s/pods' % (workspace, app_name, task, build) ) self._ensure_not_empty( workspace=workspace, app=app_name, task=task, build=build ) resp = self.http_client.get(url) if resp.status_code >= 400: self._raise_api_exception(resp) return [AppTaskPod(self, p) for p in base.extract_json(resp, None)]
def packages_list(self, workspace, name, all=False): self._ensure_not_empty(workspace=workspace, name=name) url = ( '/workspace/%s/application/%s/packages?all=%s' % (workspace, name, all) ) resp = self.http_client.get(url) if resp.status_code >= 400: self._raise_api_exception(resp) return [ AppPackage(self, d) for d in base.extract_json(resp, None) ]
def get_pod_logs(self, workspace, app_name, task, build, pod): url = ( '/workspace/%s/application/%s/tasks/%s/build/%s/pods/%s/log' % (workspace, app_name, task, build, pod) ) self._ensure_not_empty( workspace=workspace, app=app_name, task=task, build=build, pod=pod ) resp = self.http_client.get(url) if resp.status_code >= 400: self._raise_api_exception(resp) log = base.extract_json(resp, None) return log.get('output')
def upload(self, workspace, name, version, path): url = '%s/workspace/%s/mlmodel/%s/versions/%s/upload' % ( self.http_client.base_url, workspace, name, version ) stream = utils.stream_targz(path) resp = self.http_client.crud_provider.post( url, # data=form_data, files={'model': ('%s.tar.gz' % name, stream)} ) if resp.status_code >= 400: self._raise_api_exception(resp) return self.resource_class( self, base.extract_json(resp, response_key=None) )