MCPcopy Create free account
hub / github.com/modelscope/modelscope / list

Method list

modelscope/hub/deploy.py:303–336  ·  view source on GitHub ↗

List deployed model instances. Args: provider (ServiceProviderParameters): The cloud service provider parameter, for eas, need access_key_id and access_key_secret. skip (int, optional): start of the list, current not support. limit (int, o

(self,
             provider: ServiceProviderParameters,
             skip: Optional[int] = 0,
             limit: Optional[int] = 100)

Source from the content-addressed store, hash-verified

301 return None
302
303 def list(self,
304 provider: ServiceProviderParameters,
305 skip: Optional[int] = 0,
306 limit: Optional[int] = 100):
307 """List deployed model instances.
308
309 Args:
310 provider (ServiceProviderParameters): The cloud service provider parameter,
311 for eas, need access_key_id and access_key_secret.
312 skip (int, optional): start of the list, current not support.
313 limit (int, optional): maximum number of instances return, current not support
314
315 Raises:
316 RequestError: The request is failed from server.
317
318 Returns:
319 List: List of instance information
320 """
321
322 params = ListServiceParameters(
323 provider=provider, skip=skip, limit=limit)
324 path = '%s/api/v1/deployer/endpoint?%s' % (self.endpoint,
325 params.to_query_str())
326 r = requests.get(path, cookies=self.cookies, headers=self.headers)
327 handle_http_response(r, logger, self.cookies, 'list_service_instances')
328 if r.status_code == HTTPStatus.OK:
329 if is_ok(r.json()):
330 data = r.json()[API_RESPONSE_FIELD_DATA]
331 return data
332 else:
333 raise RequestError(r.json()[API_RESPONSE_FIELD_MESSAGE])
334 else:
335 raise_for_http_status(r)
336 return None

Callers

nothing calls this directly

Calls 7

handle_http_responseFunction · 0.90
is_okFunction · 0.90
RequestErrorClass · 0.90
raise_for_http_statusFunction · 0.90
to_query_strMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected