Skip to content

Commit

Permalink
[Serve] Enable multiple cloud in resources (#3226)
Browse files Browse the repository at this point in the history
* fix

* Update sky/serve/core.py

Co-authored-by: Ziming Mao <[email protected]>

* Update sky/serve/core.py

Co-authored-by: Ziming Mao <[email protected]>

* lint

* lint

---------

Co-authored-by: Ziming Mao <[email protected]>
  • Loading branch information
cblmemo and MaoZiming authored Feb 25, 2024
1 parent 290e5ce commit 107f3bb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions sky/serve/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ def up(
with ux_utils.print_exception_no_traceback():
raise RuntimeError('Service section not found.')

# If all resources are from the same cloud, set the cloud of the controller
# to be that cloud if it does not exist yet. If the controller and all
# replicas are from the same cloud, it should provide better connectivity.
requested_cloud: Optional['clouds.Cloud'] = None
requested_multiple_clouds: bool = False
service_port: Optional[int] = None
for requested_resources in task.resources:
if requested_resources.ports is None or len(
Expand All @@ -85,9 +89,10 @@ def up(
if requested_cloud is None:
requested_cloud = requested_resources.cloud
if requested_cloud != requested_resources.cloud:
raise ValueError(f'Got multiple clouds: {requested_cloud} and '
f'{requested_resources.cloud} in different '
'resources. Please specify single cloud instead.')
requested_multiple_clouds = True
# If multiple clouds are used, skip this optimization.
if requested_multiple_clouds:
requested_cloud = None

controller_utils.maybe_translate_local_file_mounts_and_sync_up(task,
path='serve')
Expand Down

0 comments on commit 107f3bb

Please sign in to comment.