Ejemplo n.º 1
0
Archivo: vpc.py Proyecto: huslage/train
def terminate_environment(conn, user_vpc):
    """Terminates all instances, vpc, environment, and related training files"""

    print "Terminating environment ..."
    instances = inst.terminate_all_instances(conn, user_vpc)
    if instances:
        inst.confirm_terminated(instances)
    delete_iam_profile()
    delete_key_pairs()
    delete_vpc(user_vpc)
    if os.path.exists('/host/share'):
        shutil.rmtree('/host/share')

    print "Environment deleted ..."
    print 'Finished ...'
Ejemplo n.º 2
0
Archivo: vpc.py Proyecto: kizbitz/train
def terminate_environment(conn, user_vpc):
    """Terminates all instances, vpc, environment, and related training files"""

    print "Terminating environment ..."
    instances = inst.terminate_all_instances(conn, user_vpc)
    if instances:
        inst.confirm_terminated(instances)
    try:
        delete_iam_profile()
    except:
        print "WARNING: delete_iam_profile() failed"
        pass
    try:
        delete_key_pairs()
    except:
        print "WARNING: delete_key_pairs() failed"
        pass
    try:
        delete_amis()
    except:
        print "WARNING: delete_amis() failed"
        pass
    try:
        delete_vpc(user_vpc)
    except:
        print "WARNING: delete_vpcs() failed"
        pass
    try:
        if os.path.exists("/host/{0}".format(VPC)):
            shutil.rmtree("/host/{0}".format(VPC))
    except:
        print "WARNING: Removing directory '/host/{0}' failed".format(VPC)
        pass

    print "Environment deleted ..."
    print "Finished ..."
Ejemplo n.º 3
0
def terminate_environment(conn, user_vpc):
    """Terminates all instances, vpc, environment, and related training files"""

    print "Terminating environment ..."
    instances = inst.terminate_all_instances(conn, user_vpc)
    if instances:
        inst.confirm_terminated(instances)
    try:
        delete_iam_profile()
    except:
        print "WARNING: delete_iam_profile() failed"
        pass
    try:
        delete_key_pairs()
    except:
        print "WARNING: delete_key_pairs() failed"
        pass
    try:
        delete_amis()
    except:
        print "WARNING: delete_amis() failed"
        pass
    try:
        delete_vpc(user_vpc)
    except:
        print "WARNING: delete_vpcs() failed"
        pass
    try:
        if os.path.exists('/host/{0}'.format(VPC)):
            shutil.rmtree('/host/{0}'.format(VPC))
    except:
        print "WARNING: Removing directory '/host/{0}' failed".format(VPC)
        pass

    print "Environment deleted ..."
    print 'Finished ...'