Ejemplo n.º 1
0
 def _to_proto(self):
     pb = dataset_options_pb2.AutotuneOptions()
     if self.enabled is not None:
         pb.enabled = self.enabled
     if self.cpu_budget is not None:
         pb.cpu_budget = self.cpu_budget
     if self.ram_budget is not None:
         pb.ram_budget = self.ram_budget
     return pb
Ejemplo n.º 2
0
 def _to_proto(self):
     pb = dataset_options_pb2.AutotuneOptions()
     if self.enabled is not None:
         pb.enabled = self.enabled
     if self.cpu_budget is not None:
         pb.cpu_budget = self.cpu_budget
     if self.ram_budget is not None:
         pb.ram_budget = self.ram_budget
     if self.autotune_algorithm is not None:
         pb.autotune_algorithm = AutotuneAlgorithm._to_proto(  # pylint: disable=protected-access
             self.autotune_algorithm)
     return pb
Ejemplo n.º 3
0
 def testProtoOptionsDefaultValuesRoundTrip(self):
   pb = dataset_options_pb2.Options()
   options = options_lib.Options()
   options._from_proto(pb)
   result = options._to_proto()
   expected_pb = dataset_options_pb2.Options()
   expected_pb.autotune_options.CopyFrom(dataset_options_pb2.AutotuneOptions())
   expected_pb.distribute_options.CopyFrom(
       dataset_options_pb2.DistributeOptions())
   expected_pb.optimization_options.CopyFrom(
       dataset_options_pb2.OptimizationOptions())
   expected_pb.threading_options.CopyFrom(
       dataset_options_pb2.ThreadingOptions())
   self.assertProtoEquals(expected_pb, result)