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

[UX] Optimizing error message when disabled cloud storage attempted #1858

Merged
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
2d9a3b2
ux_optimization_disabled_clouds
landscapepainter Apr 13, 2023
2380611
support get_enabled_clouds_str()
landscapepainter Apr 13, 2023
6e3cd17
fix return type
landscapepainter Apr 13, 2023
1b2ae82
adding new line eof
landscapepainter Apr 13, 2023
3aa6a35
fix error messages
landscapepainter Apr 13, 2023
3b905da
update for non-cloud-storage
landscapepainter Apr 14, 2023
845ab23
remove unused
landscapepainter Apr 15, 2023
0d5c288
Merge branch 'disabled_cloud_ux_optimize' of https://github.com/lands…
landscapepainter Apr 15, 2023
3780f6f
update check.py, cloudflare.py
landscapepainter Apr 15, 2023
8f06b45
format
landscapepainter Apr 15, 2023
f9039b1
format
landscapepainter Apr 15, 2023
bbf5093
format
landscapepainter Apr 15, 2023
2a82a09
update fix
landscapepainter Apr 15, 2023
7540085
ux_optimization_disabled_clouds
landscapepainter Apr 13, 2023
66ad186
support get_enabled_clouds_str()
landscapepainter Apr 13, 2023
da89eb8
fix return type
landscapepainter Apr 13, 2023
af9fdb3
adding new line eof
landscapepainter Apr 13, 2023
6737596
fix error messages
landscapepainter Apr 13, 2023
6299804
remove unused
landscapepainter Apr 15, 2023
d19e3fd
update for non-cloud-storage
landscapepainter Apr 14, 2023
6ee3952
rebasing
landscapepainter Apr 15, 2023
d1ca1f9
error fix
landscapepainter Apr 15, 2023
ec04950
format
landscapepainter Apr 15, 2023
256b6f3
fix
landscapepainter Apr 15, 2023
cf874da
format
landscapepainter Apr 15, 2023
bc02cb7
fix
landscapepainter Apr 20, 2023
5acdbbe
format
landscapepainter Apr 20, 2023
0c2b2b1
format
landscapepainter Apr 20, 2023
d79ebee
Merge branch 'master' into disabled_cloud_ux_optimize
landscapepainter May 5, 2023
4f28c4a
nit
landscapepainter May 5, 2023
7f57e6d
nit
landscapepainter May 5, 2023
efb1d7f
remove unused code
landscapepainter May 10, 2023
2a01678
remove unused
landscapepainter May 10, 2023
c20251d
update with enabled_storage_clouds
landscapepainter May 20, 2023
935bb09
update STORE_ENABLED_CLOUDS to List[str]
landscapepainter May 23, 2023
16fb1ea
Merge branch 'master' into disabled_cloud_ux_optimize
landscapepainter May 23, 2023
12d9f00
update on message and task.py
landscapepainter May 25, 2023
b95d943
Merge branch 'disabled_cloud_ux_optimize' of https://github.com/lands…
landscapepainter May 25, 2023
79be0b8
nit
landscapepainter May 25, 2023
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
2 changes: 2 additions & 0 deletions sky/data/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
# R2 to be an option as preferred store type
STORE_ENABLED_CLOUDS = [clouds.AWS(), clouds.GCP()]

STORE_TYPE_TO_CLOUD_TYPE = {'s3': 'AWS', 'gcs': 'GCP', 'r2': 'Cloudflare'}
landscapepainter marked this conversation as resolved.
Show resolved Hide resolved

# Maximum number of concurrent rsync upload processes
_MAX_CONCURRENT_UPLOADS = 32

Expand Down
5 changes: 5 additions & 0 deletions sky/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,8 @@ class ClusterOwnerIdentityMismatchError(Exception):
class NoCloudAccessError(Exception):
"""Raised when all clouds are disabled."""
pass


class CloudDisabledError(Exception):
"""Raised when attempted cloud is disabled"""
pass
15 changes: 15 additions & 0 deletions sky/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from sky.skylet import constants
from sky.utils import schemas
from sky.utils import ux_utils
from sky.adaptors import cloudflare

if typing.TYPE_CHECKING:
from sky import resources as resources_lib
Expand Down Expand Up @@ -295,10 +296,24 @@ def from_yaml(yaml_path: str) -> 'Task':

task_storage_mounts: Dict[str, storage_lib.Storage] = {}
all_storages = fm_storages
enabled_clouds = global_user_state.get_enabled_clouds()
enabled_clouds = [str(cloud) for cloud in enabled_clouds]
r2_is_enabled, _ = cloudflare.check_credentials()
if r2_is_enabled:
enabled_clouds.append('r2')
for storage in all_storages:
mount_path = storage[0]
assert mount_path, \
'Storage mount path cannot be empty.'
store_type = storage[1]['store']
if store_type:
cloud_type = storage_lib.STORE_TYPE_TO_CLOUD_TYPE[store_type]
if cloud_type not in enabled_clouds:
with ux_utils.print_exception_no_traceback():
raise exceptions.CloudDisabledError(
landscapepainter marked this conversation as resolved.
Show resolved Hide resolved
f'Storage \'store:{store_type}\' specified, but '
f'\'{cloud_type}\' access is disabled. Enable '
f'\'{cloud_type}\' to fix.')
landscapepainter marked this conversation as resolved.
Show resolved Hide resolved
try:
storage_obj = storage_lib.Storage.from_yaml_config(storage[1])
except exceptions.StorageSourceError as e:
Expand Down