class_docstr: This controls a job:
  - instantiate each of the tasks
  - sends timeout signal
  - stops all tasks if one of them finishes
  - cleans up the tasks/closes log files when deleted
class_docstr_tok: ["This","controls","a","job",":","-","instantiate","each","of","the","tasks","-","sends","timeout","signal","-","stops","all","tasks","if","one","of","them","finishes","-","cleans","up","the","tasks\/closes","log","files","when","deleted"]
code: def __init__(self, folder: Path):
      self.ntasks = int(os.environ["SUBMITIT_LOCAL_NTASKS"])
      self.command = shlex.split(os.environ["SUBMITIT_LOCAL_COMMAND"])
      self.timeout_s = int(os.environ["SUBMITIT_LOCAL_TIMEOUT_S"])
      self.signal_delay_s = int(
          os.environ["SUBMITIT_LOCAL_SIGNAL_DELAY_S"]
      )
      self.stderr_to_stdout = bool(
          os.environ["SUBMITIT_STDERR_TO_STDOUT"]
      )
      self.tasks: tp.List[subprocess.Popen] = []  # type: ignore
      self.stdouts: tp.List[tp.IO[tp.Any]] = []
      self.stderrs: tp.List[tp.IO[tp.Any]] = []
      with_shell = bool(os.environ["SUBMITIT_LOCAL_WITH_SHELL"])
      self.pid = str(os.getppid() if with_shell else os.getpid())
      self.folder = Path(folder)
      signal.signal(signal.SIGTERM, self._forward_signal)
  
imports: import os
  import shlex
  import signal
  import subprocess
  import sys
  import time
  import typing
  from pathlib import Path
  from ..core import core, job_environment, logger, utils
  from ..core.core import R
label_desc: Use image node_id 1 to create a new Controller object  with example: obj = Controller(folder)