code: def setup(self):
      from lightning.app.utilities.state import AppState
  
      _set_work_context()
  
      # 1. Make the AppState aware of the affiliation of the work.
      # hacky: attach affiliation to be know from the AppState object
      AppState._MY_AFFILIATION = affiliation(self.work)
  
      # 2. Attach the queues to the work.
      # Each work gets their own request- and response storage queue for communicating with the storage orchestrator
      self.work._request_queue = self.request_queue
      self.work._response_queue = self.response_queue
  
      # 3. Starts the Copier thread. This thread enables transfering files using
      # the Path object between works.
      self.copier = _Copier(
          self.work, self.copy_request_queue, self.copy_response_queue
      )
      self.copier.setDaemon(True)
      self.copier.start()
  
      # 4. If the work is restarting, reload the latest state.
      # TODO (tchaton) Add support for capturing the latest state.
      if self.work._restarting:
          self.work.load_state_dict(self.work.state)
  
      # 5. Inform the flow that the work is ready to receive data through the caller queue.
      self.readiness_queue.put(True)
  
imports: import os
  import pathlib
  import queue
  import signal
  import sys
  import threading
  import time
  import traceback
  import warnings
  from contextlib import contextmanager
  from copy import deepcopy
  from dataclasses import dataclass, field
  from functools import partial
  from threading import Event, Thread
  from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, Optional, Set, Tuple, Type, Union
  from deepdiff import DeepDiff, Delta
  from lightning_utilities.core.apply_func import apply_to_collection
  from lightning.app.core import constants
  from lightning.app.core.queues import MultiProcessQueue
  from lightning.app.storage.copier import _Copier, _copy_files
  from lightning.app.storage.drive import Drive, _maybe_create_drive
  from lightning.app.storage.path import Path, _path_to_work_artifact
  from lightning.app.storage.payload import Payload
  from lightning.app.utilities.app_helpers import affiliation
  from lightning.app.utilities.component import _set_work_context
  from lightning.app.utilities.enum import CacheCallsKeys, WorkFailureReasons, WorkStageStatus, WorkStopReasons, make_status
  from lightning.app.utilities.exceptions import CacheMissException, LightningSigtermStateException
  from lightning.app.utilities.app_helpers import Logger
label_desc: Use image node_id 3 for calling the WorkRunner obj's underlying member method code with example usage: obj.setup() without return types