Skip to content

Commit

Permalink
Add some helpful details and comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Conless committed Aug 22, 2024
1 parent cfb9e9d commit 65303b3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
4 changes: 3 additions & 1 deletion sky/clouds/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ def _get_disk_type(cls, disk_tier: resources_utils.DiskTier) -> str:
elif disk_tier == resources_utils.DiskTier.ULTRA:
logger.warning(
'Using disk_tier=ultra on AWS will utilize io2 Block Express, '
'which can lead to significant higher costs. '
'which can lead to significant higher costs (~$1.8/h). '
'For more information, see: https://aws.amazon.com/ebs/pricing.'
)
return 'io2'
Expand All @@ -818,6 +818,8 @@ def _get_disk_specs(
'disk_iops': tier2iops[tier],
'disk_throughput': tier2iops[tier] // 16 if
tier != resources_utils.DiskTier.ULTRA else None,
# Custom disk throughput is only available for gp3
# see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-ebs.html
'custom_disk_perf': tier != resources_utils.DiskTier.LOW,
}

Expand Down
20 changes: 14 additions & 6 deletions sky/clouds/gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import subprocess
import time
import typing
from typing import Dict, Iterator, List, Optional, Set, Tuple
from typing import Any, Dict, Iterator, List, Optional, Set, Tuple

import colorama

Expand Down Expand Up @@ -433,6 +433,7 @@ def make_deploy_resources_variables(
'custom_resources': None,
'use_spot': r.use_spot,
'gcp_project_id': self.get_project_id(dryrun),
**GCP._get_disk_specs(r.disk_tier),
}
accelerators = r.accelerators
if accelerators is not None:
Expand Down Expand Up @@ -491,10 +492,6 @@ def make_deploy_resources_variables(
resources_vars['machine_image'] = image_id
resources_vars['image_id'] = None

resources_vars['disk_tier'] = GCP._get_disk_type(r.disk_tier)
if resources_vars['disk_tier'] == 'pd-extreme':
resources_vars['disk_iops'] = 20000

firewall_rule = None
if resources.ports is not None:
firewall_rule = (USER_PORTS_FIREWALL_RULE_NAME.format(
Expand Down Expand Up @@ -923,10 +920,21 @@ def _get_disk_type(cls,
if tier == resources_utils.DiskTier.ULTRA:
logger.warning(
'Using disk_tier=ultra on GCP will utilize extreme persistent disks, '
'which can lead to significant higher costs. '
'which can lead to significant higher costs (~$2.2/h). '
'For more information, see: https://cloud.google.com/compute/disks-image-pricing#disk.'
)
return tier2name[tier]

@classmethod
def _get_disk_specs(
cls,
disk_tier: Optional[resources_utils.DiskTier]) -> Dict[str, Any]:
return {
'disk_tier': cls._get_disk_type(disk_tier),
'disk_iops': 20000 if disk_tier == resources_utils.DiskTier.ULTRA else None,
# Only pd-extreme supports custom iops.
# see https://cloud.google.com/compute/docs/disks#disk-types
}

@classmethod
def _label_filter_str(cls, tag_filters: Dict[str, str]) -> str:
Expand Down

0 comments on commit 65303b3

Please sign in to comment.