Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
drcrook1 committed Apr 3, 2019
2 parents ae8a220 + 0648c01 commit 53e6b86
Showing 1 changed file with 6 additions and 25 deletions.
31 changes: 6 additions & 25 deletions Project_One/notebooks/train_model.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Databricks notebook source
# FUTURE SERVICE PRINCIPAL STUFF FOR MOUNTING
secrets = {}
secrets["blob_name"] = dbutils.secrets.get(scope = "data-lake", key = "blob-name")
secrets["blob_key"] = dbutils.secrets.get(scope = "data-lake", key = "blob-key")
secrets["container_name"] = dbutils.secrets.get(scope = "data-lake", key = "container-name")
secrets["datalake_fqdn"] = dbutils.secrets.get(scope = "data-lake", key = "datalake-fqdn")
secrets["subscription_id"] = dbutils.secrets.get(scope = "data-lake", key = "subscription-id")
secrets["resource_group"] = dbutils.secrets.get(scope = "data-lake", key = "resource-group")
secrets["ml_workspace_name"] = dbutils.secrets.get(scope = "data-lake", key = "ml-workspace-name")
Expand All @@ -12,30 +10,13 @@
secrets["sp_password"] = dbutils.secrets.get(scope = "data-lake", key = "sp-password")
secrets["sp_tenant_id"] = dbutils.secrets.get(scope = "data-lake", key = "sp-tenant-id")
secrets["sp_token_endpoint"] = dbutils.secrets.get(scope = "data-lake", key = "sp-token-endpoint")
try:
secrets["created_by"] = dbutils.secrets.get(scope = "data-lake", key = "created-by")
except Exception as e:
print("falling back to user set created_by")
secrets["created_by"] = dbutils.secrets.get(scope = "data-lake", key = "created-by")
if(secrets["created_by"] == "dev"):
print("dev state, replacing with specific dev alias.")
secrets["created_by"] = "dacrook"

# COMMAND ----------

#
# THIS IS FOR BLOB MOUNTING
#
#create the config variable to pass into mount
#configs = {"fs.azure.account.key." + secrets["blob_name"] + ".blob.core.windows.net":"" + secrets["blob_key"] + ""}

#try:
#mounting the external blob storage as mount point datalake for data storage.
# dbutils.fs.mount( source = "wasbs://" + secrets["container_name"] + "@" + secrets["blob_name"] + ".blob.core.windows.net/",
# mount_point = "/mnt/datalake/",
# extra_configs = configs)
#except Exception as e:
# print("already mounted; no need to do so.")

# COMMAND ----------

#
# THIS IS FOR ADLS V2 Mounting
#
Expand All @@ -48,7 +29,7 @@
try:
#mounting the external blob storage as mount point datalake for data storage.
dbutils.fs.mount(
source = "abfss://" + secrets["container_name"] + "@" + secrets["storage_account_name"] + ".dfs.core.windows.net", #blobcontainername@storageaccount
source = secrets["datalake_fqdn"], #blobcontainername@storageaccount
mount_point = "/mnt/datalake",
extra_configs = configs)
except Exception as e:
Expand Down Expand Up @@ -137,4 +118,4 @@
try:
dbutils.fs.unmount("/mnt/datalake")
except Exception as e:
print("already unmounted; no need to unmount again.")
print("already unmounted; no need to unmount again.")

0 comments on commit 53e6b86

Please sign in to comment.