Exemple #1
0
def clean(api):
    for cluster in api.get_all_clusters():
        list_hosts = cluster.list_hosts
        print "hosts:"  #use this to add back when creating the cluster hostIds
        print list_hosts
        print "cluster:" + cluster.name + " ,cluster version:" + cluster.version
        for service in cluster.get_all_services():
            service.stop().wait()
            cluster.delete_service(service.name)
        #delete cloudera mgmt service
        cm = ClouderaManager(api)
        try:
            cm.delete_mgmt_service()
        except ApiException:
            print "mgmt service doesn't exist"
        api.delete_cluster(cluster.name)
def clean(api):
  for cluster in api.get_all_clusters():
    list_hosts = cluster.list_hosts
    print "hosts:" #use this to add back when creating the cluster hostIds
    print list_hosts
    print "cluster:" + cluster.name + " ,cluster version:" + cluster.version
    for service in cluster.get_all_services():
       service.stop().wait()
       cluster.delete_service(service.name)
    #delete cloudera mgmt service
    cm = ClouderaManager(api)
    try:
      cm.delete_mgmt_service()
    except ApiException:
      print "mgmt service doesn't exist"
    api.delete_cluster(cluster.name)