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

[Core] Add skypilot-component label for clusters launched by SkyPilot #3643

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion sky/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,10 @@ def ports(self) -> Optional[List[str]]:

@property
def labels(self) -> Optional[Dict[str, str]]:
return self._labels
labels = {constants.TAG_SKYPILOT_COMPONENT: 'cluster'}
if self._labels is not None:
labels.update(self._labels)
return labels

@property
def is_image_managed(self) -> Optional[bool]:
Expand Down
3 changes: 3 additions & 0 deletions sky/skylet/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,6 @@
# Serve: A default controller with 4 vCPU and 16 GB memory can run up to 16
# services.
CONTROLLER_PROCESS_CPU_DEMAND = 0.25

# Tag key for what a cluster serves for in SkyPilot.
TAG_SKYPILOT_COMPONENT = 'skypilot-component'
8 changes: 8 additions & 0 deletions sky/utils/controller_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,14 @@ def get_controller_resources(
controller_resources_to_use: resources.Resources = list(
controller_resources)[0]

labels = controller_resources_to_use.labels
labels.update({
constants.TAG_SKYPILOT_COMPONENT: (f'{controller.value.controller_type}'
'-controller')
})
controller_resources_to_use = controller_resources_to_use.copy(
labels=labels)

controller_record = global_user_state.get_cluster_from_name(
controller.value.cluster_name)
if controller_record is not None:
Expand Down
Loading