Skip to content

Commit ea271e8

Browse files
authored
Fix readme (#38)
* remove the log in selector_test * sync-readme * change vcpus to mem ratio usage
1 parent 2433734 commit ea271e8

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,17 @@ Filter Flags:
145145
--deny-list string List of instance types which should be excluded w/ regex syntax (Example: m[1-2]\.*)
146146
-e, --ena-support Instance types where ENA is supported or required
147147
-f, --fpga-support FPGA instance types
148-
--gpu-memory-total float Number of GPUs' total memory in GiB (Example: 4) (sets --gpu-memory-total-min and -max to the same value)
149-
--gpu-memory-total-max float Maximum Number of GPUs' total memory in GiB (Example: 4) If --gpu-memory-total-min is not specified, the lower bound will be 0
150-
--gpu-memory-total-min float Minimum Number of GPUs' total memory in GiB (Example: 4) If --gpu-memory-total-max is not specified, the upper bound will be infinity
148+
--gpu-memory-total string Number of GPUs' total memory (Example: 4 GiB) (sets --gpu-memory-total-min and -max to the same value)
149+
--gpu-memory-total-max string Maximum Number of GPUs' total memory (Example: 4 GiB) If --gpu-memory-total-min is not specified, the lower bound will be 0
150+
--gpu-memory-total-min string Minimum Number of GPUs' total memory (Example: 4 GiB) If --gpu-memory-total-max is not specified, the upper bound will be infinity
151151
-g, --gpus int Total Number of GPUs (Example: 4) (sets --gpus-min and -max to the same value)
152152
--gpus-max int Maximum Total Number of GPUs (Example: 4) If --gpus-min is not specified, the lower bound will be 0
153153
--gpus-min int Minimum Total Number of GPUs (Example: 4) If --gpus-max is not specified, the upper bound will be infinity
154154
--hibernation-support Hibernation supported
155155
--hypervisor string Hypervisor: [xen or nitro]
156-
-m, --memory float Amount of Memory available in GiB (Example: 4) (sets --memory-min and -max to the same value)
157-
--memory-max float Maximum Amount of Memory available in GiB (Example: 4) If --memory-min is not specified, the lower bound will be 0
158-
--memory-min float Minimum Amount of Memory available in GiB (Example: 4) If --memory-max is not specified, the upper bound will be infinity
156+
-m, --memory string Amount of Memory available (Example: 4 GiB) (sets --memory-min and -max to the same value)
157+
--memory-max string Maximum Amount of Memory available (Example: 4 GiB) If --memory-min is not specified, the lower bound will be 0
158+
--memory-min string Minimum Amount of Memory available (Example: 4 GiB) If --memory-max is not specified, the upper bound will be infinity
159159
--network-interfaces int Number of network interfaces (ENIs) that can be attached to the instance (sets --network-interfaces-min and -max to the same value)
160160
--network-interfaces-max int Maximum Number of network interfaces (ENIs) that can be attached to the instance If --network-interfaces-min is not specified, the lower bound will be 0
161161
--network-interfaces-min int Minimum Number of network interfaces (ENIs) that can be attached to the instance If --network-interfaces-max is not specified, the upper bound will be infinity
@@ -168,7 +168,7 @@ Filter Flags:
168168
-c, --vcpus int Number of vcpus available to the instance type. (sets --vcpus-min and -max to the same value)
169169
--vcpus-max int Maximum Number of vcpus available to the instance type. If --vcpus-min is not specified, the lower bound will be 0
170170
--vcpus-min int Minimum Number of vcpus available to the instance type. If --vcpus-max is not specified, the upper bound will be infinity
171-
--vcpus-to-memory-ratio string The ratio of vcpus to memory in MiB. (Example: 1:2)
171+
--vcpus-to-memory-ratio string The ratio of vcpus to GiBs of memory. (Example: 1:2)
172172
173173
174174
Suite Flags:
@@ -198,6 +198,7 @@ package main
198198
import (
199199
"fmt"
200200

201+
"github.com/aws/amazon-ec2-instance-selector/pkg/bytequantity"
201202
"github.com/aws/amazon-ec2-instance-selector/pkg/selector"
202203
"github.com/aws/aws-sdk-go/aws"
203204
"github.com/aws/aws-sdk-go/aws/session"
@@ -222,10 +223,10 @@ func main() {
222223
LowerBound: 2,
223224
UpperBound: 4,
224225
}
225-
// Instantiate a float64 range filter to specify min and max memory in GiB
226-
memoryRange := selector.Float64RangeFilter{
227-
LowerBound: 1.0,
228-
UpperBound: 4.0,
226+
// Instantiate a byte quantity range filter to specify min and max memory in GiB
227+
memoryRange := selector.ByteQuantityRangeFilter{
228+
LowerBound: bytequantity.FromGiB(2),
229+
UpperBound: bytequantity.FromGiB(4),
229230
}
230231
// Create a string for the CPU Architecture so that it can be passed as a pointer
231232
// when creating the Filter struct

cmd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Full docs can be found at github.com/aws/amazon-` + binName
117117

118118
cli.IntMinMaxRangeFlags(vcpus, cli.StringMe("c"), nil, "Number of vcpus available to the instance type.")
119119
cli.ByteQuantityMinMaxRangeFlags(memory, cli.StringMe("m"), nil, "Amount of Memory available (Example: 4 GiB)")
120-
cli.RatioFlag(vcpusToMemoryRatio, nil, nil, "The ratio of vcpus to memory in MiB. (Example: 1:2)")
120+
cli.RatioFlag(vcpusToMemoryRatio, nil, nil, "The ratio of vcpus to GiBs of memory. (Example: 1:2)")
121121
cli.StringFlag(cpuArchitecture, cli.StringMe("a"), nil, "CPU architecture [x86_64/amd64, i386, or arm64]", nil)
122122
cli.IntMinMaxRangeFlags(gpus, cli.StringMe("g"), nil, "Total Number of GPUs (Example: 4)")
123123
cli.ByteQuantityMinMaxRangeFlags(gpuMemoryTotal, nil, nil, "Number of GPUs' total memory (Example: 4 GiB)")

pkg/selector/selector_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,6 @@ func TestFilter_X8664_AMD64(t *testing.T) {
568568
}
569569
results, err := itf.Filter(filters)
570570
h.Ok(t, err)
571-
log.Println(results)
572571
h.Assert(t, len(results) == 1, "Should only return 1 instance type with x86_64/amd64 cpu architecture")
573572
h.Assert(t, results[0] == "t3.micro", "Should return t3.micro, got %s instead", results[0])
574573
}

0 commit comments

Comments
 (0)