def stop(self, unique_id, configs=None):
<EOL>if configs is None:<EOL><INDENT>configs = {}<EOL><DEDENT>tmp = self.default_configs.copy()<EOL>tmp.update(configs)<EOL>configs = tmp<EOL>logger.debug("<STR_LIT>" + unique_id)<EOL>if unique_id in self.processes:<EOL><INDENT>hostname = self.processes[unique_id].hostname<EOL><DEDENT>else:<EOL><INDENT>logger.error("<STR_LIT>".format(unique_id))<EOL>raise DeploymentError("<STR_LIT>".format(unique_id))<EOL><DEDENT>if configs.get('<STR_LIT>', False):<EOL><INDENT>self.terminate(unique_id, configs)<EOL><DEDENT>else:<EOL><INDENT>stop_command = configs.get('<STR_LIT>') or self.default_configs.get('<STR_LIT>')<EOL>env = configs.get("<STR_LIT>", {})<EOL>if stop_command is not None:<EOL><INDENT>install_path = self.processes[unique_id].install_path<EOL>with get_ssh_client(hostname, username=runtime.get_username(), password=runtime.get_password()) as ssh:<EOL><INDENT>log_output(exec_with_env(ssh, "<STR_LIT>".format(install_path, stop_command),<EOL>msg="<STR_LIT>".format(unique_id), env=env))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self.terminate(unique_id, configs)<EOL><DEDENT><DEDENT>if '<STR_LIT>' in configs:<EOL><INDENT>time.sleep(configs['<STR_LIT>'])<EOL><DEDENT>
Stop the service.  If the deployer has not started a service with`unique_id` the deployer will raise an Exception
        There are two configs that will be considered:
        'terminate_only': if this config is passed in then this method is the same as terminate(unique_id) (this is also the
        behavior if stop_command is None and not overridden)
        'stop_command': overrides the default stop_command

        :param unique_id:
        :param configs:
        :return: