-
Notifications
You must be signed in to change notification settings - Fork 0
/
mount_blob_home.py
38 lines (28 loc) · 1.49 KB
/
mount_blob_home.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# azure
import azureml.core, os
from azureml.core import Workspace, Datastore, Dataset, Run
from azureml.data.datapath import DataPath
from azureml.data.data_reference import DataReference
from azureml.exceptions import UserErrorException
import subprocess
# load subscription info from config.json
ws = Workspace.from_config()
# to be able to write on mounted datastore
import fuse
user = os.popen('whoami').read()[:-1]
#mount_path must be empty
#mount_path = "/home/azureuser/cloudfiles/code/Users/neelan/asr/mount/blob_mount" # must change for user
mount_path = "/home/azureuser/blob_mount" # must change for user
if not os.path.exists(mount_path): os.mkdir(mount_path)
if os.listdir(mount_path) != []:
print("mount_path not empty")
#make sure user has write access to cache_path - if not, create & chown to your user.
cache_path = "/home/azureuser/cloudfiles/data/tmp"
if not os.path.exists(cache_path): os.mkdir(cache_path)
config_path = "/home/azureuser/cloudfiles/code/Users/neelan/asr/mount/connection.cfg"
if not os.path.exists(cache_path):
print("get connection file from https://github.com/elucidate-ai/asr/blob/main/pipeline/connection.cfg")
if __name__ == "__main__":
bashCommand = "blobfuse /home/azureuser/blob_mount --tmp-path=/home/azureuser/cloudfiles/data/tmp --config-file=/home/azureuser/cloudfiles/code/Users/neelan/asr/mount/connection.cfg"
process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE)
output, error = process.communicate()