class_docstr: Tests propagating data service metadata through tf.data service.
class_docstr_tok: ["Tests","propagating","data","service","metadata","through","tf.data","service","."]
code: def testElementSpecMixedMode(self):
      cluster = data_service_test_base.TestCluster(
          num_workers=1,
          work_dir=data_service_test_base.NO_WORK_DIR,
          fault_tolerant_mode=False,
      )
      num_elements = 10
      dataset = dataset_ops.Dataset.range(num_elements)
  
      @def_function.function
      def get_dataset_id():
          return data_service_ops.register_dataset(
              cluster.dispatcher_address(), dataset
          )
  
      dataset_id = get_dataset_id()
      dataset_id_val = tensor_util.constant_value(dataset_id)
  
      with self.assertRaisesRegex(
          ValueError,
          f"Failed to fetch element spec for dataset id {dataset_id_val} from "
          "tf.data service. If the dataset was registered in graph mode or "
          "inside a tf.function, the `element_spec` must be specified as an "
          "argument to `from_dataset_id`.",
      ):
          dataset = data_service_ops.from_dataset_id(
              processing_mode=data_service_ops.ShardingPolicy.OFF,
              service=cluster.dispatcher_address(),
              dataset_id=dataset_id,
          )
  
imports: import functools
  from absl.testing import parameterized
  from tensorflow.python.data.experimental.kernel_tests.service import test_base
  from tensorflow.python.data.experimental.ops import data_service_ops
  from tensorflow.python.data.experimental.ops import distribute
  from tensorflow.python.data.kernel_tests import test_base
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import combinations
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.ops import script_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 5 for calling the DataServiceMetadataTest obj's underlying member method code with example usage: obj.testElementSpecMixedMode() and returns: data_service_ops