code: def handle_distributed_coach_tasks(
      graph_manager, args, task_parameters
  ):
      ckpt_inside_container = "/checkpoint"
  
      memory_backend_params = None
      if args.memory_backend_params:
          memory_backend_params = json.loads(args.memory_backend_params)
          memory_backend_params["run_type"] = str(
              args.distributed_coach_run_type
          )
          graph_manager.agent_params.memory.register_var(
              "memory_backend_params",
              construct_memory_params(memory_backend_params),
          )
  
      data_store = None
      data_store_params = None
      if args.data_store_params:
          data_store_params = construct_data_store_params(
              json.loads(args.data_store_params)
          )
          data_store_params.expt_dir = args.experiment_path
          data_store_params.checkpoint_dir = ckpt_inside_container
          graph_manager.data_store_params = data_store_params
          data_store = get_data_store(data_store_params)
  
      if args.distributed_coach_run_type == RunType.TRAINER:
          task_parameters.checkpoint_save_dir = ckpt_inside_container
          training_worker(
              graph_manager=graph_manager,
              data_store=data_store,
              task_parameters=task_parameters,
              is_multi_node_test=args.is_multi_node_test,
          )
  
      if args.distributed_coach_run_type == RunType.ROLLOUT_WORKER:
          rollout_worker(
              graph_manager=graph_manager,
              data_store=data_store,
              num_workers=args.num_workers,
              task_parameters=task_parameters,
          )
  
imports: import sys
  import copy
  from configparser import ConfigParser, Error
  import os
  from rl_coach import logger
  import traceback
  from rl_coach.logger import screen, failed_imports
  import argparse
  import atexit
  import time
  import sys
  import json
  from rl_coach.base_parameters import Frameworks, VisualizationParameters, TaskParameters, DistributedTaskParameters, RunType, DistributedCoachSynchronizationType
  from rl_coach.core_types import TotalStepsCounter, RunPhase, PlayingStepsType, TrainingSteps, EnvironmentEpisodes, EnvironmentSteps, StepMethod, Transition
  from multiprocessing import Process
  from multiprocessing.managers import BaseManager
  import subprocess
  from glob import glob
  from rl_coach.graph_managers.graph_manager import HumanPlayScheduleParameters, GraphManager
  from rl_coach.utils import list_all_presets, short_dynamic_import, get_open_port, SharedMemoryScratchPad, get_base_dir, set_gpu
  from rl_coach.graph_managers.basic_rl_graph_manager import BasicRLGraphManager
  from rl_coach.environments.environment import SingleLevelSelection
  from rl_coach.memories.backend.redis import RedisPubSubMemoryBackendParameters
  from rl_coach.memories.backend.memory_impl import construct_memory_params
  from rl_coach.data_stores.data_store import DataStoreParameters
  from rl_coach.data_stores.s3_data_store import S3DataStoreParameters
  from rl_coach.data_stores.nfs_data_store import NFSDataStoreParameters
  from rl_coach.data_stores.redis_data_store import RedisDataStoreParameters
  from rl_coach.data_stores.data_store_impl import get_data_store, construct_data_store_params
  from rl_coach.training_worker import training_worker
  from rl_coach.rollout_worker import rollout_worker
  from rl_coach.schedules import *
  from rl_coach.exploration_policies.e_greedy import *
label_desc: Use image node_id 5 for calling a global function with example usage: handle_distributed_coach_tasks(graph_manager, args, task_parameters) without return types