Delete a Service¶
You can delete a service in either of the following ways:
Delete the service created in Deploying a Real-Time Service.
Delete the service object returned in Querying the List of Service Objects.
Sample Code¶
In a ModelArts notebook instance, you do not need to enter authentication parameters for session authentication. For details about session authentication of other development environments, see Session Authentication.
Method 1: Delete the service created in Deploying a Real-Time Service.
from modelarts.session import Session from modelarts.model import Predictor session = Session() predictor_instance = Predictor(session, service_id="input your service_id") predictor_instance.delete_service()
Method 2: Delete the service object returned in Querying the List of Service Objects.
from modelarts.session import Session from modelarts.model import Predictor session = Session() predictor_object_list = Predictor.get_service_object_list(session) predictor_instance = predictor_object_list[0] predictor_instance.delete_service()