You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by lf...@apache.org on 2022/09/23 12:01:23 UTC

[incubator-datalab] 01/01: [DATALAB-3054]: added cluster termination during instance deletion

This is an automated email from the ASF dual-hosted git repository.

lfrolov pushed a commit to branch DATALAB-3054
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git

commit 7f0d0b4b2d9b4bb7e0201738fb7ba604cf114641
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Fri Sep 23 11:11:05 2022 +0300

    [DATALAB-3054]: added cluster termination during instance deletion
---
 .../src/general/scripts/azure/common_terminate_notebook.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/infrastructure-provisioning/src/general/scripts/azure/common_terminate_notebook.py b/infrastructure-provisioning/src/general/scripts/azure/common_terminate_notebook.py
index 77ef93f41..d63759c3c 100644
--- a/infrastructure-provisioning/src/general/scripts/azure/common_terminate_notebook.py
+++ b/infrastructure-provisioning/src/general/scripts/azure/common_terminate_notebook.py
@@ -32,6 +32,20 @@ import traceback
 
 
 def terminate_nb(resource_group_name, notebook_name):
+    logging.info("Terminating Dataengine-service clusters")
+    try:
+        clusters_list = AzureMeta.list_hdinsight_clusters(resource_group_name)
+        if clusters_list:
+            for cluster in clusters_list:
+                if "notebook_name" in cluster.tags and notebook_name == cluster.tags["notebook_name"]:
+                    AzureActions.terminate_hdinsight_cluster(resource_group_name, cluster.name)
+                    logging.info('The HDinsight cluster {} has been terminated successfully'.format(cluster.name))
+        else:
+            logging.info("There are no HDinsight clusters to terminate.")
+    except Exception as err:
+        datalab.fab.append_result("Failed to terminate dataengine-service", str(err))
+        sys.exit(1)
+
     logging.info("Terminating data engine cluster")
     try:
         for vm in AzureMeta.compute_client.virtual_machines.list(resource_group_name):


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org