Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Storage] Rclone to Cache Storage #3455

Closed
wants to merge 54 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
7dfcba1
initial commit
Feb 17, 2024
212df29
Merge branch 'skypilot-org:master' into master
shethhriday29 Feb 17, 2024
a08c034
newline
Feb 17, 2024
b85cbf9
comments
Feb 17, 2024
4fbfe17
run linter
Feb 17, 2024
6fc77e1
reminder for down
Feb 18, 2024
d6cb993
tentatively done with example
Feb 18, 2024
2d5aceb
formatting
Feb 18, 2024
4e1954a
yapf
Feb 19, 2024
eb22f62
Merge branch 'skypilot-org:master' into master
shethhriday29 Feb 22, 2024
27a8905
[Storage] Storage mounting tool permissions fix (#3215)
romilbhardwaj Feb 22, 2024
41a63df
[LLM] Example for Serving Gemma (#3207)
Michaelvll Feb 23, 2024
2b17e91
[LLM] Add logo for Gemma (#3220)
Michaelvll Feb 23, 2024
b326d12
Minor fixes for release 0.5.0 (#3212)
Michaelvll Feb 23, 2024
6d77872
[Docker] Add retry for docker pull due to daemon not ready (#3218)
Michaelvll Feb 24, 2024
cb695d5
added comments
Feb 26, 2024
94221eb
Merge branch 'skypilot-org:master' into master
shethhriday29 Feb 26, 2024
888f1a8
quick fix
Feb 27, 2024
4877669
finished pip issues
Feb 29, 2024
7a208dd
fix
Feb 29, 2024
152e36a
fix storage error message, add example link to docs
romilbhardwaj Feb 29, 2024
cf556ed
Merge branch 'master' of https://github.com/skypilot-org/skypilot int…
romilbhardwaj Feb 29, 2024
8213f02
Merge branch 'skypilot-org:master' into master
shethhriday29 Mar 3, 2024
60a530d
Merge branch 'skypilot-org:master' into master
shethhriday29 Mar 22, 2024
8df52d6
Merge branch 'skypilot-org:master' into master
shethhriday29 Mar 29, 2024
31291f4
Merge branch 'skypilot-org:master' into master
shethhriday29 Apr 17, 2024
c868494
prototype for gcs
Apr 18, 2024
953b4a6
removed non git files
Apr 18, 2024
e63e943
rclone support for aws
Apr 21, 2024
a4ddd48
minor formatting fix
Apr 21, 2024
9fa8f67
Merge branch 'skypilot-org:master' into rclone-cache
shethhriday29 May 26, 2024
19e714b
Merge branch 'skypilot-org:master' into rclone-cache
shethhriday29 May 27, 2024
32bb4fa
fixed merge conflict
May 27, 2024
0481d2c
fixed merge conflict
May 27, 2024
abf4488
fixed merge conflict
May 27, 2024
00a2a9f
reset perf example
May 27, 2024
213eb26
reset perf example
May 27, 2024
1349ba0
added tests for rclone functionality
May 28, 2024
3b0923a
update rclone vfs options
landscapepainter May 30, 2024
b82cc5b
testing
landscapepainter Jun 13, 2024
bad9172
test
landscapepainter Jun 30, 2024
211f1bc
test
landscapepainter Jun 30, 2024
a312ac1
update rclone config and rclone command options
landscapepainter Jul 2, 2024
ab179ab
Merge branch 'rclone-cache' of https://github.com/shethhriday29/skypi…
landscapepainter Jul 2, 2024
66a8e11
nit refactor
landscapepainter Jul 4, 2024
e628024
rclone refactor
landscapepainter Jul 5, 2024
0976fa1
nit
landscapepainter Jul 6, 2024
3d16255
update MOUNT_CACHE mode to MOUNT_CACHED mode
landscapepainter Jul 6, 2024
3818a05
update smoke test
landscapepainter Jul 7, 2024
d393206
Merge branch 'master' into shethhriday29-rclone-cache
landscapepainter Jul 7, 2024
27e702b
additional comments for mount cached command explaining options for r…
landscapepainter Jul 7, 2024
0612532
rclone class doc-string fix
landscapepainter Jul 8, 2024
ea290b8
nit format
landscapepainter Jul 8, 2024
64d9a7d
update step 7 of maybe_translate_local_file_mounts_and_sync_up
landscapepainter Jul 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 31 additions & 11 deletions sky/backends/cloud_vm_ray_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
from sky.utils import command_runner
from sky.utils import common_utils
from sky.utils import controller_utils
from sky.utils import env_options
from sky.utils import log_utils
from sky.utils import resources_utils
from sky.utils import rich_utils
Expand Down Expand Up @@ -4567,7 +4568,7 @@ def _execute_storage_mounts(
# Handle cases where `storage_mounts` is None. This occurs when users
# initiate a 'sky start' command from a Skypilot version that predates
# the introduction of the `storage_mounts_metadata` feature.
if not storage_mounts:
if storage_mounts is None:
return

# Process only mount mode objects here. COPY mode objects have been
Expand All @@ -4576,10 +4577,12 @@ def _execute_storage_mounts(
storage_mounts = {
path: storage_mount
for path, storage_mount in storage_mounts.items()
if storage_mount.mode == storage_lib.StorageMode.MOUNT
if (storage_mount.mode == storage_lib.StorageMode.MOUNT or
storage_mount.mode == storage_lib.StorageMode.MOUNT_CACHED)
}

# Handle cases when there aren't any Storages with MOUNT mode.
# Handle cases when there aren't any Storages with either MOUNT or
# MOUNT_CACHED mode.
if not storage_mounts:
return

Expand All @@ -4606,7 +4609,13 @@ def _execute_storage_mounts(
'successfully without mounting the bucket.')
# Get the first store and use it to mount
store = list(storage_obj.stores.values())[0]
mount_cmd = store.mount_command(dst)
if storage_obj.mode == storage_lib.StorageMode.MOUNT:
mount_cmd = store.mount_command(dst)
action_message = 'Mounting'
else:
assert storage_obj.mode == storage_lib.StorageMode.MOUNT_CACHED
mount_cmd = store.mount_cached_command(dst)
action_message = 'Mounting cached mode'
src_print = (storage_obj.source
if storage_obj.source else storage_obj.name)
if isinstance(src_print, list):
Expand All @@ -4618,7 +4627,7 @@ def _execute_storage_mounts(
target=dst,
cmd=mount_cmd,
run_rsync=False,
action_message='Mounting',
action_message=action_message,
log_path=log_path,
# Need to source bashrc, as the cloud specific CLI or SDK
# may require PATH in bashrc.
Expand All @@ -4636,12 +4645,23 @@ def _execute_storage_mounts(
f' to an empty or non-existent path.')
raise RuntimeError(error_msg) from None
else:
# Strip the command (a big heredoc) from the exception
raise exceptions.CommandError(
e.returncode,
command='to mount',
error_msg=e.error_msg,
detailed_reason=e.detailed_reason) from None
# By default, raising an error caused from mounting_utils
# shows a big heredoc as part of it. Here, we want to
# conditionally show the heredoc only if SKYPILOT_DEBUG
# is set
if env_options.Options.SHOW_DEBUG_INFO.get():
raise exceptions.CommandError(
e.returncode,
command='to mount',
error_msg=e.error_msg,
detailed_reason=e.detailed_reason)
else:
# Strip the command (a big heredoc) from the exception
raise exceptions.CommandError(
e.returncode,
command='to mount',
error_msg=e.error_msg,
detailed_reason=e.detailed_reason) from None

end = time.time()
logger.debug(f'Storage mount sync took {end - start} seconds.')
Expand Down
19 changes: 9 additions & 10 deletions sky/cloud_stores.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from sky.adaptors import ibm
from sky.clouds import gcp
from sky.data import data_utils
from sky.data.data_utils import Rclone
from sky.skylet import constants


class CloudStorage:
Expand Down Expand Up @@ -262,19 +262,18 @@ def is_directory(self, url: str) -> bool:
def _get_rclone_sync_command(self, source: str, destination: str):
bucket_name, data_path, bucket_region = data_utils.split_cos_path(
source)
bucket_rclone_profile = Rclone.generate_rclone_bucket_profile_name(
bucket_name, Rclone.RcloneClouds.IBM)
data_path_in_bucket = bucket_name + data_path
rclone_config_data = Rclone.get_rclone_config(bucket_name,
Rclone.RcloneClouds.IBM,
bucket_region)
rclone_profile_name = data_utils.Rclone.RcloneStores.IBM.get_profile_name(
bucket_name)
data_path_in_bucket = f'{bucket_name}{data_path}'
rclone_config = data_utils.Rclone.RcloneStores.IBM.get_config(
rclone_profile_name=rclone_profile_name, region=bucket_region)
# configure_rclone stores bucket profile in remote cluster's rclone.conf
configure_rclone = (
f' mkdir -p ~/.config/rclone/ &&'
f' echo "{rclone_config_data}">> {Rclone.RCLONE_CONFIG_PATH}')
f' mkdir -p {constants.RCLONE_CONFIG_DIR} &&'
f' echo "{rclone_config}">> {constants.RCLONE_CONFIG_PATH}')
download_via_rclone = (
'rclone copy '
f'{bucket_rclone_profile}:{data_path_in_bucket} {destination}')
f'{rclone_profile_name}:{data_path_in_bucket} {destination}')

all_commands = list(self._GET_RCLONE)
all_commands.append(configure_rclone)
Expand Down
Loading
Loading