Sets the shard_dimension of each element of the queue. shard_dimensions must be a list of length self.number_of_tuple_elements, and each element must be convertible to a Dimension compatible with self.tuple_shapes. Args: shard_dimensions: the dimensions of each queue element.
(self, shard_dimensions)
| 312 | return [policy.shard_dimension for policy in self._sharding_policies] |
| 313 | |
| 314 | def set_shard_dimensions(self, shard_dimensions): |
| 315 | """Sets the shard_dimension of each element of the queue. |
| 316 | |
| 317 | shard_dimensions must be a list of length |
| 318 | self.number_of_tuple_elements, and each element must be |
| 319 | convertible to a Dimension compatible with self.tuple_shapes. |
| 320 | |
| 321 | Args: |
| 322 | shard_dimensions: the dimensions of each queue element. |
| 323 | |
| 324 | Raises: |
| 325 | ValueError: if shard_dimensions is not of length |
| 326 | self.number_of_tuple_elements; or an element of |
| 327 | shard_dimensions cannot be converted to a Dimension; or an |
| 328 | element of shard_dimensions is a Dimension that is out of |
| 329 | range for the corresponding tuple element shape. |
| 330 | """ |
| 331 | if len(shard_dimensions) != self.number_of_tuple_elements: |
| 332 | raise ValueError("shard_dimensions is %s, but must be a list of length %d" |
| 333 | % (str(shard_dimensions), |
| 334 | self.number_of_tuple_elements)) |
| 335 | for (policy, dimension) in zip(self._sharding_policies, shard_dimensions): |
| 336 | policy.set_shard_dimension(dimension) |
| 337 | self._validate() |
| 338 | |
| 339 | @property |
| 340 | def number_of_shards(self): |