Skip to content
Merged
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
2 changes: 1 addition & 1 deletion runner_manager/backend/gcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def _sanitize_label_value(self, value: str) -> str:
return value

def setup_labels(self, runner: Runner) -> MutableMapping[str, str]:
labels: MutableMapping[str, str] = dict()
labels: MutableMapping[str, str] = self.instance_config.labels.copy()
if self.manager:
labels["runner-manager"] = self.manager
labels["status"] = self._sanitize_label_value(runner.status)
Expand Down
1 change: 1 addition & 0 deletions runner_manager/models/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class GCPInstanceConfig(InstanceConfig):
spot: bool = False
disk_size_gb: int = 20
disk_type: Literal["pd-ssd", "pd-standard"] = "pd-ssd"
labels: Dict[str, str] = {}

class Config:
arbitrary_types_allowed = True
Expand Down
7 changes: 6 additions & 1 deletion tests/unit/backend/test_gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ def gcp_group(settings, monkeypatch) -> RunnerGroup:
backend=GCPBackend(
name=Backends.gcloud,
config=config,
instance_config=GCPInstanceConfig(),
instance_config=GCPInstanceConfig(
labels={
"key": "value",
}
),
),
labels=[
"label",
Expand Down Expand Up @@ -80,6 +84,7 @@ def test_gcp_setup_labels(runner: Runner, gcp_group: RunnerGroup):
labels = gcp_group.backend.setup_labels(runner)
assert labels["status"] == runner.status
assert labels["busy"] == str(runner.busy).lower()
assert labels["key"] == "value"


def test_gcp_spot_config(runner: Runner, gcp_group: RunnerGroup):
Expand Down