code: def test_mars_backend_clean_up_and_restore_func(setup):
      config = _load_mars_config(CONFIG_FILE)
      config["task"][
          "task_preprocessor_cls"
      ] = "mars.deploy.oscar.tests.test_clean_up_and_restore_func.MarsBackendFuncCheckedTaskPreprocessor"
      config["subtask"][
          "subtask_processor_cls"
      ] = "mars.deploy.oscar.tests.test_clean_up_and_restore_func.MarsBackendFuncCheckedSubtaskProcessor"
  
      sess = new_test_session(default=True, config=config)
  
      cols = [chr(ord("A") + i) for i in range(10)]
      df_raw = pd.DataFrame(
          dict((c, [i**2 for i in range(20)]) for c in cols)
      )
      df = md.DataFrame(df_raw, chunk_size=5)
  
      x_small = pd.Series([i for i in range(10)])
      y_small = pd.Series([i for i in range(10)])
      x_large = pd.Series([i for i in range(10**4)])
      y_large = pd.Series([i for i in range(10**4)])
  
      def closure_small(z):
          return pd.concat([x_small, y_small], ignore_index=True)
  
      def closure_large(z):
          return pd.concat([x_large, y_large], ignore_index=True)
  
      r_small = df.apply(closure_small, axis=1)
      r_small.execute()
      r_large = df.apply(closure_large, axis=1)
      r_large.execute()
  
      sess.stop_server()
  
imports: from typing import Any, Dict
  import pandas
  import pytest
  from ....None import dataframe
  from ....dataframe.base.apply import ApplyOperand
  from ....config import option_context
  from ....core import TileableGraph, OperandType
  from ....services.task.supervisor.tests import CheckedTaskPreprocessor
  from ....services.subtask.worker.tests import CheckedSubtaskProcessor
  from ....services.task.supervisor.preprocessor import TaskPreprocessor
  from ....services.subtask.worker.processor import SubtaskProcessor
  from ....utils import lazy_import
  from ..local import _load_config
  from ..tests.session import new_test_session, CONFIG_FILE
label_desc: Use image node_id 2 for calling a global function with example usage: test_mars_backend_clean_up_and_restore_func(setup) and returns: pd, pd