Skip to content

Commit

Permalink
fix: add preemptible bool to optimization request
Browse files Browse the repository at this point in the history
  • Loading branch information
artaasadi committed Jul 8, 2024
1 parent 51aef7e commit b69f4d0
Show file tree
Hide file tree
Showing 5 changed files with 273 additions and 247 deletions.
1 change: 1 addition & 0 deletions plugin/processor/compute_instance/compute_instance_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type ComputeInstanceItem struct {
MachineType string
Region string
Platform string
Preemptible bool
OptimizationLoading bool
Preferences []*golang.PreferenceItem
Skipped bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func (job *ListComputeInstancesJob) Run(ctx context.Context) error {
MachineType: util.TrimmedString(*instance.MachineType, "/"),
Region: util.TrimmedString(*instance.Zone, "/"),
Platform: instance.GetCpuPlatform(),
Preemptible: *instance.Scheduling.Preemptible,
OptimizationLoading: true,
Preferences: job.processor.defaultPreferences,
Skipped: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ func (job *OptimizeComputeInstancesJob) Run(ctx context.Context) error {
Id: utils.HashString(item.Id),
Zone: item.Region,
MachineType: item.MachineType,
Preemptible: item.Preemptible,
},
Disks: disks,
Preferences: preferencesMap,
Expand Down
4 changes: 3 additions & 1 deletion plugin/proto/gcp_server.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ message GcpComputeInstance {
string id = 1;
string zone = 2;
string machine_type = 3;
bool preemptible = 4;
}

message GcpComputeDisk {
Expand Down Expand Up @@ -74,7 +75,8 @@ message RightsizingGcpComputeInstance {
string machine_family = 4;
int64 cpu = 5;
int64 memory_mb = 6;
double cost = 7;
bool preemptible = 7;
double cost = 8;
}

message GcpComputeInstanceRightsizingRecommendation {
Expand Down
Loading

0 comments on commit b69f4d0

Please sign in to comment.