code: def start_torchserve(
      ncs=False,
      model_store="model_store",
      workflow_store="",
      models="",
      config_file="",
      log_file="",
      gen_mar=True,
  ):
      if gen_mar:
          mg.gen_mar(model_store)
      print("## Starting TorchServe")
      cmd = [f"{torchserve_command[platform.system()]}"]
      cmd.append("--start")
      cmd.append(f"--model-store={model_store}")
      if models:
          cmd.append(f"--models={models}")
      if workflow_store:
          cmd.append(f"--workflow-store={workflow_store}")
      if ncs:
          cmd.append("--ncs")
      if config_file:
          cmd.append(f"--ts-config={config_file}")
      if log_file:
          print(f"## Console logs redirected to file: {log_file}")
      print(
          f"## In directory: {os.getcwd()} | Executing command: {' '.join(cmd)}"
      )
      p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
      if log_file:
          Path(log_file).parent.absolute().mkdir(
              parents=True, exist_ok=True
          )
          with open(log_file, "a") as f:
              for line in p.stdout:
                  f.write(line.decode("utf-8"))
                  if "Model server started" in str(line).strip():
                      break
          t = LogPipeTillTheEnd(p, log_file)
          t.start()
      else:
          for line in p.stdout:
              if "Model server started" in str(line).strip():
                  break
  
      status = p.poll()
      if status == 0:
          print("## Successfully started TorchServe")
          return True
      else:
          print("## TorchServe failed to start !")
          return False
  
imports: import os
  import platform
  import sys
  import threading
  from pathlib import Path
  from subprocess import PIPE, STDOUT, Popen
  import requests
  from ts_scripts import marsgen
label_desc: Use image node_id 1 for calling a global function with example usage: start_torchserve(ncs, model_store, workflow_store, models, config_file, log_file, gen_mar) and returns: True, False