code: def update_training_service_config(
      config,
      training_service,
      config_file_path,
      nni_source_dir,
      reuse_mode="False",
  ):
      it_ts_config = get_yml_content(
          os.path.join(
              "training_service", "config", "training_service.yml"
          )
      )
      # hack for kubeflow trial config
      if training_service == "kubeflow" and reuse_mode == "False":
          it_ts_config[training_service]["trial"]["worker"][
              "command"
          ] = config["trial"]["command"]
          config["trial"].pop("command")
          if "gpuNum" in config["trial"]:
              config["trial"].pop("gpuNum")
      elif training_service == "kubeflow" and reuse_mode == "True":
          it_ts_config = get_yml_content(
              os.path.join(
                  "training_service",
                  "config",
                  "training_service_v2.yml",
              )
          )
          print(it_ts_config)
          it_ts_config[training_service]["trainingService"]["worker"][
              "command"
          ] = config["trialCommand"]
          it_ts_config[training_service]["trainingService"]["worker"][
              "code_directory"
          ] = config["trialCodeDirectory"]
  
      if (
          training_service == "frameworkcontroller"
          and reuse_mode == "False"
      ):
          it_ts_config[training_service]["trial"]["taskRoles"][0][
              "command"
          ] = config["trial"]["command"]
          config["trial"].pop("command")
          if "gpuNum" in config["trial"]:
              config["trial"].pop("gpuNum")
      elif (
          training_service == "frameworkcontroller"
          and reuse_mode == "True"
      ):
          it_ts_config = get_yml_content(
              os.path.join(
                  "training_service",
                  "config",
                  "training_service_v2.yml",
              )
          )
          it_ts_config[training_service]["trainingService"][
              "taskRoles"
          ][0]["command"] = config["trialCommand"]
  
      if training_service == "adl":
          # hack for adl trial config, codeDir in adl mode refers to path in container
          containerCodeDir = config["trial"]["codeDir"]
          # replace metric test folders to container folder
          if config["trial"]["codeDir"] == ".":
              containerCodeDir = (
                  "/" + config_file_path[: config_file_path.rfind("/")]
              )
          elif config["trial"]["codeDir"] == "../naive_trial":
              containerCodeDir = (
                  "/test/training_service/config/naive_trial"
              )
          elif "../../../" in config["trial"]["codeDir"]:
              # replace example folders to container folder
              containerCodeDir = config["trial"]["codeDir"].replace(
                  "../../../", "/"
              )
          it_ts_config[training_service]["trial"][
              "codeDir"
          ] = containerCodeDir
          it_ts_config[training_service]["trial"][
              "command"
          ] = "cd {0} && {1}".format(
              containerCodeDir, config["trial"]["command"]
          )
  
      if training_service == "remote":
          testcase_config = get_yml_content(
              nni_source_dir + config_file_path
          )
          sharedStorage = testcase_config.get("sharedStorage")
          if sharedStorage is None:
              it_ts_config[training_service].pop("sharedStorage")
          elif str(sharedStorage.get("storageType")).lower() == "nfs":
              it_ts_config[training_service].get("sharedStorage").pop(
                  "storageAccountKey"
              )
          elif (
              str(sharedStorage.get("storageType")).lower()
              == "azureblob"
          ):
              it_ts_config[training_service].get("sharedStorage").pop(
                  "nfsServer"
              )
              it_ts_config[training_service].get("sharedStorage").pop(
                  "exportedDirectory"
              )
          else:
              it_ts_config[training_service].pop("sharedStorage")
  
      if training_service == "hybrid":
          it_ts_config = get_yml_content(
              os.path.join(
                  "training_service",
                  "config",
                  "training_service_v2.yml",
              )
          )
      elif reuse_mode != "True":
          deep_update(config, it_ts_config["all"])
      deep_update(config, it_ts_config[training_service])
  
imports: import argparse
  import datetime
  import json
  import os
  import subprocess
  import sys
  import time
  import yaml
  import validators
  from utils import CLEAR, EXPERIMENT_URL, GREEN, RED, REST_ENDPOINT, STATUS_URL, TRIAL_JOBS_URL, deep_update, dump_yml_content, get_experiment_dir, get_experiment_id, get_experiment_status, get_failed_trial_jobs, get_trial_stats, get_yml_content, parse_max_duration_time, print_experiment_log, print_trial_job_log, wait_for_port_available
label_desc: Use image node_id 1 for calling a global function with example usage: update_training_service_config(config, training_service, config_file_path, nni_source_dir, reuse_mode) without return types