code: def test_error_raised_when_text_fields_contain_token_indexers(
      max_instances_in_memory,
  ):
      """
      This tests that the MultiProcessDataLoader raises an error when num_workers > 0
      but the dataset reader doesn't implement apply_token_indexers().
  
      It also tests that errors raised within a worker process are propogated upwards
      to the main process, and that when that happens, all workers will be successfully
      killed.
      """
  
      with pytest.raises(
          WorkerError,
          match="Make sure your dataset reader's text_to_instance()",
      ):
          loader = MultiProcessDataLoader(
              MockOldDatasetReader(),
              "this-path-doesn't-matter",
              num_workers=2,
              max_instances_in_memory=max_instances_in_memory,
              batch_size=1,
          )
          list(loader.iter_instances())
  
imports: from typing import List, Iterable, Dict
  import torch
  import pytest
  from allennlp.common.testing import requires_gpu
  from allennlp.data.instance import Instance
  from allennlp.data.dataset_readers import DatasetReader
  from allennlp.data.data_loaders import MultiProcessDataLoader, WorkerError
  from allennlp.data.fields import Field, TextField, MetadataField, TensorField
  from allennlp.data.tokenizers import PretrainedTransformerTokenizer
  from allennlp.data.token_indexers import PretrainedTransformerIndexer
  from allennlp.data.vocabulary import Vocabulary
  from allennlp.data.data_loaders.data_collator import LanguageModelingDataCollator
label_desc: Use image node_id 1 for calling a global function with example usage: test_error_raised_when_text_fields_contain_token_indexers(max_instances_in_memory) without return types