Get the inference service :param name: existing inference service name :param namespace: defaults to current or default namespace :param watch: True to watch the service until timeout elapsed or status is ready :param timeout_seconds: timeout seconds for watc
(
self,
name=None,
namespace=None,
watch=False,
timeout_seconds=600,
version=constants.KSERVE_V1BETA1_VERSION,
)
| 166 | return outputs |
| 167 | |
| 168 | def get( |
| 169 | self, |
| 170 | name=None, |
| 171 | namespace=None, |
| 172 | watch=False, |
| 173 | timeout_seconds=600, |
| 174 | version=constants.KSERVE_V1BETA1_VERSION, |
| 175 | ): # pylint:disable=inconsistent-return-statements |
| 176 | """ |
| 177 | Get the inference service |
| 178 | :param name: existing inference service name |
| 179 | :param namespace: defaults to current or default namespace |
| 180 | :param watch: True to watch the service until timeout elapsed or status is ready |
| 181 | :param timeout_seconds: timeout seconds for watch, default to 600s |
| 182 | :param version: api group version |
| 183 | :return: inference service |
| 184 | """ |
| 185 | |
| 186 | if namespace is None: |
| 187 | namespace = utils.get_default_target_namespace() |
| 188 | |
| 189 | if name: |
| 190 | if watch: |
| 191 | isvc_watch( |
| 192 | name=name, namespace=namespace, timeout_seconds=timeout_seconds |
| 193 | ) |
| 194 | else: |
| 195 | try: |
| 196 | return self.api_instance.get_namespaced_custom_object( |
| 197 | constants.KSERVE_GROUP, |
| 198 | version, |
| 199 | namespace, |
| 200 | constants.KSERVE_PLURAL_INFERENCESERVICE, |
| 201 | name, |
| 202 | ) |
| 203 | except client.rest.ApiException as e: |
| 204 | raise RuntimeError( |
| 205 | "Exception when calling CustomObjectsApi->get_namespaced_custom_object:\ |
| 206 | %s\n" |
| 207 | % e |
| 208 | ) |
| 209 | else: |
| 210 | if watch: |
| 211 | isvc_watch(namespace=namespace, timeout_seconds=timeout_seconds) |
| 212 | else: |
| 213 | try: |
| 214 | return self.api_instance.list_namespaced_custom_object( |
| 215 | constants.KSERVE_GROUP, |
| 216 | version, |
| 217 | namespace, |
| 218 | constants.KSERVE_PLURAL_INFERENCESERVICE, |
| 219 | ) |
| 220 | except client.rest.ApiException as e: |
| 221 | raise RuntimeError( |
| 222 | "Exception when calling CustomObjectsApi->list_namespaced_custom_object:\ |
| 223 | %s\n" |
| 224 | % e |
| 225 | ) |