Exemplo n.º 1
0
def pytest_generate_tests(metafunc):
    scenarios = [(name, {
        "name": name,
        "cluster_id": cluster_id
    }) for name, cluster_id in get_running_clusters().items()]
    idlist = []
    argvalues = []
    for scenario in scenarios:
        idlist.append(scenario[0])
        items = scenario[1].items()
        argnames = [x[0] for x in items]
        argvalues.append([x[1] for x in items])
    metafunc.parametrize(argnames, argvalues, ids=idlist, scope="class")
Exemplo n.º 2
0
from databrickslabs_jupyterlab.remote import connect

from helpers import get_profile, get_running_clusters, remove_running_clusters


def delete_cluster(client, cluster_id):
    try:
        response = client.permanent_delete(cluster_id)
        return response
    except Exception as ex:  # pylint: disable=broad-except
        print(ex)
        return None


clusters = get_running_clusters()
profile = get_profile()

try:
    apiclient = connect(profile)
    client = ClusterApi(apiclient)
except Exception as ex:  # pylint: disable=broad-except
    print(ex)
    sys.exit(1)


for name, cluster_id in clusters.items():
    print(name)
    delete_cluster(client, cluster_id)

remove_running_clusters()
 def setup_method(self):
     self.clusters = get_running_clusters()