Skip to content

Commit ae67736

Browse files
andyz422copybara-github
authored andcommitted
Add aws_instance_bandwidth_weighting flag.
PiperOrigin-RevId: 822664868
1 parent c93f95d commit ae67736

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

perfkitbenchmarker/providers/aws/aws_virtual_machine.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,13 @@ def _GenerateCreateCommand(self):
962962
'{CapacityReservationId=%s}' % reservation_id]
963963
else:
964964
reservation_args = []
965+
966+
bandwidth_weighting_args = []
967+
if aws_flags.AWS_INSTANCE_BANDWIDTH_WEIGHTING.value:
968+
bandwidth_weighting_args = [
969+
'--network-performance-options',
970+
f'BandwidthWeighting={aws_flags.AWS_INSTANCE_BANDWIDTH_WEIGHTING.value}'
971+
]
965972
create_cmd = util.AWS_PREFIX + [
966973
'ec2',
967974
'run-instances',
@@ -972,7 +979,7 @@ def _GenerateCreateCommand(self):
972979
'--key-name=%s' % AwsKeyFileManager.GetKeyNameForRun(),
973980
'--tag-specifications=%s'
974981
% util.FormatTagSpecifications('instance', self.aws_tags),
975-
] + reservation_args
982+
] + reservation_args + bandwidth_weighting_args
976983

977984
if FLAGS.aws_vm_hibernate:
978985
create_cmd.extend([
@@ -1607,6 +1614,9 @@ def GetResourceMetadata(self):
16071614
result['efa_count'] = FLAGS.aws_efa_count
16081615
result['nic_count'] = FLAGS.aws_efa_count
16091616
result['preemptible'] = self.use_spot_instance
1617+
result['instance_bandwidth_weighting'] = (
1618+
aws_flags.AWS_INSTANCE_BANDWIDTH_WEIGHTING.value or 'default'
1619+
)
16101620
return result
16111621

16121622
def DiskTypeCreatedOnVMCreation(self, disk_type):

perfkitbenchmarker/providers/aws/flags.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@
3939
'The queue count of each NIC. Specify a list of key=value pairs, where key'
4040
' is the network device name and value is the queue count.',
4141
)
42-
42+
AWS_INSTANCE_BANDWIDTH_WEIGHTING = flags.DEFINE_enum(
43+
'aws_instance_bandwidth_weighting',
44+
None,
45+
['vpc-1', 'ebs-1'],
46+
'The bandwidth weighting of each instance, increasing one of vpc and ebs'
47+
' bandwidth at the expense of the other. Valid options are vpc-1, ebs-1.',
48+
)
4349
flags.DEFINE_string(
4450
'aws_dax_node_type',
4551
'dax.r4.large',

0 commit comments

Comments
 (0)