code: def test_data_processsor(
      fast_dev_run, delete_cached_files, tmpdir, monkeypatch
  ):
      from PIL import Image
  
      input_dir = os.path.join(tmpdir, "input_dir")
      os.makedirs(input_dir)
  
      imgs = []
      for i in range(30):
          np_data = np.random.randint(
              255, size=(28, 28), dtype=np.uint32
          )
          img = Image.fromarray(np_data).convert("L")
          imgs.append(img)
          img.save(os.path.join(input_dir, f"{i}.JPEG"))
  
      home_dir = os.path.join(tmpdir, "home")
      cache_dir = os.path.join(tmpdir, "cache", "chunks")
      cache_data_dir = os.path.join(tmpdir, "cache", "data")
      monkeypatch.setenv("DATA_OPTIMIZER_HOME_FOLDER", home_dir)
      monkeypatch.setenv("DATA_OPTIMIZER_CACHE_FOLDER", cache_dir)
      monkeypatch.setenv(
          "DATA_OPTIMIZER_DATA_CACHE_FOLDER", cache_data_dir
      )
  
      data_processor = DataProcessor(
          input_dir=input_dir,
          num_workers=2,
          delete_cached_files=delete_cached_files,
          fast_dev_run=fast_dev_run,
      )
      data_processor.run(CustomDataChunkRecipe(chunk_size=2))
  
      fast_dev_run_enabled_chunks = [
          "chunk-0-0.bin",
          "chunk-0-1.bin",
          "chunk-0-2.bin",
          "chunk-0-3.bin",
          "chunk-0-4.bin",
          "chunk-1-0.bin",
          "chunk-1-1.bin",
          "chunk-1-2.bin",
          "chunk-1-3.bin",
          "chunk-1-4.bin",
          "index.json",
      ]
  
      fast_dev_run_disabled_chunks = [
          "chunk-0-0.bin",
          "chunk-0-1.bin",
          "chunk-0-2.bin",
          "chunk-0-3.bin",
          "chunk-0-4.bin",
          "chunk-0-5.bin",
          "chunk-0-6.bin",
          "chunk-0-7.bin",
          "chunk-1-0.bin",
          "chunk-1-1.bin",
          "chunk-1-2.bin",
          "chunk-1-3.bin",
          "chunk-1-4.bin",
          "chunk-1-5.bin",
          "chunk-1-6.bin",
          "chunk-1-7.bin",
          "index.json",
      ]
  
      chunks = (
          fast_dev_run_enabled_chunks
          if fast_dev_run == 10
          else fast_dev_run_disabled_chunks
      )
  
      assert sorted(os.listdir(cache_dir)) == chunks
  
      files = []
      for _, _, filenames in os.walk(os.path.join(cache_dir, "data")):
          files.extend(filenames)
  
      expected = (
          (0 if delete_cached_files else 20)
          if fast_dev_run == 10
          else (0 if delete_cached_files else 30)
      )
      assert len(files) == expected
  
imports: import os
  import random
  import sys
  from typing import Any, List
  from unittest import mock
  import lightning_cloud
  import numpy
  import pytest
  import torch
  from lightning import seed_everything
  from lightning.data.streaming import data_processor
  from lightning.data.streaming import functions
  from lightning.data.streaming.cache import Cache, Dir
  from lightning.data.streaming.data_processor import DataChunkRecipe, DataProcessor, DataTransformRecipe, _download_data_target, _get_item_filesizes, _map_items_to_workers_sequentially, _map_items_to_workers_weighted, _remove_target, _upload_fn, _wait_for_disk_usage_higher_than_threshold, _wait_for_file_to_exist
  from lightning.data.streaming.functions import LambdaDataTransformRecipe, map, optimize
  from lightning_cloud import resolver
  from lightning_utilities.core.imports import RequirementCache
label_desc: Use image node_id 10 for calling a global function with example usage: test_data_processsor(fast_dev_run, delete_cached_files, tmpdir, monkeypatch) without return types