Skip to content

Commit

Permalink
fix print and dictionary issue
Browse files Browse the repository at this point in the history
  • Loading branch information
MaoZiming committed Jan 4, 2024
1 parent d30b239 commit 5d5cba2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 2 additions & 0 deletions sky/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4329,6 +4329,8 @@ def serve_up(
if resource.use_spot is not None and not resource.use_spot:
logger.info(f'{resource} use_spot will be override to True, '
'because spot placer is enabled.')
break

if task.service.spot_placer is None:
use_spot = False
for resource in list(task.resources):
Expand Down
14 changes: 5 additions & 9 deletions sky/serve/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,14 @@ def up(
with ux_utils.print_exception_no_traceback():
raise RuntimeError('Service section not found.')

if task.service.spot_placer is not None:
for resource in list(task.resources):
if resource.use_spot is not None and not resource.use_spot:
logger.info(f'{resource} use_spot will be override to True, '
'because spot placer is enabled.')

for requested_resources in task.resources:
first_resource_dict = list(task.resources)[0].__dict__
requested_resources_dict = requested_resources.__dict__
for key in ['region', 'zone', 'cloud']:
first_resource_dict.pop(key)
requested_resources_dict.pop(key)
for key in ['_region', '_zone', '_cloud']:
if key in first_resource_dict:
first_resource_dict.pop(key)
if key in requested_resources_dict:
requested_resources_dict.pop(key)
if first_resource_dict != requested_resources_dict:
raise ValueError(
'Require multiple resources to have the same fields '
Expand Down

0 comments on commit 5d5cba2

Please sign in to comment.