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/06 15:24:08 UTC
[incubator-datalab] branch DATALAB-1408 updated: [DATALAB-1408]: added cluster status check before termination
This is an automated email from the ASF dual-hosted git repository.
lfrolov pushed a commit to branch DATALAB-1408
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
The following commit(s) were added to refs/heads/DATALAB-1408 by this push:
new 55e7f85c3 [DATALAB-1408]: added cluster status check before termination
55e7f85c3 is described below
commit 55e7f85c30e2a4df1c96560a89951e05e45d5935
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Tue Sep 6 18:23:57 2022 +0300
[DATALAB-1408]: added cluster status check before termination
---
.../general/scripts/azure/dataengine-service_terminate.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/infrastructure-provisioning/src/general/scripts/azure/dataengine-service_terminate.py b/infrastructure-provisioning/src/general/scripts/azure/dataengine-service_terminate.py
index c4eb67a7a..4a168cf9a 100644
--- a/infrastructure-provisioning/src/general/scripts/azure/dataengine-service_terminate.py
+++ b/infrastructure-provisioning/src/general/scripts/azure/dataengine-service_terminate.py
@@ -66,11 +66,13 @@ if __name__ == "__main__":
try:
logging.info('[TERMINATE HDINSIGHT CLUSTER AND ASSOCIATED RESOURCES]')
try:
- AzureActions.terminate_hdinsight_cluster(hdinsight_conf['resource_group_name'],
- hdinsight_conf['cluster_name'])
- for storage_account in AzureMeta.list_storage_accounts(hdinsight_conf['resource_group_name']):
- if hdinsight_conf['storage_account_name_tag'] == storage_account.tags["Name"]:
- AzureActions.remove_storage_account(hdinsight_conf['resource_group_name'], storage_account.name)
+ cluster = AzureMeta.get_hdinsight_cluster(hdinsight_conf['resource_group_name'], hdinsight_conf['cluster_name'])
+ if cluster.properties.cluster_state == 'Running':
+ AzureActions.terminate_hdinsight_cluster(hdinsight_conf['resource_group_name'],
+ hdinsight_conf['cluster_name'])
+ for storage_account in AzureMeta.list_storage_accounts(hdinsight_conf['resource_group_name']):
+ if hdinsight_conf['storage_account_name_tag'] == storage_account.tags["Name"]:
+ AzureActions.remove_storage_account(hdinsight_conf['resource_group_name'], storage_account.name)
except Exception as err:
traceback.print_exc()
datalab.fab.append_result("Failed to terminate hdinsight cluster.", str(err))
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org