def testCustomCloudTpuCidrRange(self): spec = MergeDicts(self.minimal_spec, {'tpu_cidr_range': '192.168.0.0/29'}) result = benchmark_config_spec._CloudTpuSpec(_COMPONENT, flag_values=self.flags, **spec) self.assertEqual(result.tpu_cidr_range, '192.168.0.0/29')
def testCustomCloudTpuAcceleratorType(self): spec = MergeDicts(self.minimal_spec, {'tpu_accelerator_type': 'tpu-v2'}) result = benchmark_config_spec._CloudTpuSpec(_COMPONENT, flag_values=self.flags, **spec) self.assertEqual(result.tpu_accelerator_type, 'tpu-v2')
def testMinimalConfig(self): result = benchmark_config_spec._CloudTpuSpec( _COMPONENT, flag_values=self.flags, **self.minimal_spec) self.assertEqual(result.cloud, 'GCP')
def testTpuZone(self): self.flags['tpu_zone'].parse('us-central1-c') result = benchmark_config_spec._CloudTpuSpec( _COMPONENT, flag_values=self.flags, **self.full_spec) self.assertEqual(result.tpu_zone, 'us-central1-c')
def testTpuTfVersion(self): self.flags['tpu_tf_version'].parse('1.2') result = benchmark_config_spec._CloudTpuSpec( _COMPONENT, flag_values=self.flags, **self.full_spec) self.assertEqual(result.tpu_tf_version, '1.2')
def testTpuNetworkFlag(self): self.flags['tpu_network'].parse('my-tf-network') result = benchmark_config_spec._CloudTpuSpec( _COMPONENT, flag_values=self.flags, **self.full_spec) self.assertEqual(result.tpu_network, 'my-tf-network')
def testDefaultCloudTpuAcceleratorType(self): result = benchmark_config_spec._CloudTpuSpec( _COMPONENT, flag_values=self.flags, **self.minimal_spec) self.assertEqual(result.tpu_accelerator_type, None)
def testDefaultCloudTpuCidrRange(self): result = benchmark_config_spec._CloudTpuSpec( _COMPONENT, flag_values=self.flags, **self.minimal_spec) self.assertEqual(result.tpu_cidr_range, None)
def testCloudTpuNameFlag(self): self.flags['tpu_name'].parse('pkb-tpu') result = benchmark_config_spec._CloudTpuSpec( _COMPONENT, flag_values=self.flags, **self.full_spec) self.assertEqual(result.tpu_name, 'pkb-tpu')
def testCustomCloudTpuVersion(self): spec = MergeDicts(self.minimal_spec, {'tpu_tf_version': 'nightly'}) result = benchmark_config_spec._CloudTpuSpec( _COMPONENT, flag_values=self.flags, **spec) self.assertEqual(result.tpu_tf_version, 'nightly')
def testDefaultCloudTpuVersion(self): result = benchmark_config_spec._CloudTpuSpec( _COMPONENT, flag_values=self.flags, **self.minimal_spec) self.assertEqual(result.tpu_tf_version, None)
def testCustomCloudTpuZone(self): spec = MergeDicts(self.minimal_spec, {'tpu_zone': 'us-central1-a'}) result = benchmark_config_spec._CloudTpuSpec( _COMPONENT, flag_values=self.flags, **spec) self.assertEqual(result.tpu_zone, 'us-central1-a')
def testCustomCloudTpuNetwork(self): spec = MergeDicts(self.minimal_spec, {'tpu_network': 'default'}) result = benchmark_config_spec._CloudTpuSpec( _COMPONENT, flag_values=self.flags, **spec) self.assertEqual(result.tpu_network, 'default')
def testCustomCloudTpuDescription(self): spec = MergeDicts(self.minimal_spec, {'tpu_description': 'My TF Node'}) result = benchmark_config_spec._CloudTpuSpec( _COMPONENT, flag_values=self.flags, **spec) self.assertEqual(result.tpu_description, 'My TF Node')
def testDefaultCloudTpuName(self): result = benchmark_config_spec._CloudTpuSpec( _COMPONENT, flag_values=self.flags, **self.minimal_spec) self.assertEqual(result.tpu_name, 'pkb-tpu-123')
def testCustomCloudTpuName(self): spec = MergeDicts(self.minimal_spec, {'tpu_name': 'pkb-tpu'}) result = benchmark_config_spec._CloudTpuSpec( _COMPONENT, flag_values=self.flags, **spec) self.assertEqual(result.tpu_name, 'pkb-tpu')
def testTpuCidrRangeFlag(self): self.flags['tpu_cidr_range'].parse('10.240.0.0/29') result = benchmark_config_spec._CloudTpuSpec( _COMPONENT, flag_values=self.flags, **self.full_spec) self.assertEqual(result.tpu_cidr_range, '10.240.0.0/29')
def testCustomCloudTpuCidrRange(self): spec = MergeDicts(self.minimal_spec, {'tpu_cidr_range': '192.168.0.0/29'}) result = benchmark_config_spec._CloudTpuSpec( _COMPONENT, flag_values=self.flags, **spec) self.assertEqual(result.tpu_cidr_range, '192.168.0.0/29')
def testTpuAcceleratorTypeFlag(self): self.flags['tpu_accelerator_type'].parse('tpu-v1') result = benchmark_config_spec._CloudTpuSpec( _COMPONENT, flag_values=self.flags, **self.full_spec) self.assertEqual(result.tpu_accelerator_type, 'tpu-v1')
def testCustomCloudTpuAcceleratorType(self): spec = MergeDicts(self.minimal_spec, {'tpu_accelerator_type': 'tpu-v2'}) result = benchmark_config_spec._CloudTpuSpec( _COMPONENT, flag_values=self.flags, **spec) self.assertEqual(result.tpu_accelerator_type, 'tpu-v2')
def testTpuDescriptionFlag(self): self.flags['tpu_description'].parse('MyTfNode') result = benchmark_config_spec._CloudTpuSpec( _COMPONENT, flag_values=self.flags, **self.full_spec) self.assertEqual(result.tpu_description, 'MyTfNode')