class_docstr: Starts a long-running subprocess and restarts it on matched events.
  
  The command parameter is a list of command arguments, such as
  ['bin/myserver', '-c', 'etc/myconfig.ini'].
  
  Call start() after creating the Trick. Call stop() when stopping
  the process.
class_docstr_tok: ["Starts","a","long-running","subprocess","and","restarts","it","on","matched","events",".","The","command","parameter","is","a","list","of","command","arguments",",","such","as","[","'bin\/myserver","'",",","'-c","'",",","'etc\/myconfig.ini","'","]",".","Call","start","(",")","after","creating","the","Trick",".","Call","stop","(",")","when","stopping","the","process","."]
code: def stop(self):
      if self.process is None:
          return
      try:
          os.killpg(os.getpgid(self.process.pid), self.stop_signal)
      except OSError:
          # Process is already gone
          pass
      else:
          kill_time = time.time() + self.kill_after
          while time.time() < kill_time:
              if self.process.poll() is not None:
                  break
              time.sleep(0.25)
          else:
              try:
                  os.killpg(os.getpgid(self.process.pid), 9)
              except OSError:
                  # Process is already gone
                  pass
      self.process = None
  
imports: import os
  import signal
  import subprocess
  import time
  from wandb_watchdog.utils import echo, has_attribute
  from wandb_watchdog.events import PatternMatchingEventHandler
label_desc: Use image node_id 3 for calling the AutoRestartTrick obj's underlying member method code with example usage: obj.stop() without return types