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

Method delete

modelscope/hub/deploy.py:273–301  ·  view source on GitHub ↗

Delete deployed model, this api send delete command and return, it will take some to delete, please check through the cloud console. Args: instance_name (str): The instance name you want to delete. provider (ServiceProviderParameters): The cloud provider info

(self, instance_name: str, provider: ServiceProviderParameters)

Source from the content-addressed store, hash-verified

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
275 some to delete, please check through the cloud console.
276
277 Args:
278 instance_name (str): The instance name you want to delete.
279 provider (ServiceProviderParameters): The cloud provider information, for eas
280 need region(eg: ch-hangzhou), access_key_id and access_key_secret.
281
282 Raises:
283 RequestError: The request is failed.
284
285 Returns:
286 Dict: The deleted instance information.
287 """
288 params = DeleteServiceParameters(provider=provider)
289 path = '%s/api/v1/deployer/endpoint/%s?%s' % (
290 self.endpoint, instance_name, params.to_query_str())
291 r = requests.delete(path, cookies=self.cookies, headers=self.headers)
292 handle_http_response(r, logger, self.cookies, 'delete_service')
293 if r.status_code == HTTPStatus.OK:
294 if is_ok(r.json()):
295 data = r.json()[API_RESPONSE_FIELD_DATA]
296 return data
297 else:
298 raise RequestError(r.json()[API_RESPONSE_FIELD_MESSAGE])
299 else:
300 raise_for_http_status(r)
301 return None
302
303 def list(self,
304 provider: ServiceProviderParameters,

Callers 1

test_ds_delete_objectMethod · 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 1

test_ds_delete_objectMethod · 0.36