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/01 07:11:31 UTC

[incubator-datalab] 02/36: params and creds

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

commit 727439e1d9d014d248b58f6a689695901d7fe721
Author: owlleg6 <ow...@gmail.com>
AuthorDate: Wed May 18 16:42:02 2022 +0300

    params and creds
---
 .../src/general/lib/azure/actions_lib.py           |  6 +++++
 .../scripts/azure/dataengine-service_prepare.py    | 27 ++++++++++++++++++++--
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/infrastructure-provisioning/src/general/lib/azure/actions_lib.py b/infrastructure-provisioning/src/general/lib/azure/actions_lib.py
index f68e2de48..8f0d31750 100644
--- a/infrastructure-provisioning/src/general/lib/azure/actions_lib.py
+++ b/infrastructure-provisioning/src/general/lib/azure/actions_lib.py
@@ -42,6 +42,7 @@ from azure.mgmt.storage import StorageManagementClient
 from azure.storage.blob import BlobServiceClient
 from azure.identity import ClientSecretCredential
 from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient
+from azure.mgmt.hdinsight import HDInsightManagementClient
 from fabric import *
 from patchwork.files import exists
 from patchwork import files
@@ -89,6 +90,11 @@ class AzureActions:
             json_dict["subscriptionId"],
             base_url=json_dict["resourceManagerEndpointUrl"]
         )
+        self.hdinsight_client = HDInsightManagementClient(
+            self.credential,
+            json_dict["subscriptionId"],
+            base_url=json_dict["resourceManagerEndpointUrl"]
+        )
         self.sp_creds = json.loads(open(os.environ['AZURE_AUTH_LOCATION']).read())
         self.dl_filesystem_creds = lib.auth(tenant_id=json.dumps(self.sp_creds['tenantId']).replace('"', ''),
                                             client_secret=json.dumps(self.sp_creds['clientSecret']).replace('"', ''),
diff --git a/infrastructure-provisioning/src/general/scripts/azure/dataengine-service_prepare.py b/infrastructure-provisioning/src/general/scripts/azure/dataengine-service_prepare.py
index 87ac3ab88..05260a0cd 100644
--- a/infrastructure-provisioning/src/general/scripts/azure/dataengine-service_prepare.py
+++ b/infrastructure-provisioning/src/general/scripts/azure/dataengine-service_prepare.py
@@ -1,4 +1,4 @@
-import datalab.actions_lib
+from datalab.actions_lib import *
 import datalab.fab
 import datalab.meta_lib
 import json
@@ -13,6 +13,25 @@ from fabric import *
 from azure.mgmt.hdinsight.models import *
 
 
+CLUSTER_NAME = 'hdinsight_1'
+# The name of your existing Resource Group
+RESOURCE_GROUP_NAME = 'dlab-resource-group'
+# Choose a region. i.e. "East US 2".
+LOCATION = 'West US 2'
+# Cluster login username
+CLUSTER_LOGIN_USER_NAME = 'datalab-user'
+# (SSH) user username
+SSH_USER_NAME = 'datalab-user'
+# Cluster admin password
+PASSWORD = ''
+# The name of blob storage account
+STORAGE_ACCOUNT_NAME = 'hdinsight'
+# Blob storage account key
+STORAGE_ACCOUNT_KEY = ''
+# Blob storage account container name
+CONTAINER_NAME = 'hdinsight'
+# Blob Storage endpoint suffix.
+BLOB_ENDPOINT_SUFFIX = '.blob.core.windows.net'
 
 def create_cluster_parameters():
     # Returns cluster parameters
@@ -71,4 +90,8 @@ def create_cluster_parameters():
                 ]
             )
         )
-    ) 
\ No newline at end of file
+    )
+
+if __name__ == "__main__":
+    params = create_cluster_parameters()
+    create_hdinsight_cluster(RESOURCE_GROUP_NAME,CLUSTER_NAME, params)
\ No newline at end of file


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