コード例 #1
0
ファイル: charts.py プロジェクト: kuberlab/python-klabclient
    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)]
コード例 #2
0
    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))
コード例 #3
0
    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)
        ]
コード例 #4
0
    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)]
コード例 #5
0
    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)
        ]
コード例 #6
0
    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')
コード例 #7
0
ファイル: models.py プロジェクト: kuberlab/python-klabclient
    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)
        )