Skip to content

Commit

Permalink
Resolve unsoundness caught by pytype --strict-none-binding.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 606415588
  • Loading branch information
p3rf Team authored and copybara-github committed Feb 13, 2024
1 parent ea4a54c commit 224a10d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
4 changes: 3 additions & 1 deletion perfkitbenchmarker/edw_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ def ExecuteThroughput(self, concurrency_streams: List[List[str]]) -> str:

def WarmUpQuery(self):
"""Executes a service-agnostic query that can detect cold start issues."""
if self.client_vm is None:
raise ValueError('SetProvisionedAttributes() not called')
with open(SAMPLE_QUERY_PATH, 'w+') as f:
f.write(SAMPLE_QUERY)
self.client_vm.PushFile(SAMPLE_QUERY_PATH)
Expand Down Expand Up @@ -344,7 +346,7 @@ def __init__(self, edw_service_spec):
self.spec = edw_service_spec
# resource workflow management
self.supports_wait_on_delete = True
self.client_interface = None
self.client_interface: EdwClientInterface

def GetClientInterface(self) -> EdwClientInterface:
"""Gets the active Client Interface."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def Run(benchmark_spec):
vms = benchmark_spec.vms
num_tests = len(FLAGS.bidirectional_network_tests)
num_streams = FLAGS.bidirectional_stream_num_streams
test_results = [None] * num_tests
test_results = [([], 0., 0.)] * num_tests

args = [
(
Expand Down
7 changes: 5 additions & 2 deletions perfkitbenchmarker/linux_benchmarks/mpi_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

import logging
from typing import Any, Dict, Iterator, List, Tuple
from typing import Any, Dict, Iterator, List, Tuple, TypeVar
from absl import flags
from perfkitbenchmarker import background_tasks
from perfkitbenchmarker import benchmark_spec
Expand All @@ -16,7 +16,10 @@
from perfkitbenchmarker import sample
from perfkitbenchmarker.linux_packages import mpi

_BaseLinuxVirtualMachine = linux_virtual_machine.BaseLinuxVirtualMachine
_BaseLinuxVirtualMachine = TypeVar(
'_BaseLinuxVirtualMachine',
bound=linux_virtual_machine.BaseLinuxVirtualMachine,
)

# documents the individual MPI tests in each suite
_MPI_SUITE_TESTS = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ def _RunMultiStreamProcesses(vms, command_builder, cmd_args, streams_per_vm):
streams_per_vm: number of threads per vm.
"""

output = [None] * len(vms)
output = [''] * len(vms)

def RunOneProcess(vm_idx):
logging.info('Running on VM %s.', vm_idx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(self, vm_spec: virtual_machine.BaseVmSpec):
self.zone = 'us-south-1' # default
self.fip_address = None
self.fip_id = None
self.network = None
self.network: ibmcloud_network.IbmCloudNetwork
self.subnet = FLAGS.ibmcloud_subnet
self.subnets = {}
self.vpcid = FLAGS.ibmcloud_vpcid
Expand Down

0 comments on commit 224a10d

Please sign in to comment.