I am trying to move files through multiple cloud storage using google colab and whenever i try to mount the first cloud storage, the cell freeze and i am unable to mount the second one. Below is my mount code.
#@markdown <center><h3>Rclone MOUNT / UNMOUNT</h3>Mount the remote as file system on a mountpoint.</center>
import os
from IPython.display import HTML, clear_output
import uuid
import ipywidgets as widgets
from google.colab import output
import re
##########################################
class MakeButton(object):
def __init__(self, title, callback, style):
self._title = title
self._callback = callback
self._style = style
def _repr_html_(self):
callback_id = 'button-' + str(uuid.uuid4())
output.register_callback(callback_id, self._callback)
if self._style != "":
style_html = "p-Widget jupyter-widgets jupyter-button widget-button mod-" + self._style
else:
style_html = "p-Widget jupyter-widgets jupyter-button widget-button"
template = """<button class="{style_html}" id="{callback_id}">{title}</button>
<script>
document.querySelector("#{callback_id}").onclick = (e) => {{
google.colab.kernel.invokeFunction('{callback_id}', [], {{}})
e.preventDefault();
}};
</script>"""
html = template.format(title=self._title, callback_id=callback_id, style_html=style_html)
return html
def ShowAC():
clear_output(wait=True)
display(
widgets.HBox(
[widgets.VBox(
[widgets.HTML(
'''<h3 style="font-family:Trebuchet MS;color:#4f8bd6;margin-top:0px;">
Rclone available config...</h3>
'''
),
mountNam]
)
]
)
)
display(HTML("<br>"), MakeButton("Mount", MountCMD, "primary"),
MakeButton("Unmount", unmountCMD, "danger"))
content = open("/root/.config/rclone/rclone.conf").read()
avCon = re.findall(r"^\[(.+)\]$", content, re.M)
mountNam = widgets.Dropdown(options=avCon)
cache_path="/content/temp/rCloneTemp"
def MountCMD():
mPoint = f"/content/drives/{mountNam.value}"
os.makedirs(mPoint, exist_ok=True)
!rclone mount $mountNam.value: SmPoint --user-agent 'Mozilla' --buffer-size 256M --transfers 10 --vfs-cache-mode minimal --vfs-read-chunk-size 500M --vfs-cache-max-size 50G --vfs-cache-max-age 0h0m1s --vfs-cache-poll-interval 0m1s --cache-dir '/content/temp/rCloneTemp' --allow-other --daemon
if os.path.isdir(mPoint)== True:
print(f"Mount success! - \t{mPoint}")
else:
print(f"Mount failed! - \t{mPoint}")
def unmountCMD():
mPoint = f"/content/drives/{mountNam.value}"
if os.system(f"fusermount -uz {mPoint}") == 0:
runSh(f"rm -r {mPoint}")
print(f"Unmounted success! - \t{mPoint}")
else:
runSh(f"fusermount -uz {mPoint}", output=True)
ShowAC()
My Rclone config below
[24200201]
type = drive
scope = drive
token = {"**************************************************"}
team_drive =[242002team]
type = drive
scope = drive
token = {"**************************************************"}
team_drive = *****************************
root_folder_id =[school]
type = drive
scope = drive
token = {"***************************************************"}
team_drive =