def close(self):
if self.reuse:<EOL><INDENT>logger.debug("<STR_LIT>")<EOL>return<EOL><DEDENT>if self.mode == "<STR_LIT>":<EOL><INDENT>logger.debug("<STR_LIT>")<EOL>return<EOL><DEDENT>try:<EOL><INDENT>pgid = os.getpgid(self.proc.pid)<EOL>os.killpg(pgid, signal.SIGTERM)<EOL>time.sleep(<NUM_LIT>)<EOL>os.killpg(pgid, signal.SIGKILL)<EOL>try:<EOL><INDENT>self.proc.wait(timeout=<NUM_LIT:1>)<EOL>x = self.proc.returncode<EOL>if x == <NUM_LIT:0>:<EOL><INDENT>logger.debug("<STR_LIT>".format(x))<EOL><DEDENT>else:<EOL><INDENT>logger.error("<STR_LIT>".format(x))<EOL><DEDENT><DEDENT>except subprocess.TimeoutExpired:<EOL><INDENT>logger.warn("<STR_LIT>".format(self.proc.pid))<EOL><DEDENT><DEDENT>except Exception as e:<EOL><INDENT>logger.warn("<STR_LIT>".format(self.proc.pid, e))<EOL><DEDENT>
Terminate the controller process and its child processes.

        Args:
              - None