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

Method get

modelscope/hub/deploy.py:244–271  ·  view source on GitHub ↗

Query the specified instance information. Args: instance_name (str): The deployed instance name. provider (ServiceProviderParameters): The cloud provider information, for eas need region(eg: ch-hangzhou), access_key_id and access_key_secret.

(self, instance_name: str, provider: ServiceProviderParameters)

Source from the content-addressed store, hash-verified

242 return None
243
244 def get(self, instance_name: str, provider: ServiceProviderParameters):
245 """Query the specified instance information.
246
247 Args:
248 instance_name (str): The deployed instance name.
249 provider (ServiceProviderParameters): The cloud provider information, for eas
250 need region(eg: ch-hangzhou), access_key_id and access_key_secret.
251
252 Raises:
253 RequestError: The request is failed from server.
254
255 Returns:
256 Dict: The information of the requested service instance.
257 """
258 params = GetServiceParameters(provider=provider)
259 path = '%s/api/v1/deployer/endpoint/%s?%s' % (
260 self.endpoint, instance_name, params.to_query_str())
261 r = requests.get(path, cookies=self.cookies, headers=self.headers)
262 handle_http_response(r, logger, self.cookies, 'get_service')
263 if r.status_code == HTTPStatus.OK:
264 if is_ok(r.json()):
265 data = r.json()[API_RESPONSE_FIELD_DATA]
266 return data
267 else:
268 raise RequestError(r.json()[API_RESPONSE_FIELD_MESSAGE])
269 else:
270 raise_for_http_status(r)
271 return None
272
273 def delete(self, instance_name: str, provider: ServiceProviderParameters):
274 """Delete deployed model, this api send delete command and return, it will take

Callers 15

_scan_cached_repoFunction · 0.45
constants.pyFile · 0.45
list_mcp_serversMethod · 0.45
get_mcp_serverMethod · 0.45
_decode_response_errorFunction · 0.45
handle_http_responseFunction · 0.45
datahub_raise_on_errorFunction · 0.45
push_to_hubFunction · 0.45
push_to_hub_asyncFunction · 0.45
submit_taskFunction · 0.45

Calls 6

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

Tested by

no test coverage detected