Skip to content

Commit

Permalink
Set gcloud disk type default to ssd
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarmet committed Oct 11, 2023
1 parent 3df69de commit 55f9931
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions runner_manager/backend/gcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def disks(self) -> List[AttachedDisk]:
initialize_params=AttachedDiskInitializeParams(
source_image=self.image.self_link,
disk_size_gb=self.instance_config.disk_size_gb,
disk_type=f"zones/{self.config.zone}/diskTypes/{self.instance_config.disk_type}",
),
)
]
Expand Down
3 changes: 2 additions & 1 deletion runner_manager/models/backend.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from enum import Enum
from pathlib import Path
from string import Template
from typing import Dict, List, Optional, Sequence, TypedDict
from typing import Dict, List, Literal, Optional, Sequence, TypedDict

from mypy_boto3_ec2.literals import InstanceTypeType, VolumeTypeType
from mypy_boto3_ec2.type_defs import (
Expand Down Expand Up @@ -107,6 +107,7 @@ class GCPInstanceConfig(InstanceConfig):
enable_nested_virtualization: bool = True
spot: bool = False
disk_size_gb: int = 20
disk_type: Literal["pd-ssd", "pd-standard"] = "pd-ssd"

class Config:
arbitrary_types_allowed = True
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/backend/test_gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,16 @@ def test_gcp_disks(runner: Runner, gcp_group: RunnerGroup):
# patch self.image.self_link to return a fake image

disks = gcp_group.backend.disks
zone = gcp_group.backend.config.zone
disk_type = gcp_group.backend.instance_config.disk_type
assert len(disks) == 1
assert (
disks[0].initialize_params.disk_size_gb
== gcp_group.backend.instance_config.disk_size_gb
)
assert disks[0].boot is True
assert disks[0].auto_delete is True
assert disks[0].initialize_params.disk_type == f"zones/{zone}/diskTypes/{disk_type}"


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

0 comments on commit 55f9931

Please sign in to comment.